Zombies - a 2D top-down shooter

After spending an unreasonably large amount of time playing Zero Sievert, Nuclear Throne, and Brigador, I made a small web game about surviving in a pretty bad neighborhood.

I love this genre

2D shooters run on any PC and are easier to "read" than first person shooters.

After hundreds of hours playing them, I had to give it a try. I don't have a clear idea, just some mechanics I like.

Web tech

I started by picking my favorite platform, a simple web page. I'll render things using the Canvas 2D API because that's what I know. WebGL is still looking scary, and I don't want to use a pre-existing engine because where's the fun in that? Also, I make very limited AI use, just for the well-defined and abstract math parts, like computing if two segments intersect.

Fully procedural

I noticed that Zero Sievert is quite a heavy game, with an 800 MB install size. This always felt odd. Why would a 2D pixel art game need so much storage? I'll try to stay under 1 MB for my version, so assets are all procedural in some way. The focus is on gameplay, not on atmosphere.

Point of view

I never understood how games like Brigador justify giving you a bird's-eye view of the battlefield while you are supposed to be on the ground. You can see everything happening, while enemies can only see what's right in front of them.

I prefer the way zero sievert handles player visibility, with the base map layer being always visible, while enemies only appear when there's an unobstructed line between them and the player.

The issue is that this kind of visibility check can be hard to implement efficiently. So for now the player sees everything in the day but has only limited forward vision at night. It's a nice change of atmosphere, even if the visibility in the day is not realistic. On the first nights you have some moonlight, then less and less.

Guns

Some guns in brigador feel unique, but the smallest guns tend to be the best ones. In Zero Sievert the guns are very detailed and realistic but feel a bit too much like a spreadsheet.

I've added a small selection of real-world guns, plus their corresponding ammo. Right now the magazine size is limited, but the player can "top up" their magazine with infinite cartridges.

I'd like to introduce an interesting choice between carrying lots of ammo or not at some points. It would reduce player speed and increase generated noise.

I think it would make sense to start each run with a pretty bad gun and find better ones over time.

NPC behavior

That part is hard but fun. The game has multiple zombie types and various human factions roaming around the map.

Setting rules for zombie and NPC behavior has been the most challenging part so far. I try to keep the zombies' AI very simple and lean but dedicate a bit more resources to human AI for their pathfinding.

Projectiles

They are considered a straight line for collision purposes. No matter how fast they fly (the minigun shoots pretty fast bullets), they'll hit the closest obstacle in their way first, every time. This is quite a change from the balls and coin logic in Zala, where I compute fast movement by using many smaller steps.

Performance

The hot path is allocations free to avoid garbage collection events tanking performance at random. The game boots quickly and generates chunks on demand, based on a seed.

The way lights are computed is still rough; it could be made more efficient, but the algorithms and logic are tricky to get right.

Finding the fun

I'm still unsure what this game should be really about. It's a bit of a practice run to dip my toes in the genre. The projectile physics was much easier than anticipated. Pathfinding and getting a half-decent ai is harder than expected.

I'm already quite happy with the mobile control scheme, but it could be refined.

There's a limitless list of things that could be added to a game like this. I'm not sure what to aim for yet.

Try it now

The game can be tried here: https://zombies.lecaro.me