ID:153515
 
In this thread, I'd like to discuss the various methods of handling the movements and actions of mobiles in a roguelike atmosphere.

A lot of roguelikes usually process their monsters' AI in a fairly simple fashion: Move and control the actions of all mobiles on the player's screen, or just outside of the screen. This obviously cuts back on processing time, but I'm after a better route.

If I'm going to create a roguelike, then I don't want monsters just off the edge of the screen sitting calmly until you come within 10 feet of them. If there's the clashing and clamouring of battle going on in the distance, they need to decide if they are going to see what all of the commotion is about. On the upside, this can lead to some interesting scenerios for the player: dash into the dungeon with a massive Broadsword of Slashing (+3), and you'll wake up every kobold and orc on the level. However, a skilled thief could stealthily slip into the dungeon and backstab enemies without making much sound at all.

I should hope that the second option sounds more appealing than the first, but the issue still remains of speed. If I'm handling the AI of every mob on a fairly large floor, the player is going to (probably) notice the lag between turns.

I'd like to hear some opinions on how you might handle the matter, or any useful advice or input you may have.
Malver wrote:
I'd like to hear some opinions on how you might handle the matter, or any useful advice or input you may have.

Well, I would first start with who can hear the action. This would probably depend on 3 things:

1.) Loudness of the action - stabbing a monster in the back would be quieter than hacking at it with a braodsword, unles the monster screams out...

2.) Distance from action - ohearers(world.view*2) should be more than sufficient an area for the loudest of actions.

3.) Acuteness of hearing - How well can the monsters hear? I'm sure creatures living primarily in dark caves would hear better than ones living in a noisy jungle.

From that list of monsters, I would check a few variables, like hunger, health, and so on to see if the monster even wants to deal with whatever could be making that noise.

[Edit] Some more ideas that I would most likely take into account as far as the monsters go:

Are they awake? - If not, did the noise wake them? And if so, are they cranky when they wake? Ok, so the last one is a bit over the top...

Are they brave enough? - Can't assume all monsters are huge hulging beasts. I would imagine something like slimes or rats would prefer taking on smaller adversarries (unless there is a pack of rats, which is something else to consider: mob mentality versus individualism)

Are they protecting young/valubles/territory? - Just about anything will fight to keep it's young safe. Valubles, like treasure or shineys, could motivate a monster to attck, or take it's bounty deeper in seclusion. And territorial monsters would attck just about anything that comes along.

[/Edit]

From this very select list, I would try first to move the monsters toward the source of the noice, not the source of the player that made the noise. This would give the player a chance to escape, or distract known mosters with a rock, or something.

If the monsters don't find anything interesting in a very short period of time, then they would revert to their previous state. But, if they do find something, they should devour it, and check around a bit longer to make sure nothing else edible is nearby.

A very simple description, I know...

~X
In response to Xooxer
I would add two (Well, one and one add on to No.1) more things to determine if the monster runs in fear, doesn't care or attacks.

1) The type of sound- Scream, Steel clashing, punching, ect. If it sounds like a monster that could whip you is being beaten like a preschooler your going to run.

2) Loudness- If something is extremely loud and an animal is next to it the animal will usually bolt.


This could add a very interesting element to the game. You could learn the mating calls of the local beasties then use it to hunt.
In response to DarkView
These are Great ideas, I'm just marking them so that I can read them again if I happen to be working on AI. :)
I'd like to hear some opinions on how you might handle the matter, or any useful advice or input you may have.

If you haven't already play ZAngband(http://www.zangband.org). It does a lot of simple things to achieve interesting AI.

I highly suggest not getting to complex for two reasons. It's slow and it shouldn't be too hard for the player to figure out the causes for the effects.

