Author Topic: Monster generation  (Read 48282 times)

AgingMinotaur

  • Rogueliker
  • ***
  • Posts: 805
  • Karma: +2/-0
  • Original Discriminating Buffalo Man
    • View Profile
    • Land of Strangers
Re: Monster generation
« Reply #30 on: January 24, 2014, 09:11:22 AM »
In my old game Squirm, I assigned a weight/frequency to monsters and other random content (items, room themes, etc). Whenever the game needed to pick some content, it would assign temporary weights to each possible choice – based on danger level, frequency and "tags" (enabling specialized selections, like: pick between all items except weapons, and double the probability of items tagged "magic").

This was easy to implement, and worked well enough, but I did run into a problem of "weight inflation": As the number of items to pick became greater, each item became slightly less frequent. For instance, I might add a new magic thimble (Squirm's equivalent to rings) and assign a danger level and frequency that made it show up at a reasonable rate. After a few months of adding more thimbles and stuff, that particular item might practically stop to appear. This was especially a problem for "necessary" items, such as healing implements, as well as the "cool and powerful" stuff, which should be rare enough to feel special, but not so rare that only the developer knows they exist.

I may have missed some nifty tricks to avoid this problem, and I'm pondering how I should do it for my current thing. Probably, I'll want to try out a "draw bag" method to cap how many times an identical choice can be made.

As always,
Minotauros
This matir, as laborintus, Dedalus hous, hath many halkes and hurnes ... wyndynges and wrynkelynges.

Quendus

  • Rogueliker
  • ***
  • Posts: 447
  • Karma: +0/-0
  • $@ \in \{1,W\} \times \{1,H\}$
    • View Profile
    • Klein Roguelikes
Re: Monster generation
« Reply #31 on: January 24, 2014, 09:55:27 AM »
For some things it doesn't matter if you don't see one for the whole game. In that case there's nothing to worry about. For things that are important you can attach a native depth that makes them common and almost guaranteed to appear in an area the player is guaranteed to pass through. If they need ro be common throughout then you can just bump up their overall weight or the spawn rate for everything, or add a shop that can sell things that might not show up in the dungeon. You can also increase the number of levels. If you've got all this content that you think improves the game, and you think it's too rare, but you don't want to upset the balance by making levels denser, then that's a reasonable solution.

That said, if the spawn rate for items gets too high you might start finding there's too much junk on the floor, and that can really be a hassle for players, especially if you have an ID syatem.

naughty

  • Rogueliker
  • ***
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: Monster generation
« Reply #32 on: January 24, 2014, 12:24:43 PM »
So I had some special requirements for this, because it was being used for my game MicRogue....

@jasonpickering: So your monsters array gives you relative probabilities and you have the chance to upgrade one monster per-level to a special monster. I'd guess you have a few other constraints you want to apply:
  • The total number of monsters per-level. Could be a specific value or a min and max range.
  • You want to enforce some kind of variety. For example by saying "I want at least three types of monster on this level".

If you were to put it in Excel I'd guess it might look like this (I made up the numbers for Total and Min. Species):

Level |Slime |Large Fire |Skeleton Warrior |Demon |Eye |Ninja |Cockatrice |Total |Num. Special |Min. Species
1
3
1
0
0
1
0
0
4
1
2
2
3
1
0
0
1
0
0
4
1
2
3
3
2
1
1
1
0
0
4
1
2
4
2
2
1
1
2
1
0
5
1
3
5
2
2
1
1
2
1
1
5
1
3
6
1
3
2
1
2
1
1
5
1
3
7
1
3
2
2
2
1
1
6
1
3
8
1
3
2
2
2
2
2
6
1
4
9
1
3
2
2
2
2
2
6
1
4
10
1
3
3
2
2
2
2
7
1
4

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Re: Monster generation
« Reply #33 on: January 25, 2014, 02:21:05 AM »
that's the gist of it. Although each monster has a 10% chance of being a special monster (which is just an upgraded version of the regular monster.  I might increase that chance with the depth. (10 + Depth * 2) so harder monsters show up more. As for the total number of monsters is just 4 + depth/4. so every 4 floors more monsters are spawned. That table is pretty accurate though.

Pickledtezcat

  • Rogueliker
  • ***
  • Posts: 62
  • Karma: +0/-0
    • View Profile
    • Pickledtezcat Game Development Blog
Re: Monster generation
« Reply #34 on: January 29, 2014, 08:33:48 AM »
Have you thought of having a cost for each enemy/weapon/item and matching it against a current potential value of the player?

Then you could choose random monsters and loot while reducing a pool of points for that location.

So for example room 23 has just been opened by the player, at the moment the player has skills and equipment worth 567 points.

We randomly select some monsters getting the following:
A green slime (120 points)
A skeleton (100 points)
A skeleton (100 points)
A skeleton archer (150 points)
and a giant rat (50 points)

At this point only 47 points remain, and as a giant rat is the cheapest enemy available to this level we stop adding more monsters.

The 47 points are deducted from any loot the player picks up from the encounter to keep things balanced.

You could also include modifiers, like if the player is a cleric, skeletons points value is halved, or if he doesn't have a ranged weapon green slime points value is increased by 15%
This gives a very balanced and fair game.
A blog about my 3d Roguelike: http://pickleddevblog.blogspot.kr/

Trystan

  • Rogueliker
  • ***
  • Posts: 164
  • Karma: +0/-0
    • View Profile
    • my blog
Re: Monster generation
« Reply #35 on: January 29, 2014, 05:51:50 PM »
I like the pool of points idea Pickledtezcat. Do you have a game or prototype that uses this idea?

Danakh

  • Newcomer
  • Posts: 34
  • Karma: +0/-0
    • View Profile
    • Ratz 'N' Godz
    • Email
Re: Monster generation
« Reply #36 on: January 29, 2014, 07:46:28 PM »
My method for 1Quest (to be announced soon ;) ) I have something similar as the pool, but instead of points, I used experience values for monsters :
- First I have a list of available monsters for the environment
- Then depending on the depth, i have a total XP value, a min and a max XP value per monster

