Enemy Spawning Algorithms

watermark

Veteran
Veteran
Joined
Dec 25, 2012
Messages
600
Reaction score
522
First Language
English
Primarily Uses
RMMV
What do you think are some good ways to spawn enemies so the game is fun?
For now, let's ignore how it can actually be coded in RM and just focus on the mechanic.
Here's some I thought of as well as their pros and cons.

1. Fixed : Chrono Trigger (I think) and DnD makes it so you encounter the same enemies in the same locations.
PRO: Carefully crafted enemy order creates an even experience for everyone, allowing players to "feel smart" eventhough it's the result of the order made by a skillful dungeon master. Also easier on subsequent playthroughs as players know who and what to use.
CON: May get boring on replays.

2. Random troops based on regions: What default RM does
PRO: Comfort food that most of us are used to in traditional RPGs.
CON: Could get tired of this.

3. Totally Random : Rogue-like, randomly generated games.
PRO: Great replay value. Exciting as you never know what you're gonna get.
CON: Sometimes the computer generates unbalanced, nonsensical, or boring combinations.

4. Based on Player stats/level : Stronger monsters get generated if player has higher level. Some games simply raise the stats while more sophisticated ones even add new abilities to the same monsters.
PRO: Good for open world games that allow you to do quests in any order without sacrificing balance.
CON: Could get repetitive as you're always fighting the same monsters for that level. Also can't enjoy going back to a starter area and kicking ass for fun.

5. Based on Player Current Condition: Different enemies could be spawned based on say if Player is low on HP, if a certain amount of time has passed since that last "exciting" moment, if Player got a new widget, etc.
PRO: Could be very fun and exciting. Keeps players on edge.
CON: May be hard to get the balance right.

So, what do you guys think?
 
Last edited:

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,081
Reaction score
1,038
First Language
Spanish
Primarily Uses
RMVXA
4. Based on Player stats/level : Stronger monsters get generated if player has higher level. Some games simply raise the stats while more sophisticated ones even add new abilities to the same monsters.
PRO: Good for open world games that allow you to do quests in any order without sacrificing balance.
CON: Could get repetitive as you're always fighting the same monsters for that level. Also can't enjoy going back to a starter area and kicking ass for fun.

5. Based on Player Current Condition: Different enemies could be spawned based on say if Player is low on HP, if a certain amount of time has passed since that last "exciting" moment, if Player got a new widget, etc.
PRO: Could be very fun and exciting. Keeps players on edge.
CON: May be hard to the get the balance right.
*expression of pain*
that's ..... no.... just.... no
that has to be the laziest, lamest, most unimaginative approach.
"make the enemies always stronger than the player... doesn't matter if the player is already weak, the enemies will always be not-weak-enough"
that effectively renders player development irrelevant!
because, "oh guess what: it doesn't matter how much you think about your build, the enemies will always be better than you."

I always graphic that with *the Need For Speed story*:
In NFS:Undercover there's street racers, cops, and the player. The player can upgrade and customize their car to some extent. The cops progressively field out faster cars as the player becomes more aggressive. If the player doesn't raise their bounty, the cops stay put.
I was riding a Lotus Elise with medium upgrades, and I got into a pursuit down the highway. The cops send the special units, Porsche 911 with top gear upgrade, to chase me down. I avoided them, and managed to trade my Elise for a 911, capable of 300km/h with tail wind, same as the cops had.
Sure enough, I get into a pursuit again, the cops send the 911s, and I have a party of a dozen police cars, all makes and models, chasing me.
I spend a good ten minutes driving around the highway which is a good 10km long, big open circle, avoiding obstacles and sideswipes. The cops, ALWAYS behind me, always on my heels, always busting their engines trying to catch me, non stop.
On one turn, I didn't see the road, I go straight into a police blockade, right over the spikes, bust my 4 tires, and slow down to walking pace.
The good dozen of police vehicles behind me, that had been at that point chasing me down the highway at 300km/h relentlessly for 10 minutes non-stop,........ ALSO slow down to a crawl.
And for 5 minutes more, I keep running, on my rims, skidding down the highway, at walking pace, and the cops STILL behind me, STILL on my heels, STILL "boosting" their cars to try and overtake me, with cars without a scratch on them, capable of more than 300km/h, that had put up with me, for 10 minutes, matching my every move.

....so, what's the point of being able to race at 300km/h with a police car against a busted car that's barely making 50, if you ain't gonna overtake it in a split second, surround it and stop it dead?
you see how *running* becomes irrelevant..... in *the racing game*.
NOBODY EVER CONSIDERED THE SCENARIO WHERE A PLAYER WOULD SIMPLY NOT LOSE CONTROL OF THEIR CAR WHEN BUSTING THEIR TIRES!
hell, nobody ever coded the scenario so that busting the tires meant stopping the car altogether, by default!
that has to be the laziest design I've ever seen.