It may be cool from a design perspective to have a gigantic list of weighting factors to decide whether or not a monster runs, but a player will get highly annoyed if he expected a monster to run but it didn't for some random factor that wasn't obvious and end up losing a character. If I know a monster will run at 20% health I can add that into my tactics for fighting a monster with more speed than me if I need to make a retreat. You can and should have exceptions for obvious things(ie: skeletons and golems are the type that run) or a monster may be magically enchanted to not be afraid or there is an enemy commander providing morale support. These exceptions to the rule are ok since the player can probably easily figure them out. If a monster doesn't run because the day is the 2nd and he happins to have a half full stomach this will confuse the player and probably annoy him. If you do decide to have a few obscure rules make sure they are highly apparent to the player and either are told directly or made painfully obvoius. There is nothing worse than to do good in a game only to end up losing for no apparent reason.
In response to Xooxer
Xooxer wrote:
2.) Distance from action - ohearers(world.view*2) should be more than sufficient an area for the loudest of actions.

Ah, I get to have more fun with that than you may think! I plan on calculating sounds by tracing a line to each mob in range. Upon hitting walls, the noise's power will be lessened depending on the sound resistance of the material. Therefor mobs are more likely to hear you through a wooden door than a solid rock wall. That brings the interesting concept of echoing sounds off of walls. However, something like that would probably be too processor-intensive.

From that list of monsters, I would check a few variables, like hunger, health, and so on to see if the monster even wants to deal with whatever could be making that noise.

As Theodis mentioned in his post, obscure things like hunger/thirst could confuse and aggrevate the player. Judging health is quite reasonable, though.

Are they awake? - If not, did the noise wake them? And if so, are they cranky when they wake? Ok, so the last one is a bit over the top...

I agree. Most creatures found living deep underground would be cranky, anyway. ;)
In response to Theodis
Theodis wrote:
I highly suggest not getting to complex for two reasons. It's slow and it shouldn't be too hard for the player to figure out the causes for the effects.

I was under the impression that figuring out the cause and effect was half the intented purpose?

It may be cool from a design perspective to have a gigantic list of weighting factors to decide whether or not a monster runs, but a player will get highly annoyed if he expected a monster to run but it didn't for some random factor that wasn't obvious and end up losing a character.

I'm not sure you read Malver's post correctly. In it he asks for ways in which sounds the player makes would affect surrounding monsters, not how your actions in battle would affect them. That's an entirely different kettle of fish.

You can and should have exceptions for obvious things

A wounded creature would most certainly choose not to face an opponent, no matter how insignificant it may sound, while a nurturing mother would most certainly choose to fight even the toughest opponents, if it means protecting her young (Monsters have kids too, you know). How are these not obvious motivating factors?

If your players can't figure out that thier racket just woke up a very hungry beast, and it's a bit upset at you for violating it's territory, and they die, then they are too stupid to have lived in your game in the first place, and rightly deserve to be digested.

If a monster doesn't run because the day is the 2nd and he happins to have a half full stomach this will confuse the player and probably annoy him.

What's confusing is your lack of on-topicness in this post. We aren't talking about battling monsters, we're talking about attracting, or not attracting them in the frst place based on sound. A full monster would not run, he would not attack, either (unless other factors are involved, see above). A hungry monster, though, would almost certainly seek out any availavble meal.

And, by the way, it's spelled happens

~X
In response to Malver
Malver wrote:
Ah, I get to have more fun with that than you may think! I plan on calculating sounds by tracing a line to each mob in range. Upon hitting walls, the noise's power will be lessened depending on the sound resistance of the material. Therefor mobs are more likely to hear you through a wooden door than a solid rock wall. That brings the interesting concept of echoing sounds off of walls. However, something like that would probably be too processor-intensive.

Which is why I didn't bother to list material compositions as one of the factors. Though, it did pass through my mind for a moment. Instead of tracing a path from the source to the monsters in question (which would be damned near every monster in a range, at that point in the processing), Why not get a staright line from source to monster, and add the absorption of each material between the two? It's still a bit excessive, yes, but not so much as tracing paths and calculating angles and material compositions on the fly...

As Theodis mentioned in his post, obscure things like hunger/thirst could confuse and aggrevate the player. Judging health is quite reasonable, though.

I think Theodis' post is a bit unrealistic, at best. What's so confusing about a monster coming after a possible meal if it's hungry? If the player doesn't like it, he shouldn't be arrousing the attentions of hungry monsters.

