Monster AI

My 7DRL entry Room Rogue is coming along nicely. Previously I had monsters which were very dumb. They would line up and try to attack the player. However only the first monster in the line would do the attacking. The others would wait behind that monster. I needed these monsters to be a little smarter and move around the other monster. That way they could tag team attack the player. Without this, multiple monsters did not pose much of a challenge.

The trick behind this was to sometimes choose a non-optimal direction for the monsters to move. The optimal direction is the one that takes them closest to the player. However if that spot is inaccessible, the monster should choose another direction. The best direction of the available directions should be taken. I implemented that today.

Now with more monsters acting smartly, I needed to give the player some means of staying alive. Therefore I added leveling up for players. If a player levels up, they get more health. And to implement the level up, I had to implement levels for players, as well as experience for players.

Now tomorrow I must add some color to this game to give it pizazz. Then I might add some more monster types if time allows (right now you only fight orcs).

No comments: