AI progress

The AI is now able to select from creature spells according to a risk value. Low risk values mean the wizard first tries to cast spells with a high chance of succeeding. High risk values mean the wizard will try to cast spells like dragons and vampires which are not that likely to work.

Tied into this risk value is an assesment of the wizards strength in comparison to enemy wizards. Positive values means the wizard is in a position of strength and so the risk value will increase as he feels more able to take a risk in casting harder spells.

Negative values mean the wizard feels under threat and is more likely to cast easier spells to try to get back into the game. However if the threat is severe then the wizard will try more risky spells to try to stop the more dangerous creatures that are threatening him. This is all without illusions being present in the game yet..

Here is a screenshot showing a 4 AI wizard battle (where one has already been killed) in a game mode where all spells work. You can see from the info at the bottom their strength and risk values. 🙂

Screenshot

Building an AI

I’ve made a start on the AI spell selection code today. I’ve had a look through the old Chaos Funk code and I seem to have mislaid the very latest version, but also the code is such a horrible mess it’s practically unusable. So.. we’ll start again..

The spectrum original had a very simple AI and it had value scores for creatures and other spells precoded into the game. While this makes it easy to pick a good spell, it has the disadvantage that the score can’t be easily manipulated to suit the situation. For example if you have a weak wizard it’s sometimes better to cast something you can ride than a stronger creature that leaves your wizard unprotected.

To code this kind of flexibility you have to break down the stats of the piece that makes up the ‘score’ for each creature spell. In this way you can make rideable creatures become more highly rated if the wizard is not riding anything. This also means it’s easier to add new spells as well in the long run. I’ve just done the first version of this code and although it doesn’t take into account the spell chance, I’m pretty surprised by how well the final score compares against both our own perceived value of a creature and the chance it has of being cast. Here is the list of spells a computer wizard received and they have been pre-sorted alphabetically and then by spell chance:

name: giant_rat – rated: 15
name: orc – rated: 17
name: orc – rated: 17
name: orc – rated: 17
name: dire_wolf – rated: 30
name: goblin – rated: 26
name: goblin – rated: 26
name: horse – rated: 28
name: bat – rated: 29
name: crocodile – rated: 50
name: crocodile – rated: 50
name: eagle – rated: 49
name: gryphon – rated: 58
name: gryphon – rated: 58
name: gryphon – rated: 58
name: lion – rated: 56
name: unicorn – rated: 55
name: giant – rated: 79
name: green_dragon – rated: 94
name: green_dragon – rated: 94

The next step is to adjust the score function to take into account the situation, so making rideable creatures more attractive, or undeads, etc.. This is a bit harder! 🙂

More sprite work..

I’ve added another 4 redrawn creatures to the new Chaos Groove pack: Faun, Unicorn, Centaur and Pegasus.
Because the last 3 of those are based on the horse gfx it didn’t take so long to redraw them.

I’ve still got a few creatures to go through however… groan!