Wednesday 4 January 2012

Basic, but too basic...

I managed to get some preliminary AI code working . Here is a short video of a single "zombie" attempting to track the "player". I am controlling the Green player, the zombie is controlling itself ;)

Note that I haven't written any collision detection routines yet.


Based on this routine, I tweaked it a little and it handles up to 1000 zombies now! Unfortunately, that just looks like one huge red blob and you can't see the Green player at all. So here is the routine with a few more entities...


So the basics are there, or so I thought...

After messing around with the code, it's become apparent that I am approaching this from the wrong angle. The tracking code is so simplistic on these demo's that I shouldn't really have the nerve to call it AI. I've been doing some research, and I think I need to create the zombies as completely independent entities. That is, at the moment they are independent in a way, but their co-ordinates and paths are held in the same variable array, albeit multidimensional. I need to create them as completely standalone entities if they are to have any kind of semblance of a sentient character.

So I've got a scratchpad to work with, and that is basic but good enough for now. I'm going to completely strip out the existing zombie control routine and (try to) replace it with some sort of... well, I don't know what. But whatever it turns out to be, I want each zombie to react completely independently of each other. For example, if the player comes within a certain distance of a zombie I want that zombie to react, but zombies further away would just trundle on regardless.

I might not even be able to do this, but I will try. I think it might be a while until my next blog update, I have a feeling this next step will be my biggest challenge so far. (Including that Java thing...)