3. Totally Random : Rogue-like, randomly generated games.
PRO: Great replay value. Exciting as you never know what you're gonna get.
CON: Sometimes the computer generates unbalanced, nonsensical, or boring combinations.
nnnnnghhh....
that's what Rimworld does, and some people find it challenging, in an appealing way.
granted, it can get nonsensical, like an overwhelming invasion of rabid rats that'll stop at nothing until they've bitten everyone's toes off.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,386
Reaction score
580
First Language
Italian
Primarily Uses
RMVXA
3. Totally Random : Rogue-like, randomly generated games.
PRO: Great replay value. Exciting as you never know what you're gonna get.
CON: Sometimes the computer generates unbalanced, nonsensical, or boring combinations.
Well, in this case if the algorithm is decent you never see unbalanced combinations, after all you are the one writing the algorithm, you can decide what is "balanced" and only generate balanced encounters.

4. Based on Player stats/level : Stronger monsters get generated if player has higher level. Some games simply raise the stats while more sophisticated ones even add new abilities to the same monsters.
PRO: Good for open world games that allow you to do quests in any order without sacrificing balance.
CON: Could get repetitive as you're always fighting the same monsters for that level. Also can't enjoy going back to a starter area and kicking ass for fun.
Here I think that you are missing the most important disadvantage: increasing stats becomes a hindrance. The same weapon/item gets proportionally weaker as the player grows, which is not simply boring, but also a hindrance. Why would I level up just to increase my stats when the same item gives me +20% stats boost if they are high and +300% if they are low and enemies stats grow with mine?

If you compare my strength to that of enemies the result is that leveling up leads to this:

player -> 120%, enemies -> 100%
player/enemies -> 1.2

If you use the same item without leveling up it leads to something like this:
player -> 400%, enemies -> 100%
player/enemies -> 4.0

You can clearly see when the player is stronger, which is the main disadvantage, far worse than being unable to go back to the starting area to kill enemies easily for fun, you are basically rewarding the player for skipping unnecessary fights. Why having fights at all then?
 

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
1,693
Reaction score
554
First Language
Dutch
Primarily Uses
RMMV
I like zelda types of battle or from megaman starforce/radiant historia.
but the zelda types can be done nicely in some ways.

you can skip those (if not using battles) but with levels, you can kill them to level,
but no exp if yo ubypass their levels.

killing used for specific parts (to open doors, hidden entrances, quests etc)

more freely to kill or not, can drop specific items not geting anywhere else
(this is what I try to do though).

but I wont let them skip killing entirely because some are required if you want
to compleet the game 100%.

but every kind of battle have their pro's and con's, but its also what the player
like and dont like. So balancing all the pro's and con's to make it perfect
is also very impossible to do.
 

Black Pagan

Veteran
Veteran
Joined
Feb 21, 2017
Messages
212
Reaction score
116
First Language
English
Primarily Uses
RMMV
Personally, I like :

6. Enemies mean Serious Business : Enemy encounters are extremely hard but pretty rare and spawn every once in a while, Making every Encounter a meaningful one and gets harder with a fixed time period, Regardless of Player Progression. This kind of Spawn Rate is best used in Challenging Survival Games, Where its not about Player having a Guaranteed chance to win every Fight, Its about letting the Player be prepared to face any odds and sometimes ending up being overwhelmed.

The Player can encounter Multiple enemies of a Higher rank at the beginning of the game, Making it very unfair, Its just a roll of the die. This is to convey the feeling of "Helplessness" to the Player, Which is a part of the idea to make the Player realize that they can be defeated if they are not prepared enough or just simply unlucky.

Every Encounter will seem like "A Level Up event" by itself, Which determines whether the Player survives or not. Because of the Difficulty of Enemies, Which in most cases are on same rank as Player or Higher rank. However, to give the player a slight advantage, There can be "warning signals" before these enemies spawn like a "Change in weather", "Arrival of Night-time", "Feeling of being watched", "Howling noises" etc and of course, A Mechanic for the Player to win against the enemies, Whether its Dodge, Flee, Use Special Item etc but these mechanics will be extremely limited to the point that Player has to choose one or the other.
 
Last edited:

LostFonDrive

