Castles & Trees


Here you can see Castles & Trees now in the game (although the AI doesn’t use them yet..) I know the magic wood trees are a bit flat, but at least they are in there for now.

I had to expand the engine a bit to support trees and castles.. A piece can now have a chance between 0 and 100 of disappearing each turn prior to movement. Associated with these are flags for only disappearing if a creature is riding on it (i.e. a wizard in a magic wood tree), an effect name say that we can make castles explode, but magic wood trees just disappear. Also an associated number of bonus spells value for if a piece disappears so we can implement magic woods.



# Group details are used to stop trees being cast adjacent to each other.

(The config files used by PTK don’t handle spaces very well, hence the use of underscore characters..)

I also had to alter the movement code to do a check to stop shadow wood trees moving over bodies if they kill a creature. Changes have been made as well as deal with defences of 0 (invulnerable) and attacks of 0 (can’t attack).

To make it so that trees are not able to be cast next to each other I’ve implemented a group name that each piece can have, as well as a flag to say if a piece can be positioned adjacent to someone in the same group. This lets me call both Magic Woods and Shadow Woods as being part of the Tree group and not being able to be next to each other. This was a bit more coding, and I have to pass the group name as text string around a few functions. However, this lets us have other uses for groups, say to let a mutation spell know to only pick from creatures in one group.. and it also stops us hard-coding something just for trees. A silly example is that we might want new spells of a Cat and a Dog, but not want them to be next to each other..

Well, all this was a bit of work and I still need to make the AI use these spells, and I also need to tidy up some parts of the code which are getting a bit difficult to follow. I don’t think I’ll get much more done today, but enjoy the pic and progress report! 🙂