General tips on programming enemies?

Started by
9 comments, last by morbs 7 months, 2 weeks ago

I've been chipping away at making a game solo for years now, as hobby projects to get better at coding. I've now been programming for a long time, and can pretty much code up anything I can imagine.

However, I'm finding that programming the bad guys is by far the hardest part of making a game. I dont know what it is, maybe just a mental thing. When I try to make a bad guy I end up just staring at my screen for hours until I give up and work on a different part of the game.

Its getting to the point where the game is pretty good except for the lack of enemies. Ive got some pretty cool random level generation, lots of weapons, upgrades, saving and loading, and basic multiplayer. But the enemies are just basically circles that move toward you and when they touch you you lose health. I have different colors of circles with different speeds and hitpoints but thats it.

So I guess I'm hoping that this is a pretty common thing and someone has some good tips for me. I never would have thought that making half-decent fun enemies was so much harder than all the other parts of gamedev.

Advertisement

Make your enemies do something more fun and interesting, not necessarily something much smarter.

For example, if enemies shoot the player with an instantly hitting laser the player will have to think about maintaining cover and not only distance; if they throw slow rocks the player will engage in dodging; if they shoot wide area of effect grenades the player will worry about being cornered; all for the modest cost of implementing line of sight checks, projectiles and explosions, weapons with firing rate limitations, and new animated graphical assets.

Omae Wa Mou Shindeiru

morbs said:
General tips on programming enemies?

I'm finding that programming the bad guys is by far the hardest part of making a game.

Programming is not Game Design. What is Game Design? This topic has now been moved to a more appropriate forum.

-- Tom Sloper -- sloperama.com

I often feel the same. I believe it's not a mental thing, it's a real thing. I have to think:

  1. Enemies as the challenge itself. If the game is a puzzle game, then think of these enemies as the puzzle (or part of it) to solve before advancing to the next level.
  2. The relationship between game objects; enemies to the player, environment, the UI, and the story if there is one
  3. How it run itself as an AI, a non-playable character (NPC)
  4. How to properly balance its variative range of parameters for the difficulties to offer
  5. How to test, test, and test it whether it's fun/interesting/challenging enough or not

That is truly a lot of work.

From my point of view, assuming this is an adventure game, I would first:

  1. Profile the enemy traits to tell/limit its unique set of interactions that will differ from one another.
    Where is it from? is it fat? thin? invisible? is it an orc? human? cyborg? animals? ships? pile of blocks? How many arms does it have? 2? 4? none? can it walk? fly? swim? lurk? is it riding something? is it a guard? is it a leader? a follower? has a weapon? multiple weapons? bare hands? telephatic? fast? slow? instant? shoot one/two/three/360 bullets? passive/aggressive/submissive/annoying?
  2. Determine the enemy relationships with anything; the player, level, environment, UI, system, anything, to make it even more specific and less predictable
    Is it on its lair? is it on top of a floor that boosts/weaken its power? what would it do if it's 10 blocks away from the a certain target? is the moonlight changes the enemy behavior or itself? what happen if the enemy is behind the player? what happen if the door in front of it is opened? What if a group of enemies in certain location are defeated within 10 seconds? Would defeating a certain enemy enrages another enemies? Does opening a treasure chest make the enemy appear behind the player? What if the player hit the enemy 10 times with the same move? Is it attached to a wall? Does it delete your save game when you can't beat it in 10 seconds(pwease don't)? Does the bomb explodes when a certain enemy stands near it?
  3. Limit the behaviors/capabilities based on a certain range of parameters. This should abstract the interactions by numbers or flags and help tuning the difficulties
    How fast/slow should it attack? How many enemies should spawn? What set of moves it can use? How effective is floor of fire when goofy enemies cross that floor? Would they become passive or aggressive? Always on alert or always idle or a little bit of both?

The main point is make and test the enemy as fun and as interesting as possible, filled with element of surprises, as much effort as you want the game to happen.

Edit: Oops, didn't check this being moved to programming, so I guess my reply is not really that relevant now.

xrbtrx said:
Edit: Oops, didn't check this being moved to programming, so I guess my reply is not really that relevant now.

No, you're fine. Your answer may be design-oriented, but you offered the OP a lot of helpful ideas for where to start. OP asked about programming but did need design ideas to work from.

-- Tom Sloper -- sloperama.com

@Tom Sloper Yea I should have said design. I was originally typing this in the programming forum but changed it to design because thats really what it is. Unfortunately I left the word “programming” and “coding” in my question which probably confused things. As I said, I can program just about anything I can think of… I just have a problem thinking of interesting enemies.

@LorenzoGatti Thanks I totally agree with this. I'm not trying to invent ground breaking new things here, I just want the enemies to be interesting (which means each one is quite different from the others, just just minor things like slightly different speeds), and most importantly I want them to be very challenging. My game is heavy on choosing the right upgrades, so I need the enemies to be pretty difficult otherwise the player won't care about the upgrades.

@xrbtrx Thanks this is quite helpful!
I think you've even gone much further than I need to. I'm not going to worry about my enemy being from a planet with high gravity therefore it should have strong thick legs. I don't have the artistic ability to convey that anyway. But you gave me some inspiration so thanks.

This topic is closed to new replies.

Advertisement