For example, if you are in the swamp, the monster list is Gnoll (10 xp), Gnoll Shaman (20), Rat (5), Snake (20), Dryad(50), Troll (100), Fairy (50) etc ...
Then for a depth 3 swamp, I will take monster between 20 and 50 xp value, for a total of 500 xp

This way I have thematic monsters, adapted to the difficulty, with a fixed total XP so I can control the hero evolution travelling through a depth 3 place

Paul Jeffries

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 257
  • Karma: +1/-0
    • View Profile
    • Vitruality.com
Re: Monster generation
« Reply #37 on: January 29, 2014, 10:53:41 PM »
Have you thought of having a cost for each enemy/weapon/item and matching it against a current potential value of the player?

Then you could choose random monsters and loot while reducing a pool of points for that location.

So for example room 23 has just been opened by the player, at the moment the player has skills and equipment worth 567 points.

We randomly select some monsters getting the following:
A green slime (120 points)
A skeleton (100 points)
A skeleton (100 points)
A skeleton archer (150 points)
and a giant rat (50 points)

At this point only 47 points remain, and as a giant rat is the cheapest enemy available to this level we stop adding more monsters.

The 47 points are deducted from any loot the player picks up from the encounter to keep things balanced.

You could also include modifiers, like if the player is a cleric, skeletons points value is halved, or if he doesn't have a ranged weapon green slime points value is increased by 15%
This gives a very balanced and fair game.

I like the pool of points idea Pickledtezcat. Do you have a game or prototype that uses this idea?

I used something a little like this for my 7DRL last year, although I worked it slightly differently in that I had a pool of points for each level and kept picking monsters off the list and subtracting their points cost from the pool until that number went <=0.  For selecting monster 'reinforcements' I gradually added to that pool each turn and when it reached a certain value randomly added a monster and took its points cost from the pool.  The more expensive the monster, the longer the cooldown period until the next monster turned up.  This worked quite well and was easy to tune in a hurry, which is what you want for a 7DRL!

Quendus

  • Rogueliker
  • ***
  • Posts: 447
  • Karma: +0/-0
  • $@ \in \{1,W\} \times \{1,H\}$
    • View Profile
    • Klein Roguelikes
Re: Monster generation
« Reply #38 on: January 30, 2014, 05:20:40 AM »
My method for 1Quest (to be announced soon ;) ) I have something similar as the pool, but instead of points, I used experience values for monsters :
- First I have a list of available monsters for the environment
- Then depending on the depth, i have a total XP value, a min and a max XP value per monster

For example, if you are in the swamp, the monster list is Gnoll (10 xp), Gnoll Shaman (20), Rat (5), Snake (20), Dryad(50), Troll (100), Fairy (50) etc ...
Then for a depth 3 swamp, I will take monster between 20 and 50 xp value, for a total of 500 xp

This way I have thematic monsters, adapted to the difficulty, with a fixed total XP so I can control the hero evolution travelling through a depth 3 place
I wouldn't call it controlling player progression unless clearing the whole level is compulsory...

Danakh

  • Newcomer
  • Posts: 34
  • Karma: +0/-0
    • View Profile
    • Ratz 'N' Godz
    • Email
