Earlier on in development, after I’d worked through getting enemies to spawn, locate their target, die dramatically, all that, I rushed through arming the default enemy so I could finally playtest. I ripped the rifle prefab off the player and gave them some bullets and added a firing condition to their script and started finally testing.
All the enemies started killing themselves.
The enemy snipers would spawn in, pop out of cover, line up their shot, and then just when they say their target, the firing sound effect would play and they would ragdoll, fall to the floor, and despawn.
This is obviously not ideal. Even if it might be more realistic, Halo would be no fun if all the grunts and jackals shot themselves at the first sight of the Master Chief and my game definitely won't be good either if all the enemies are suicidal. Aside from that, my goal is to make a somewhat goofy first person shooter and not a psychological horror.
I spent more time than I would like to admit pouring through the enemies' scripting, desperately trying to figure out what innocuous line was causing mass suicide. They weren't mistaking themselves for their target, I hadn't blacked out and added a misery module or anything like that, there wasn't enough bullet ricochet to account for all the deaths, my game soundtrack didn’t include Gloomy Sunday.
But in checking and rechecking the enemies script, I didn’t take time to examine the firing mechanism. Every time they pulled the trigger, they were spawning a bullet in the chamber of their gun just as it would when the player fires their rifle. Except this bullet was specifically tagged to trigger a script to kill them and spawning in the rifle right next to their head, and just a little inside the headshot hitbox.
Trying to save a few minutes by reusing assets I lost days of productivity and created some extremely troubling and troubled enemies.
Maybe because of all the suicides, Counter Sniper is still in Alpha, but if you want to hear more about my failures, please give me a follow on IndieDB for future articles and updates, join our Discord to ask questions or give suggestions, or follow me on Twitter because why not.
Thanks for reading.
Also here's a preview of something I've been working on the past week. The Distraction Cannon.