~X
In response to Theodis
It depends on the type of game. Some games wouldn't benifit from having a complex envionment that you have to learn about, some would.
The thing is that the reasoning behind all this stuff is perfectly logical in retrospect. Even if the logic is just "The aniaml was grumpy so instead of runing away it attacked you".
You've also got to take into account that he probably doesn't want the way the world works to be completely obvious to the player.
Anyway, to sum up, I don't blame god for making such a stupid system when my dog bites me for no obvious reaason.
In response to Xooxer
Xooxer wrote:
Which is why I didn't bother to list material compositions as one of the factors. Though, it did pass through my mind for a moment. Instead of tracing a path from the source to the monsters in question (which would be damned near every monster in a range, at that point in the processing), Why not get a staright line from source to monster, and add the absorption of each material between the two? It's still a bit excessive, yes, but not so much as tracing paths and calculating angles and material compositions on the fly...

In order to add the absorbtion of each material, you would have to trace a line. No angle calculations are needed, though, since those are way too slow. I think we're thinking about the same idea, but phrasing it differently.

As Theodis mentioned in his post, obscure things like hunger/thirst could confuse and aggrevate the player. Judging health is quite reasonable, though.

I think Theodis' post is a bit unrealistic, at best. What's so confusing about a monster coming after a possible meal if it's hungry? If the player doesn't like it, he shouldn't be arrousing the attentions of hungry monsters.

Because the player has no idea if the monster is hungry or not. In fact, I doubt I'll be adding in monster hunger as a factor, since it would be totally unrealistic. You'd have to calculate the hunger of every monster in the game, lest that nasty troll you didn't fight in that dungeon is still alive and at full hunger. If you did somehow calculate hunger for every mob in the game, then they would probably end up all starving or killing eachother!
In response to DarkView
DarkView wrote:
The thing is that the reasoning behind all this stuff is perfectly logical in retrospect. Even if the logic is just "The aniaml was grumpy so instead of runing away it attacked you".

This varies from game to reality. If a dog bites you in real life, you may rationalize that it might of had rabies, or she was protecting her offspring. In a game, neither of this options are probably not even considered, so the player is clueless.

You've also got to take into account that he probably doesn't want the way the world works to be completely obvious to the player.

Like many things, this is good in moderation. If the player knows how everything works, than the game becomes predicable, and is no fun. If nearly everything is mysteriously worked, then the player will probably get confused and quit.
In response to Xooxer
I was under the impression that figuring out the cause and effect was half the intented purpose?

It should only be a small part and making it too complex can just leed to the player unable to figure out what's exactly going on. The challange from the game should come from the correct application of cause and effect.

I'm not sure you read Malver's post correctly. In it he asks for ways in which sounds the player makes would affect surrounding monsters, not how your actions in battle would affect them. That's an entirely different kettle of fish.

That was mainly an example that carried on too long :P. My main point was to check out ZAngband since it serves as a good example on how to handle things like getting the attention of monsters.

A wounded creature would most certainly choose not to face an opponent, no matter how insignificant it may sound, while a nurturing mother would most certainly choose to fight even the toughest opponents, if it means protecting her young (Monsters have kids too, you know). How are these not obvious motivating factors?

If you can make it evident within the game that the mother is protecting her children then it'll be obvious, but if I just see a group of monsters and one isn't running I'm not going to immediatly assume it's a parent unless the game specifically points it out in some way.

If your players can't figure out that thier racket just woke up a very hungry beast, and it's a bit upset at you for violating it's territory, and they die, then they are too stupid to have lived in your game in the first place, and rightly deserve to be digested.

Yeah but then you need to somehow indicate the monster in hungrey. In a rogue-like game you tend to be slaughtering monsters left and right so chances are a player won't read every little description so the hungrey would have to somehow be visually represented and apparent for the player to figure it out.

What's confusing is your lack of on-topicness in this post. We aren't talking about battling monsters, we're talking about attracting, or not attracting them in the frst place based on sound.

You already noted that :P. And it was just an easy example to point out where you don't want to overly complicate things.

A full monster would not run, he would not attack, either (unless other factors are involved, see above). A hungry monster, though, would almost certainly seek out any availavble meal.

