Make a Shooter With AI: Why Hits Must Feel Good First
To make a shooter with AI, start with one room, one weapon and one enemy seen from above, and get the feel of a single hit right. A view from above is far easier to build than first-person, and the rest of the game leans on that one moment.
Why does a correct shot still feel weak?
Ask your AI for shooting and you will get something accurate: you click, a number drops, an enemy vanishes. It works, and it feels like filling in a form.
Say your game is about a pest-control drone in a huge night-time greenhouse, spraying glowing moths. What makes a hit satisfying is a stack of tiny things, all in the same instant:
- a sound with some punch
- a quick flash on the moth
- the moth reeling backwards
- a tiny kick of the screen
- a very short pause, so the moment lands
Each one is cheap to add. Your AI will not add them unless you ask, because none of them are needed for the game to be correct. Together they are the difference between a toy and a chore.
How smart do enemies need to be?
Less smart than you think, but readable. A moth that flies straight at you gets dull quickly. Three behaviours go a long way: drifting, noticing you, and rushing. What matters is that players can tell which one is happening, and that enemies only react to what they could really see. An enemy that tracks you through a wall feels like cheating, and players will say so.
Add a second enemy only when it forces something new. A moth that splits in two when sprayed up close makes you back away, and that changes how you play far more than a tougher moth does.
What is the right order?
- Moving and aiming, with the keyboard and mouse.
- The shot, with all its feedback.
- One enemy with its three behaviours.
- Getting hurt, and being able to tell where it came from.
- Reloading, which is a moment of risk you create on purpose.
- A second enemy.
- More rooms.
If you later want a first-person view in the browser, plan for the mouse. MDN's documentation says capturing the mouse needs a real click or similar action from the player. It also says that a new attempt straight after the player leaves with the default key, usually Esc, will fail. So you need a "click to continue" screen, and it is better to know that now.
What ends shooter projects?
Starting big. First-person 3D, online matches and ten weapons in the first week means none of them ever feels right. A cramped greenhouse with one good spray beats a huge world with ten dull guns.
Weapons that differ only in damage are the same trap in a smaller size. A new weapon should ask for a new way of standing, moving or timing.
Paste this to your AI
Build a small top-down shooter: one room with some cover, one weapon, one enemy type. Keyboard to move, mouse to aim, click to shoot.
Your first step is no code. Draw two loops as a state machine in a Mermaid diagram: the player (move, aim, shoot, reload, hurt, dead) and the enemy (idle, notice, chase, attack, hit, dead). Point out any two moments that could clash, such as being hit in the middle of a reload. Build from those.
Every hit gets a sound, a flash on the target, a small screen kick and a reaction from the enemy.
Enemies may only act on what they could really see. For each enemy behaviour you say works, name the spot in the room and what you tried there. If you could not try it, say you do not know. The feel is my decision.
Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
How to check it worked
- Close your eyes and fire. You should hear the difference between a hit and a miss.
- Mute the game. You should still see every hit.
- Hide behind cover. An enemy that cannot see you should not know where you are.
- Reload under fire. Get hit halfway through. Nothing should freeze or give free ammo.
- Get hit from behind. You should be able to tell the direction at once.
- Run out of ammo. The game should make that obvious, not silent.