"yes master; another like your current model or maybe one which works this time?"
That has been stuck in my head all day, I'm pretty sure I stole it from Dilbert [grin]
So, yes, brains.
I was mostly considering today how I was going to make things 'think'; as already covered the brains are going to be powered by a Lua thread, one for each creature and tower in the land, which effectively makes the 'think' function a co-routine which can carry on on it's own. The co-routine itself will be attached to an instance of the table/object we are using to represent the monster. One of the cool things about Lua is that you can pass in and retrive arbtitry paramters and values, something which can be exploited I'm sure with this system to pass information to and from the co-routine each 'think' tick. I need to consider this some more however.
In a twist to the normal tower defense games, as the monsters won't be walking a fixed path but will be free roaming they will also attack towers, which effect how they think. Instead of blindly following way points the creatures will react in certain ways.
For example, the 'simple' monster brain might work as follows
- if attacked and tower in range then attack tower
- if attacked and tower out of range and in sight move towards tower
- if near tower attack
- if tower in sight move towards closest tower
- else wander about
The 'wander about' state is a bit of an intresting one, I'm not sure how I'm going to do that one yet; I'm tempted to place way points in the map (well, I say 'me' whoever does the maps) so that monsters drift towards them and towards the city naturally.
Some other ideas I've been toying with is the idea of grouping; so that if certain monsters see other monster they will follow that monster, carrying out the actions it does. So, if the leader is attacked then the group will try to swarm a tower for example.
Other creatures could do things such as only attack when they have a certain number in a group.
However these are all things which need to be carried out later on once some thing is up and running.
Towers also need brains, however tower brains are somewhat easier
- if we have no target or current target out of range
-- find closest monster and assign as new target
- fire at target
There might be some provision for priority of targets or prefered targets, this depends on how the monsters and weapons develop.
I'm also toying with the idea of giving towers effective firing zones, like the MG emplacements/squads in CoH; this means instead of having 360 degree firing a tower has a limited arc it can fire in. Missile based probably wont be as effected by this, balistic certainly would be although it might make sense to give it two firing arcs for forward and back. Thoughts anyone?
Tomorrow I might start developing a proof-of-concept for the monster brain and tower brains on a simple 2D grid to see how they react and give me something to work with (I don't want to do any 3D work until Longs Peak is a reality but as it might be a month or two off still waiting on it to begin any dev. work would just be silly).