I have been working more on the enemy system, getting it to where I want to be. Most recently I made it so the enemies are aware when they are falling (under the level) and they disappear when they reach a certain depth below. Eventually I will have them fade out, but right now they “blink” out.
I have been busy with other things so not much marble development, but I have been reading fun books when I can…
I use Finite State Machines (FSM) for many things in this game. So naturally I have put it into the AI code I have been creating. FSMs are easy to understand and build upon, but sometimes easy to get carried away with if not planned properly. So I am trying to sketch out some flowcharts of the various states the enemies can be in, and how they relate to one another. I’ll include a diagram of what the FSM for an enemy is once I have it all mapped out. Right now we have a rudimentary Wait->Active->Finished->Wait cycle written for the Whirlygig. It works out well and each enemy takes care of its own state.
I have done something which I think is interesting with the AI system. I have two controlling variables that [a] dictate how often I update the AI per second (cycles) and [b] how many enemies update per cycle. This variable system will be fairly helpful in determining a good balance for smooth updating throughout the second. In other words, we don’t want to update the AI for each enemy 100 times a second but we may want to spread it out and update 100 enemies once over the course of a second. This can be done any number of ways, either 10 times per second for 10 enemies, 5 times per second for 20 enemies, or twice a second for 50 enemies. The 10*10 will be the smoothest overall. An “update” is where the enemy will make decisions whether it should change state or keep doing what it is doing.