Veteran
Veteran
Joined
Feb 13, 2015
Messages
161
Reaction score
43
First Language
English
Primarily Uses
I don't like enemy level scaling with the player. It diminishes the feeling of empowerment from leveling up and getting better gear etc., which is one of the more satisfying aspects of RPGs for me.
 

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
369
Reaction score
1,276
First Language
Bahasa
Primarily Uses
RMMV
I prefer fixed, but with variation mechanic. Mean the place spawn enemies at fixed place with different variant and condition. Say I have 4 variant on this map. At day, at night, at day after kill boss, at night after kill boss. Or it could be randomize each day, whatever the variant can be. The point is :
- Player can SEE the enemy and know that they are limited.
- Player can try to actively learn the variant of that map.
- Player may try to avoid battle or CLEAR the map.

I think Monster Hunter is a good example for the spawning mechanic. You know this monster usually stay at area X, but sometimes it's not there.
 

watermark

Veteran
Veteran
Joined
Dec 25, 2012
Messages
600
Reaction score
522
First Language
English
Primarily Uses
RMMV
Personally, I like :

6. Enemies mean Serious Business : Enemy encounters are extremely hard but pretty rare and spawn every once in a while, Making every Encounter a meaningful one and gets harder with a fixed time period, Regardless of Player Progression. This kind of Spawn Rate is best used in Challenging Survival Games, Where its not about Player having a Guaranteed chance to win every Fight, Its about letting the Player be prepared to face any odds and sometimes ending up being overwhelmed.
You're right. You just reminded me of the game "Kingdom", which I couldn't put down till I beat it. For those who haven't played, that game uses a number of days system which steadily increases the difficulty of the enemies each day regardless of what the Player does. The Player's only chance is to fulfill the winning conditions before the enemy waves become literally impossible to beat. I think it's like before day 40 or something. That combined with autosave and permadeath, created the perfect addictive "Just one more try" mentality.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,062
Reaction score
5,690
First Language
Indonesian
Primarily Uses
RMVXA
Hey now, deciding on how the enemy spawn should depend on what is your game goal/purpose. Because that decides what is fun and/or actually support the game goal. In my opinion, based on your list, here're the possible cases that you probably want a specific enemy spawning mechanism.

1. Fixed : Chrono Trigger (I think) and DnD makes it so you encounter the same enemies in the same locations.
You want the game to be easy to learn. The fixed encounter will serve this better. You go here, you get these enemies, you learn. You have a target audience who prefers to play a short game and move on. Replayability is not the goal of the game. For various reasons (e.g, telling a fixed story).

2. Random troops based on regions: What default RM does
Technically, this is the same as the first one. It just based on the map region. Why would you want this? this serves better when grinding a certain enemy becomes important. Or hunting. Because having a mapped region serves that purpose. For example, when you want to catch a certain monster. Of course, you go to the fixed region.

3. Totally Random: Rogue-like, randomly generated games.
This is for replayability as you have been written. For the cons part of the game, this is not for some people who couldn't deal with randomness. Granted, the unbalanced generation probably has something to do with the generation procedure. However, people who prefer a more balanced encounter probably better to play other games than this. It just for a different audience.

4. Based on Player stats/level : Stronger monsters get generated if player has higher level. Some games simply raise the stats while more sophisticated ones even add new abilities to the same monsters.
As you have stated, this suit best for open-world games in which the order of the quest is not in exact order. I don't think any type of encounter would be better because you would be locked in a certain area and you need to level up IF the game goal is to allow you to travel anywhere unrestricted.

However, I would argue that the cons are not about fighting the same enemy level all over again. But the fact that if you explore dungeon A in level 10 and you replayed the game to explore the dungeon at level 40, you get a different encounter, which in my opinion, it is immersion-breaking. Is it bad? probably yes. But it is something I find tolerable.

5. Based on Player Current Condition: Different enemies could be spawned based on say if Player is low on HP, if a certain amount of time has passed since that last "exciting" moment, if Player got a new widget, etc.
I would actually argue that if you do this, certainly because you want to balance the game. If you get an anti-air weapon, the airborne enemy will start to spawn (spawn enemy based on the player condition). Because when you don't, you can not fight them. If this is combined with open-world games, it is kind of immersion-breaking because "I would just never trigger this so those enemies will never start to spawn".

However, if you change "based on the player's condition" (gameplay) to "based on the environment" that will probably serve better if you want to add the roleplay aspect. A certain enemy will spawn at night. Will you risk yourself to travel at night? your choice. Is it fun? Probably to some people, probably not for some.
 

Milennin

"With a bang and a boom!"
Veteran
Joined
Feb 7, 2013
Messages
2,270
Reaction score
1,372
First Language
English
Primarily Uses
RMMV
I go for semi-fixed encounters. The same visible encounter always hangs around the same spot on the map, but tagging it will roll through a small number of possible encounters of around equal power level.
So replaying the same area will likely give you a few different encounters in enemy composition and types, but power level-wise, encounters in the same place will be the same on every playthrough.
Across an entire area or dungeon, encounters in the earlier parts will be easier (weaker types and lower enemy counts), and progressively be made harder as the player makes it closer to the end of that area.