This is a rogue-like not a simulation. The rogue-like genre consists mostly of slaughtering everything that moves for experience and better equipment. It's not about being real but clever little AI nuances add to the experience and allow for more tactical decisions. An animal that doesn't attack unless cornered or hungrey may be realistic but isn't going to pose any kind of a challenge and would seem more like something uneccesary for the game.

And, by the way, it's spelled happens
Heh I'll make sure to try and get it right in the future :).
In response to Malver
Like many things, this is good in moderation. If the player knows how everything works, than the game becomes predicable, and is no fun. If nearly everything is mysteriously worked, then the player will probably get confused and quit.

As far as game mechanis go you want them to be predictable so the player can develop tactics for handling the situations set up by the game. The challange of a game should be derived from appling the game mechanics in a creative ways. It's real annoying when something works only part of the time and it's not readily apparent why. But this applies to game mechanics. Level design on the other is good not to have overly predictable as to force the player to come up with new ways to use the game mechanics.
In response to Malver
Malver wrote:

In a game, neither of this options are probably not even considered, so the player is clueless.

Double negatives = bad. Ungh.

Aside from borrowing Lummox JR's trademark sound,
I agree that for a relatively simple game, adding
too much complexity will only confuse the players
and annoy. Yes, having the monsters/animals that realistic
would be nice. However, unless the rest of the world is
as detailed, it will only serve to confuse.
In response to sapphiremagus
sapphiremagus wrote:
However, unless the rest of the world is as detailed, it will only serve to confuse.

I think that's the key point. It will only confuse and annoy the player if they aren't expecting it from the game.
In response to Theodis
Theodis wrote:
As far as game mechanis go you want them to be predictable so the player can develop tactics for handling the situations set up by the game. The challange of a game should be derived from appling the game mechanics in a creative ways. It's real annoying when something works only part of the time and it's not readily apparent why.

Yeah. Like one time, I cast a death spell and it killed the target, and then I cast the death spell on another monster of the same type and it didn't work. Or one time I did 24 damage with an attack, and then the very next swing only did 9. And then the next attack against the same monster missed, which is entirely different!
In response to sapphiremagus
sapphiremagus wrote:
Malver wrote:

In a game, neither of these options are probably not even considered, so the player is clueless.

Double negatives = bad. Ungh.

I didn't say nothin' wrong!
My suggestion would be to not actually have all the mobs on the level actually exist. I am a fan of spawning mobs, but keeping track of their populations. In Maeva, I use special objects to keep track of populations of mobs that are spawned from spawn points. When players come near spawns, they have a random chance of spawning a mob out of them, events such as sounds or accomplishing quest goals (stealing "forbidden gems" and whatnot) will basically make additional checks with higher probabilities of mobs being spawned. I even got so complex as to keep track of what sort of sounds are made to affect what kind of monsters might react to them. Sounds of battle might cause some monsters to run in terror, while others might show up to see whats going on. On the other hand, a chicken clucking might mean food to a hungry animal, but be meaningless for a patrolling band of orcs. Once mobs have left the area where they might be affecting players, they are recycled back into the population object, and are no longer processed.
I'm a proponent of "more variety equals more fun". Having creatures make predictable responses makes the same strategies work over and over again (just like, for example, leading enemy Zerglings into a field of spider mines), which is fun if you like mindless slaughter but not as fun if you prefer games where you must think on your toes.

Having situations where monsters may or may not attack you for hidden reasons is just like real life. Who expected JFK to be shot? It outraged an entire nation, but it's part of history. Random acts of violence are part of the world as we know it.

If you want to reinforce that your game is an escape from reality instead of a different reality, then complexity is certainly a bad thing -- but if you're trying to make a fully-fleshed and voluptuous game world, then complexity and unpredictability are some of the key factors.
In response to Spuzzum
then complexity and unpredictability are some of the key factors.

I wanted to reply to Leftly's post on this thread awhile ago but I haven't had the time for the proper responce and unfortuantly still don't. But without some level of predictability you can't come up with tactics/stratagies that work since by the nature of them you have to have some idea of the outcome that will occur. The game mechanics should be very predictable but the situations you are put into should not be.

Page: 1 2