Game-play in Zity is currently at the fledgling point. It's just starting to take root and sprout it's mighty branches upwards. But as for what you can see NOW... well not much (Movement, Shooting, Vehicles, Zombies.. All basics). So my goals are to really work on the game-play elements until completion and THEN and ONLY THEN move on to map generation.
Today's goal was sight, smell, sound. I wanted zombie to react to seeing a player, smelling something, and hearing something. Two days ago I worked on implementing zombies as a state machine and got the theory to the point where, today, I could start implementing these features.
(My Zombie State Machine)*
*band name anyone?
So first up is sight. Zombies should be able to see a player walking along and then switch from idling, to attacking them. In implementing sight there were little to no issues. The basics of it are as follows:
-Check every zombie for a player within it's sight radius (circle).
-Check the player to see if it is within a cone in front of the zombie (cone).
-Use a raycast to determine if there are any walls or other sight-obstructions in the way (line).
-If none we can see the player/creature, if any then we can't.
A simple process. I implemented this in under an hour and to my satisfaction everything ran smoothly. The zombies would now wait til you were in front of them and within a certain distance before giving chase.
The next logical step from sight was to work on things that obstruct sight (walls). I already have a physics engine that can create physical walls for the player to run into, and a lighting engine that can create shadow objects that obstruct lights, all I had to do was put them together. I created a Wall class that contained both a shadow-hull and physics-object and synced them so they were in the same spot and orientation. I gave my walls a default texture and after spending close to 45 minutes fixing what amounted to a slip of the mind, I had collidable, occlusive walls. These walls also prevented the zombies from seeing you.
(Walls - blocking light and zombies. He also can't see me)
I haven't started on implementing smell and sound but I know exactly how they will work. Before I implement sound I may have to actually ADD sound to the game... maaaaaybe. So next up is most likely zombie attacks and implementing the aforementioned state machine. Hope there's anyone out there still with me.


No comments:
Post a Comment