Okay, so I might be asking for a lot here. I’ll try to add edits as I make improvements.
I’ve been working on a top down wave based shooter. Right now I’m trying to set up a basic enemy to attack the player, and to get them to attack back. Keep in mind, right now everything is VERY basic. I want to get everything working as good as possible before adding the polish to it and making it look swagalicious. I’ve started off with a very basic spawning system. Just four sprites thrown out of bounds that the game randomly selects from every five seconds and spawns a zombie at.
Now, when the zombies spawn, I want them to move towards the player, and then once they get close enough, attack the player. I also want them to move smoothly, and to feel slightly intimidating. I’ve got some basic code for the zombies, but they have a few kinks and bugs that I need to work out.
The code for the zombies at this point is extremely simple, along with the spawner code
The attack code as well.
Zombies Clustering: This one has been fixed :D
The first problem I have with the zombies, is that they cluster way too easily. When close together, they tend to overlap each other. I tried setting them all as a pathfinding obstacle themselves, but the AI spazzes out when I do that. Is there a way to keep them separate from each other?
Better Zombie AI: In Progress, see future posts below
After that, we have how the zombies move. Right now, they just rush straight towards the player. This works for the most part, but if possible, I’d like for them to seem a bit more lifelike. Maybe once they get into the house, they can randomly search rooms, going to designated points the map before getting close enough to the player and then chasing them down. I feel like I could get something like this running, but it’ll be hard considering the next problem.
The biggest thing impacting me right now is the lag. After adding the basic spawner, the game has been running much slower than usual, especially when more zombies flood the room. It gets so unstable that the player shakes when pressed up against a wall, and can even glitch out of the house. I need help improving this so my game doesn’t end up being too big to run on my own computer.
To make it simple, here’s my to-do list.
Keep zombies away from each other
[ ] Make zombies seem more threatening
[ ] Keep game running smoothly as possible
Any suggestions help a bunch, thank you! If you’d like to see any other code or things that might help, feel free to ask, and I’ll post asap!