Today I spent some time developing more of the backbone of my game. I made it so the "random level generator" made some walls that make a bit more sense rather than a mess of points, and I also worked out all the bugs so it's now impossible to pass through the walls no matter how you push against them or how fast you're going.
Once I completed this I used the same system to apply it to all objects like bullets and AI units. I found I could use the same math to do a line-of-sight check for AI as well, which indirectly led me to making my first AI class - a simple AI that chases you down.
So here's how to make sense of this image:
- The green square is the AI unit
- Red square is the player
- Yellow empty square is the last position the AI saw the player at
- Lines are walls
- Red cross is the mouse reticle
Basically the AI will continuously move towards the player until the player moves out of sight. When the player is out of sight the AI will continue to the last location it saw the player at and continue looking for the player from there. If the AI doesn't see the player again and reaches the last location it saw the player, it just idles until it sees the player again. There's definitely room for a lot more features for this guy and I'm pretty excited thinking about what I could put in.
The circles you see behind the player are "sound circles". It's a visualization of how much noise the player is making while moving or firing, and in the future I plan to let AI units "hear" things and guess a location to search. I also plan to put in fog of war so when the player can't see things, they can "hear" them.
So. The next features I plan to put in, in no particular order:
- Voronoi or another sort of tessellation for efficient collision checking
- Making the level generator make "zones" instead of just random points so the walls make more sense
- AI "Hearing" and response
- Projectile-Character collisions (and underlying systems allowing that. Basically hitboxes.)
No comments:
Post a Comment