TODAY I started with the HUD. I’m using tcod to create a panel. I then blit messages, the HP and STR bars and other info to this panel before adding it to the bottom of the main screen. This helps me keep functionality separate and organised, I plan to do the same when it comes to the inventory view and if I get time, controls view.
WITH THE HUD working my task was to create monsters. For this I needed inspiration, being aware that Rogue uses a randomised combat system like Dungeons and Dragons I first took some time to learn how that combat system works. I then chose to implement that in my game, so if a monster has attack “2d6”, then the damage done is determined by rolling two dice with six sides each.
Then it was just a simple (?!) job of trying to come up with a monster name for all 26 letters of the alphabet without using any magical creatures. I wanted a balance of animals and human characters, so we have everything from a Dodo to a Ninja. Then I tried to balance them through the levels, setting their HP and damage accordingly. It’s too early to really tweak them for balance, that’ll come later.
I had an idea of giving monsters some “dispositions”, then saw that the idea of giving monsters flags to inform their behaviour had been done before. So I kept the same term and included that in the data, but the flags don’t do anything yet! I added in a monster state that I can use to decide what a monster is currently doing.
Moving And Attacking Monsters
TO MAKE the monsters move was surprisingly simple due to tcod including the A* algorithm for path finding. So if a monster is “ACTIVE” they’ll choose a random direction, but if they’re “TARGETING”, they’ll use A* to move towards the player.
For attacking I first wrote code so that the player could attack a monster. It checks to see if the location it is trying to move onto is blocked, and if it is then it will find the monster on that location and attack them. I made and tested this before the monsters moved.
I made this attack code generalised enough that it would work for a monster trying to attack the player too. However, I had a funny glitch where the monsters started to fight each other! As useful as that may be, I decided it was against the spirit of the game and prevented it.
Bring Out The Dead
Last job, and a quick one, was to remove the dead monsters from the level. This was as simple as a filter function at the correct spot.
I have normal world monsters, tomorrow I’ll create the magic world monsters and take into account the flags/dispositions. From there it’ll be onto items and inventory. With that complete, I’ll tackle the transitions between the two worlds, but that wont be tomorrow!