Log In  

I'm writing a roguelike! it's not even a game at this point, because all the gamey bits are missing (victory conditions, interesting decisions, etc). So you need stuff(monsters, magic, item, traps). But how do you put stuff in?

For the time being I'm doing it when the room is created. The rooms can vary in size a whole lot by design, but I'm kind of worried about having the same amount of stuff in small and huge rooms.
So I decided for he following algorithm:
1: each room has a 50% chance of having a monster, and if it does try again (and then again, etc)
2: rooms bigger than 20-40 locs should have as many attempts to have monsters (so 2 attempts if >30, 3 if >60, etc)

Here's the code. I understand it's really not much, but it does a neat trick

function stock_room(x,y,x2,y2)
  local area = (x2-x)*(y2-y) -- the size of the room
  do
   if chance(0.5) then -- 50% chance
    spawn_monster(x,y,x2,y2)
   else
    area -= random_in_range(20,40)
   end
  while area > 0 
end  

So before i start do delve into the pinzillacchere accretion pattern I wanted combat done, a level generator and monsters spawning. Combat is done! monsters can fight and die!

Small screenshot here with the wizard chased by an angry mob. I also added x-flip to the actor's sprite depending on their direction. Not much but helps a lot make sense of screenshots.

I can start coding the DODECATHAUMAGRAMMATA and the monsters tomorrow :)

P#20731 2016-05-17 18:40 ( Edited 2016-05-18 12:58)


[Please log in to post a comment]