Re: Monster generation
« Reply #39 on: January 30, 2014, 05:50:40 AM »
At least, i know how much xp he can have. An yes, it will be more difficult in the later levels if the hero skip too much monsters. But each class should have only a couple of really difficults monsters (well ... game isn't finished yet ^^)

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Re: Monster generation
« Reply #40 on: February 01, 2014, 04:50:37 AM »
the whole XP thing sounds very similar to the CR value system I was using before based off of Pathfinder games (Might be in original D&D).

so here is a question the tangentially relates. How do you guys usually go about finding what squares to place your monsters on. Right now I just fill them up randomly, but does anyone use monster placement rules?

Pickledtezcat

  • Rogueliker
  • ***
  • Posts: 62
  • Karma: +0/-0
    • View Profile
    • Pickledtezcat Game Development Blog
Re: Monster generation
« Reply #41 on: February 01, 2014, 07:58:49 AM »
the whole XP thing sounds very similar to the CR value system I was using before based off of Pathfinder games (Might be in original D&D).

so here is a question the tangentially relates. How do you guys usually go about finding what squares to place your monsters on. Right now I just fill them up randomly, but does anyone use monster placement rules?

Well, if you use room_ids in your level designer (give each tile that is part of a room a unique numbered tag so you can see which parts of a map are in a particular room) you can have the monsters placed in themed groups in a room. You could use arrays to store potential formations (everyone standing around a table looking at a map, people sleeping on mats etc..) as well as props. The arrays can be mirrored or rotated (in python I use reverse or zip functions) to provide variation and you can select randomly from a dictionary of arrays. You can easily check the room is big enough to hold the formation and if not (perhaps a pillar is already placed where the table is supposed to go) you can select another formation. You could also include an extra index in the dictionary to indicate size and then only select those that can fit before randomly choosing an entry.



Please keep in mind the above is just a sketch, I use a spreadsheet editor for mocking up dictionaries or ideas, keeping notes about possible function calls or stats. I haven't run it to check the result so you'd have to do your own testing.

With this kind of method you could have spiders (a monster) and cocooned prey (a prop), or a book case and scattered books (all props) or a barracks with beds, chests and sleeping guards and lookouts. Further refining the random monster function, you could use a wild card such as False or None instead of xp amount to use XP from the spawn pool I mentioned above. Or you could add an extra argument to the function such as monster type, which only adds monsters with that type to the random generation pool. A typical type would be "furry" which would generate giant rats, wererats, werewolves, cave bears and such, or "insect" which could generate all kinds of bugs, or "human" or whatever. The more tags you have, the more you can control the spawns and create more narrative for your game, but the more chance of getting an empty list.

For instance you spawn a monster formation on level one which includes a random monster call for a "demon". The xp pool is just 100 xp, but the lowest level "demon" monster is 5000xp. That's going to result in no monsters being spawned unless you have a fall back, like:

else:
       monster("giant_rat", "crazed")

In which case the player is going to be so busy dealing with a berserk Giant rat they may not notice the "pentagram" and "sacrificial_altar" props in the room.
« Last Edit: February 01, 2014, 09:12:05 AM by Pickledtezcat »
A blog about my 3d Roguelike: http://pickleddevblog.blogspot.kr/

jasonpickering

  • Rogueliker
  • ***
  • Posts: 274
  • Karma: +0/-0
    • View Profile
    • Email
Re: Monster generation
« Reply #42 on: February 06, 2014, 03:05:50 AM »
well I really only have the single room. so its all about the layout in that room. Although I do load the level from a XML file. I guess I could place Several monster spawn areas around the room, and then the game can just pick which ones to spawn the monsters at. that might be an easier way.

I am also looking back into the equation idea after looking at my monster amounts. I have nice bell curves in the monster amounts reaching peak at certain points then gradual taper off, so I think I can derive an equation from that, but just make sure that the equations is always starting at 0, but after peak never getting below 1.

Z

  • Rogueliker
  • ***
  • Posts: 905
  • Karma: +0/-0
    • View Profile
    • Z's Roguelike Stuff
Re: Monster generation
« Reply #43 on: February 06, 2014, 10:34:03 PM »
Have you thought of having a cost for each enemy/weapon/item and matching it against a current potential value of the player?

IVAN has a system where monsters which are allowed to appear depend on the player's HP and equipment. This has counter-intuitive effects. Like, items which increase HP are considered worthless, because they cause stronger monsters to appear. Or, when going to a new level, it might be better to stash the best equipment and have temporary buffs off. This way, strong monsters won't be attracted. Overall, it is not clear whether you should make your character stronger, or not. I recommend against using such kind of systems.

Quote
You could also include modifiers, like if the player is a cleric, skeletons points value is halved, or if he doesn't have a ranged weapon green slime points value is increased by 15%
This gives a very balanced and fair game.

Again, in such a design it is not clear what is good for you and what is bad. Clerics have a some special power which helps against skeletons, but on the other hand, they face more monsters. You might consciously decide that you do not want to bring a ranged weapon, because you want less green slimes, or less monsters in the rooms containing the green slimes. And as the total number of points depends on your character, you learn to develop the character in a way which makes them strong, but the game does not see it.

IMO such a design is cheating, and the player will cheat you too.

Pickledtezcat

  • Rogueliker
  • ***
  • Posts: 62
  • Karma: +0/-0
    • View Profile
    • Pickledtezcat Game Development Blog
Re: Monster generation
« Reply #44 on: February 08, 2014, 01:30:50 PM »
Have you thought of having a cost for each enemy/weapon/item and matching it against a current potential value of the player?

IVAN has a system where monsters which are allowed to appear depend on the player's HP and equipment. This has counter-intuitive effects. Like, items which increase HP are considered worthless, because they cause stronger monsters to appear. Or, when going to a new level, it might be better to stash the best equipment and have temporary buffs off. This way, strong monsters won't be attracted. Overall, it is not clear whether you should make your character stronger, or not. I recommend against using such kind of systems.

Quote
You could also include modifiers, like if the player is a cleric, skeletons points value is halved, or if he doesn't have a ranged weapon green slime points value is increased by 15%
This gives a very balanced and fair game.

Again, in such a design it is not clear what is good for you and what is bad. Clerics have a some special power which helps against skeletons, but on the other hand, they face more monsters. You might consciously decide that you do not want to bring a ranged weapon, because you want less green slimes, or less monsters in the rooms containing the green slimes. And as the total number of points depends on your character, you learn to develop the character in a way which makes them strong, but the game does not see it.

IMO such a design is cheating, and the player will cheat you too.

I understand your reservations about such a system, and you have made me think more carefully about using it, but I think The system is sound as I described it.
When I used to DM paper and pencil RPGs in highschool I used to balance the encounters against my players, if they had a weak combination of party members or a couple of poor character builds I'd substitute some of the monsters in the module. I didn't want them to get killed too easily, but I would make it challenging and sometimes they did all end up getting slaughtered even with the substitutions because of making poor tactical choices. I'd do other things to make the game more survivable too, such as including more healing potions if the party (which would some times change from week to week as the club membership shifted) didn't have a healer, or less traps if they didn't have a thief.

When I've played RPG games on computer I've found myself almost always playing a cleric just because, they have a fairly good set of combat abilities, they can heal themselves and allies, they can summon creatures and they can buff themselves. Most games become a walkover in such a case. If I chose to play as a bard or a gnome illusionist it's going to be much much harder, probably impossible unless I play on an easier difficulty setting. This is a problem because I actually don't really like playing a cleric, I actually want to play a thief and sneak my way through the game, but it's rare to find a game that will adapt to my playing style.

I think an auto-tuning game system gives you more freedom to play the game anyway you want to instead of being forced to play only the "right" way.

Such a system could leave itself open to being "gamed" but as I showed above (but didn't thoroughly explain), it's important to have a mixed system. Although most encounters will be balanced to the player's abilities (generating monsters from a pool of XP), there will be some which have a set value. You could strip off all your armor and weapons and descend in to the dungeon in just your loin cloth expecting to fight only pixies and gnomes, but that rare encounter where you face a set of monsters pitched at what "should be" your value at that part of the game if you are playing as expected will soon wish you didn't leave your armor behind.

Besides, an item that gives more HP is always useful right? No matter what enemies you're facing, it's better to have 10 HP than 2HPs. Being stronger is always going to be better than being weaker, as usually some enemies will have special abilities which let them hit above their points value in certain situations. For example spiders have poison, giant rats have disease. You may be facing less of them because you are not a cleric, but still once bite can be enough to really ruin your day. If you haven't got a ranged weapon then that one rust monster (instead of two because of the XP modifier) is still going to be chomping on your fine plate mail if he scores a hit. Problems could arise if you set the XP modifiers too high, effectively pricing certain monsters out of the bell curve, but that's part of the design process and something that needs to be gotten right for the game to be any fun.

Every game becomes an arms race between the player who is trying to beat the DM's tactics and the DM, who is trying to beat the player's tactics. As a game designer you have to think ahead to find ways to confound the player without just throwing random stuff at them.

As a games designer I could cheat and use the system to single out a player's weaknesses so that I could kill them off easily, but then who's going to want to play my game then? It's important to get the balance just right so the game is challenging to every player but not impossible.
A blog about my 3d Roguelike: http://pickleddevblog.blogspot.kr/