The Road Traveled Again -- Plans for Today, The AI, and The End Game
Quick Edit: Changed title to something more clever :-)Today will be a day of intense work. It'll be rough, but I hope it'll pay off.
I will definitely be making factory methods for building terrain objects such as slopes, beveled boxes, and hills.
Rabbits will also be implemented, and they will be used to fully test my spatial hash.
Bushes will then be added, as will amendments to the rabbits' behavior to make them not react to the player when they are hiding in a bush.
Dogs will be the final probable addition for the day.
The AI for both dogs and rabbits will be fairly simple.
Both types of animals, not having spotted a predator or prey, will simply wander around back and forth, turning around when their height (Y coordinate) falls to or past ten below their initial height since the last time they lost their alerted status, or if they have not been alerted before, their height the first time they hit the ground. This keeps them from simply wandering off of a ledge unless they are chasing or being chased.
Rabbits will run away when they spot the player, and will jump when they are below the player by about five pixels or more. They jump at that point because all of the terrain pieces will have some amount of beveling, so it can make rabbits at least try to jump gaps. Or, at least, look like that's what they're trying to do ;-)
Rabbits will occasionally sit and graze for up to three seconds, where they will neither move nor turn.
Dogs will run after the player when they spot them. If the player is above them by at least ten pixels, they will plan to jump. They will record where the player was horizontally when they went upward, and when they are within 5 pixels of that spot, they will jump.
Dogs that have not spotted the player will randomly fall asleep for five to fifteen seconds.
Also, dogs will run away if they player pounces on them while still undetected. (IE: The dog is looking the other way, or is asleep)
When a dog is scared like this, it will run in the same direction, jumping when its downward velocity increases and it is still on the ground, so it will appear to try to jump gaps. If it reaches the edge of the world while still frightened, it will disappear.
If the player leaves an animal's field of view for about two seconds, and the animal isn't going to jump, they calm down, and "Think they lost him".
Animals will not reach that status in the air, however, for the purposes of the AI system, which, as noted earlier, records their elevation at the time they calm down.
Dogs will treat rabbits like they treat the player, but will prefer chasing the player. Rabbits will treat dogs the way they treat the player, without exception. This creates a certain amount of interaction between creatures.
The animals' fields of view will be represented by a pair of polygons that extend in either direction from the animal. The front polygon (Whichever points in the direction that the animal is facing) will always be checked.
The exception is sleeping dogs. When a dog is asleep, it does not check either of those polygons.
The other polygon will only be checked when the animal is still in "I'm being chased" mode.
This makes it possible to sneak up behind an animal, to pounce on it.
--
As for tomorrow...
Tomorrow will be a day of polishing dog and rabbit behavior and physics (Things like jump height, running speed, etc.)
I will also use tomorrow to start work on the scoring system, which will be very simple, as well as lives.
I'll be making numerals and an icon for the lives.
Over the course of the back end of tomorrow and the time I have left tomorrow I will make a title screen, and if I have time, possibly demo screens.
And then... I can hope for...
BLUE SKY :-D