Wishful coding: Symbol based AI

I have been reading Gödel, Escher, Bach: An Eternal Golden Braid, which among many things, talks about how symbols and simple rules create emergent system and eventually consciousness. One of the reasons I got in the process of writing Herculeum was that I wanted to tinker with various AI routines, so this section of the book is really interesting. Reading of course got me interested on trying to think how to code such a system.

As interesting as simulating neurons and their connections is, I would skip that level and write the AI system based on symbols. These symbols would represent different things like moving, taking, dropping, items, other creatures, pain, comfort and such. Some of them would respond to external stimuli, like seeing another character to perform an action, like picking up or dropping something. Depending on the situation, some of these symbols would become active, while others would be dormant. Other symbols would then react to these symbols and activate or deactive and so on. Eventually some very concrete symbol or symbols would active, which in turn would trigger action. For example: Our character is simple humanoid who is standing in a room when a player attacks it. There probably would be pain, attack and character symbols active at least. These could activate enemy symbol and combination of these would activate survival, fight and flee symbols and so on.

When it is AI character’s turn to act, AI would start looking on active symbols at the top of the hierarchy and pick the one that seems to make most sense and act on it. In combat example, if our AI character is in good shape, they would choose to fight. However, if they’re hurt, AI would decide to try and retreat instead of fighting. How these high-level decisions are mapped into actions requires yet another step though. Mere idea of fighting isn’t enough to fight effectively, since enemy might be out of reach or using landscape to their advantage. Thus, symbol fight would require some sort of tactical system to map it into series of actions: move, dodge pillar on the way, attack in close combat.

Since characters aren’t going to be alive for a significant amount of time, there is no really need for learning and creation of new symbols and connections between them. System would be quite close to hard-coded, maybe with some parts randomized/parametrized to create differently behaving creatures. There probably would be need of class (weapon) and instance (this particular weapon) level symbols though.

Now the tricky part: would this actually make the game any different for the player? A very sophisticated system doesn’t matter much, if all it does is spend more CPU cycles to make the same boring choices as a dumber AI would. Also, at somepoint I resolved to have more arcade-like feel for the game, where monsters would work similarly to Super Mario games: they would follow preprogrammed paths, act consistently and in a way that player could easily guess what they’re up to next. For such a system symbol based AI isn’t the best option. But it could be used to spice up things with special monsters, maybe masterminds of the labyrinth. They would be unique, hard to win obstacles with great rewards (this would also help mitigate the CPU load). Using symbols and interesting environment with minions to help them, these AI characters might actually manage to surprise the player and do something unexpected.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s