ID:266235
![]() Oct 4 2001, 3:47 pm
|
|
can someone giveme a code for simple monster AI.
|
Well, FIREking's weapon system is fabled to contain some simple monster AI...
Maybe, take a look at that? |
Pikkon The Great wrote:
can someone giveme a code for simple monster AI. Kinda depends on how simple you want to get. The simplest possible AI will make the monster move one step at a time toward the player, but they'll bump into obstacles if any are in their way. You can make this slightly smarter by including some code to move around obstacles. Deadron's PathFinding library might be good for this, too. To get a little fancier, you could take an artificial life approach and give the monster variables like hunger, fear, etc. that control its behavior. Maybe a monster would be more likely to attack a player when it's hungry, or if it's angry, or if it's backed into a corner and afraid and it can't get away. If it's afraid, it can try to run. If it's with others, it may be less afraid, like a pack hunter. Lummox JR |
To get a little fancier, you could take an artificial life approach and give the monster variables like hunger, fear, etc. that control its behavior. Maybe a monster would be more likely to attack a player when it's hungry, or if it's angry, or if it's backed into a corner and afraid and it can't get away. If it's afraid, it can try to run. If it's with others, it may be less afraid, like a pack hunter. The cool thing about systems like this is that its not necessary write code that makes your AIs smart, you have what is called "emergent behavior," where intelligent-seeming things happen because of simple mechanistic controls. To use your above example, the monsters would tend adopt a "life cycle," where they are seen most by players at certain times--when they're hungry (then they eat, hunger grows back, and they come back tommorow). They'd also tend to group together--without ever being told to--just to decrease fear. Its not quite as simple as I put it, but I'd really like to see a system like this in BYOND, or any MUD/MMORPG for that matter. Their AIs tend to be bad in general. Perhaps I'll have to upgrade my project's AI a bit (currently uses a prioritized task system). -AbyssDragon |
Its not quite as simple as I put it, but I'd really like to see a system like this in BYOND, or any MUD/MMORPG for that matter. Their AIs tend to be bad in general. Perhaps I'll have to upgrade my project's AI a bit (currently uses a prioritized task system). Wouldn't a method like this suck alot of computer power or bandwidth? If every enemy has all it's own continually changing variables, and possibly even personallity? |
Wouldn't a method like this suck alot of computer power or bandwidth? If every enemy has all it's own continually changing variables, and possibly even personallity? Not sure what you mean by "personality".. the point is that personality and such are not inherent properties of the monster, but the way we perceive it. Therefore, the computer knows nothing about personality.. it doesn't have to calculate it at all. (Sorry if I'm getting too abstract here..) Continually changing variables won't suck down bandwidth any (if they belong to a non-client mob, and we can assume they do). It'll only use a lot of CPU cycles if it involves a lot of computations, especially loops. The system would probably have to use a lot of optimizations and tricks to reduce CPU usage (like only activating AIs if there are players around), but most good AIs do this anyway. -AbyssDragon |
Botman wrote:
Wouldn't a method like this suck alot of computer power or bandwidth? If every enemy has all it's own continually changing variables, and possibly even personallity? Actually, such systems can be surprisingly efficient. Complex biochemistry can be simulated with just a few pseudochemicals that regulate mood, and those chemicals may be adjusted by outside factors of the environment. Personality will tend to emerge out of such a system, depending on how well it's designed; the factors in each monster will determine how it behaves. Perhaps some creatures could be skittish, others unlikely to run except from a large foe. The great advantage of this sort of thing is that it allows for flexible responses; an ordinarily tame creature might become desperate and attack if it becomes hungry enough. Computer power used will depend on the number of variables involved. Usually the math can be handled efficiently with some forethought. One simple system, for example, might represent possible decisions as a series of vectors, where each represents weights corresponding to the individual chemical concentrations. (This is similar to a tiny neural network, but learning is optional; the vectors can be pre-set.) The weighted result with the highest value could then be taken as the decision for what to do next. For most creatures it makes sense to limit this to maybe 5 or 6 behavioral pseudochemicals, but complex creatures could use even more. The burden on the system would depend on the overall complexity of the creatures in the world, and their number. Lummox JR |
AbyssDragon wrote:
Wouldn't a method like this suck alot of computer power or bandwidth? If every enemy has all it's own continually changing variables, and possibly even personallity? I was refurring to the fact that you(?) said some would be scared etc. I assume you mean they are generally cowardly, not just scared at the time. Obviously this would be depicted through variables. |
Heh, that's funny. My animal system is based on ecosystem. One animal eats another, some eat plants (There are tons of plants in the rain forrest) and, at the top of the food chain are the Big Cats, Humans, and other large animals. Though, many animals have things like camoflauge, poison, etc to drive things that would eat it away. I also made a Dragon that eats everything and lives forever, but has little appatite. It's favorite food is Human.
LoW <small><small>Disclaimer: there are NO DRAGONS IN THE RAINFORREST. I added dragons ONLY FOR FLAVOR WITHIN MY GAME, AND A BIT OF FOLKLORE. Thank you.</small></small> |
Lord of Water wrote:
Disclaimer: there are NO DRAGONS IN THE RAINFORREST How can you be so certain? ;) |
Shadowdarke wrote:
Lord of Water wrote: Yes, I'm fairly certain that the last time I visited B.C.'s coastal rainforest, I saw a dragon. My parents didn't believe me, but I stand by my decision. Of course, I was 5 years old, with a very avid imagination. (Consequently, I also seem to recall seeing a half-man, half-skeleton person on a motorcycle who asked me if I wanted any candy. The worst part is that I recall that encounter in vivid detail, with me running back down to my house screaming and my parents calling the police... but I don't actually remember what exactly he looked like (I assume now that the "skeleton" was a tattoo). Yes, I'm being completely serious here.) |
I've been working on an AI system titled "Extreme AI". It takes a lot of things into account... player's intimidation, intelligence, smell, everything.
It's Extreme, and not for just anyone to mess with! |
Vortezz wrote:
I've been working on an AI system titled "Extreme AI". It takes a lot of things into account... player's intimidation, intelligence, smell, everything. Ooo! A stench rating! Do players get smell input to? if(get_dist(src, target) < (target.stench + src.nose_sensitivity + WindMod(get_dir(src,target),wind.dir))) src << "You smell the overwhelming stench of [target]." |
mob/Monster
icon='Monster.dmi'
Click()
usr<<"The monster says Hi"
Thats simple monster AI =P..