Random items, monster placement, and increasing levels.

So this past week I have made more progress than I had planned.  That makes me feel good to be a little ahead of schedule and I will be able to do some minor fixes and figure out some minor issues that I can see cropping up as the game progresses.  Everything that I implemented this past week turned out to be a lot more simple than I thought that it was going to be.

With the random debris I suppose that is not entirely true.  I wanted to make it so the placed debris would not be walk able.  But if I did that I would have to write code to check all adjacent spaces to see if there is anything within those areas and then not let it place anything if there is something there.  Another solution would be to just erase anything in the areas around the debris each time that something is laid.  This would guarantee that all paths will be passable when it is generated.  As it places things randomly there is a chance that there would only be one debris on the map left.

The code for the debris just selects a random spot where the floor is the dungeon floor and then place an item.  Then checks to see how many there are to figure out if its ready to pass to the next step in the process.

While I was working on debris I also wanted to add treasure chests, though because of the randomness that is involved in the code I don't think that treasure chests as they are is the right way to avoid immersion breaking.   Right now they are just placed at the end of halls which are left over points that could have held the exit point.  They don't account for number or anything else,  I am currently not satisfied with this and will change this when I get a chance to really look at it and find a better solution.  Likely a limiter to how many can be placed and also other places they can be placed such as rooms as well.

This week I also added some monsters, the art itself I made a few weeks ago when I was still working through some planning stuff.  They are not complete as they only face one direction and still need a ton of work to be fully implemented monsters.  I reused my MOb spawner coded but I took out the timed elements.  I didn't want an infinity of monsters flooding the map.  I may revisit the idea with monsters that spawn monsters or other such things.  I changed the place room code to place a different type of floor than the hallways.  This way I can select those areas when placing monsters to create groups or hordes of monsters, instead of them being sparce throughout the map.  Which wouldn't necessarily be a bad thing but just not what I wanted.  After the monsters are placed in the floor is changed the normal dungeon floor type.

The last thing that I did this week was adding the level system to the dungeon generation.  Previously the dungeon was generated using random numbers.  I just started to keep track of how many times groups had all made it to the safe zone.  I then take that number and pass it on to %halls variable and add 2 to it for the minimum level.  I also passed it into the %rooms variable and then divided that by four.  I was worried that having to many rooms when it started getting large would just create one big open space.  It might still I have not had the chance to make it to floor 100.  But 25 voids seemed reasonable especially since they can overlap as well.  I have also increased the map size to the maximum free map size and increased the area the dungeon can spawn to the largest size possible for this layout.

To make sure that the level doesn't just stay at the last level I wrote some code to reset the step and the level when no one is in the dream anymore.  This makes reaching level 100 a bit more difficult.

Thank you for taking the time to read this I am having a lot of fun making this and I hope that you are having as much fun as I am.

The current source can be found here

Comments