itch.io is community of indie game creators and players

Devlogs

Ripping out Brains, Madness and Fear

Sunlorn
A downloadable game

Feels like pretty soon I'll have all the major systems in place and all the foreseeable refactors taken care of. I'm looking forward to moving into a long phase of just tightening bolts and creating content.

Anyway, on another post on the subreddit a few months ago, I saw some devs describing that they used an AI controller class that was separate from the monster class to move those entities around. This really struck me, and I wish I had originally implemented my game in this way. Instead, I had a monster class derived from a general "Agent" class (of which the player character class was also derived) with all of the AI methods baked in. This was proving to be a problem when I wanted to be able to use the same AI code for something other than moving a monster around. Specifically, I wanted to do things like:

- give the player an auto-explore command

- have the player temporarily lose control of their character when under the influence of certain magic

- allow the character to be controlled by AI for debugging purposes

So this week I set about ripping all the AI code out of the monster class to put it inside a separate "brain" class. I had to swim through a sea of compiler errors as I converted every "do_something()" into "body.do_something()", but I eventually go through it. Then I gave the player a brain that can temporarily take over at certain times.

The player can now be the target of a fear spell that will force the player to flee from a scary enemy. They can also be the subject of a "cause madness" spell that makes the player temporarily insane and attack other nearby agents. This spell can be very harmful if the player has any allied followers.

I also created the "axe of fury". This is a fairly powerful melee weapon that, as a side effect, has a 17% chance to cause the user to go mad for 5-11 turns after any substantial hit. So it's a great weapon to have when the odds are already in your favour, but not what you want when you need to approach a battle with caution.

Some other ideas for the future:

- An enemy that can hypnotize the player, causing the player to follow them back into a small cave where a stronger enemy waits in ambush.

- NPCs that can be hired to guide the player to some location. This would put the player on autopilot while they follow the guide.

Files

  • Sunlorn-v0.2.1.zip 1.8 MB
    Apr 16, 2025
Download Sunlorn
Leave a comment