Ethan Ethan

The nature of polish is that it starts with fixing lots of little things that had before been overlooked. Spring cleaning. Refinement. Whee.

I knew the AI stuff needed a huge makeover, but I never realized just how bad it was! Apparently even the simple Shoots AI was wrong. It's still a little ugly but at least it behaves correctly in the case where the AI did not start on the first frame of the game. (Surprisingly common -- it even happens in training2.) There are two approaches I could take to implement an AI that shoots every n frames -- either calculate the frame it will have to shoot next at, or keep track of how much time it has left to pass, and every time the AI runs, it deducts how much time has passed. The first approach maintains its rate of fire even if the AI is turned off and then restored a frame later. The second one instead "picks up where it left off", and fires a frame later as a result. I'm not sure which is better or more right, so I went with the implementation that was in the class in the first place (which was a modified form of the first -- store the frame when it fired last and expect to fire again when the game's frame counter is greater than that frame + the AI's period). Time will tell, I guess.

I still haven't posted a notice on the Pygame site about our new release yesterday. I'm a little bit afraid, but I don't know why. I'll do it tomorrow, probably.

Ethan

Tags:
Last edited Mon 29 Oct 2007 09:47:27 PM PDT