I'm fine with fixed, because it's unlikely I will replay a game. I guess only avoid if your game revolves around replayability, otherwise it will be good.

Random is okay, but only because it is RPG Maker default. It's not exciting to see, but I can live with it.

Totally random: no. It's a lazy excuse for making a game "difficult".

Based on player progress: no. That defeats the point of playing an RPG. The point is to get levels and gear to become stronger. If monsters grow with your party's power level, that sense of growth gets taken away from them.

Based on player condition: This could be pretty much interesting, but difficult to get just right. I'd say it's a worth a try for anyone willing to go through the effort to balance it in such a way it enhances the player experience.
 

Wavelength

Edge of Eternity
Global Mod
Joined
Jul 22, 2014
Messages
4,927
Reaction score
4,115
First Language
English
Primarily Uses
RMVXA
I feel like this topic is conflating two major and entirely different mechanics, which are:
1) How encounters are spawned/placed as you travel a map (for action games like Doom or Bayonetta, this might also include how difficult these encounters are)
2) How enemies are put together into troops and how troops are selected (for games with a separate combat screen, like most RPGs)

There are other, more minor mechanics that are also conflated into the topic, such as the randomized geography and scenario generation in many roguelikes!

Therefore it's awfully hard to advise on which approaches work and when. Sometimes one very specific part of an approach can work for a certain game, while the larger approach would be misplaced. For example, maybe it would be cool for your next Encounter to be against a bunch of plant enemies if you just opened a chest and got a fire sword (and equipped it) - but that probably shouldn't affect when you hit your next Encounter.

===

I do want to make a defense of Case #4 ("Based on player stats/level") since a few posters such as @gstv87 took a sledgehammer to it :D - I think this approach can be healthy for some types of games where the scale, rather than the physical scope, increases as you play - examples include Recettear, Azure Dreams, and to some extent Katamari Damacy and Persona 3 (which used a single Tartarus rather than multiple dungeons). You also see a similar effect in most business sims (Tycoon games, Theme Park, etc.).

In games like that, by scaling which encounters the player may face (rather than scaling enemy stats) based on the player's stats or overall power level, you are essentially simulating what more traditional RPGs offer when they give you new dungeons with new enemies to fight as you move throughout the game (and get stronger). The player is still being rewarded for getting powerful, because the high EXP given by tough foes lets the player grow even more powerful (in relation to, say, fixed boss encounters), plus they get better loot.

If you do it well, you can ensure that players are always faced with a worthy challenge to keep things interesting. (If you do it poorly, the battles are still boring except now they are punishing the player for winning them, as you guys have pointed out.)

I've been playing around with a system for my remake of How Badly (a cyclical game with a structure similar to Recettear) where when you touch a Visible Encounter, I assign the current battle party a "power rating" based on each member's total stats, and randomly add monsters (that belong in the given geographical region) to the troop. Each monster has a "power rating" of their own, and once the power of the troop is similar to the power of the party, I stop adding monsters and initiate the combat. High-power monsters won't start appearing until your party reaches a certain rating of their own (this allows the player to keep finding new enemies and new tactics throughout the game).

I've found this creates some really fun, challenging, and varied single encounters. Sometimes I wind up with one or two really powerful enemies threatening big hits and I need to figure out how to disable them; sometimes I wind up with dozens of weaklings looking to chip away at me and I need to figure out how to use my limited AoEs to thin the herd. I will need to test it in the context of a full dungeon and a larger game around it, but I believe it's going to work well because (a) the penalty for defeat in combat is not a Game Over, but rather the loss of one in-game day, and (b) the player has a fixed amount of game-days to earn loot, so presenting tougher enemies that drop better loot is an opportunity rather than a punishment.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Stream will be live shortly with some pixel art! Feel free to drop by!

Can't believe I forgot to put an image of my drawing pad! It looks kinda like this, maybe I'll get a better pic tomorrow...
Backup tip: If you don't want to back up your whole project every day, at least back up everything *except* your Image and Audio folders, which you can do weekly/as needed/etc.
The final version of our game is already available both in English and Spanish! ^___^
Can't believe this day has finally come... T_T
Im so happy that Dead By Daylight is getting a Silent Hill chapter! Cant wait to play as pyramid head

Forum statistics

Threads
97,819
Messages
947,167
Members
129,036
Latest member
TidorMasuto
Top