• entries
18
12
• views
17380

# Monster spawning new and improved

870 views

So, I finally improved my list of monsters. Last time, I showed you I had everything in the __init__ of the world object, now I have a fancy system. All you need to do when you define a new monster, is make sure your arguments are the same as the default, and do it like this:[code=auto:9054]class whatever(object): @itemRandomizer.registerMonster(mindungeonlevel,maxdungeonlevel,propability,othersuff) def __init__(self, position, world):
and the monster will be generated. You can use the same system for items. The only problem is that itemRandomizer is the only instance of the class that defines the methods. Since all of this stuff is evaluated while the game is loading, I don't think it is a big problem. The class will also store data about whether unique items have been generated yet, when implemented, so the only reason I can see to have more then one is if you for some reason have 2 games going, like maybe hosting a server or something, but that seems really unlikely, and you can always deepcopy() it.

The other thing I did, though its related, is make monsters spawn even after the level has generated. This is proven, see the image, by me having 11 meat, while there are only 10 monsters generated when the level starts. The monsters are still really hard to find, since there are roughly 30 rooms in a 150*150 grid with a lot of space between them, so even with 10 on the level, you have to go around the grid a ton of times before you find one.

I also fixed a potential bug in the player input system that allowed you to do something without costing a move if you pressed a certain key the same frame. This also allowed me to update the screen without allowing monsters to move.

The other thing I did was implement armor. Armor reduces damage by multiplying it. So good armor would do something like 0.25 while horrible armor, like is available now, has 0.95, and the worst armor of all is more then one, so magnifying the damage done. I have different types of damage, so that could create the interesting situation where a piece of armor protects you from some extremely strong electrical attack, but actually increases the damage done by normal, physical, attacks. I also implemented that different monsters have different armor slots, or different amount of hands for multihanded fighting, though right now you can only fight with your right hand. (how do you like my pants image?)

Lizards are not a serious threat now if you have armor, level 2 accuracy, and a few potions of healing. This means I can start adding tougher monsters.

I also made some changes to the level generator. The generator is extremely buggy, so it tends to fill up whole areas with paths before finding the way to the next room. I had build a system that would detect if a path tile was surrounded by more path tiles, and remove it if it was. Only, it did it in some random situations, namely: (# is path)
 ####### ####### #
where it removed the central tile. Usually there was a way around, but it was a long way of, and potentially never, disconnecting the rooms.

Me

There are no comments to display.

## Create an account

Register a new account