AI for NPCs

Started by Julien, August 17, 2005, 09:57:02 AM

Hi,

I am curious to know how NPCs AI is typically handled by the code.  Is everything scripted ? With a scripting language or in a compiled language ?
Are some NPCs goal-driven and actually try to do some things on their own ?

And, on a related topic, can the source code be freely downloaded from somewhere ?

Julien

The source code is DIKU, which can be downloaded and used according to the license. However, Armageddon's using DIKU only as a "source" - in the literal sense of the word, and has added so much code, and in fact added so much scripting stuff, that it is only a "derivitive" and not an actual base DIKU mud.

As for NPCs - they're bots. IMMs can animate them and in some cases, players can animate them (such as a templar animating his NPC soldier-guard). But NPCs aren't played by anyone, unless someone with the authority/coded ability chooses to (such as an IMM or templar with several other examples not necessary to mention here).

Quote from: "Julien"Hi,

I am curious to know how NPCs AI is typically handled by the code.  Is everything scripted ? With a scripting language or in a compiled language ?
Are some NPCs goal-driven and actually try to do some things on their own ?

And, on a related topic, can the source code be freely downloaded from somewhere ?

Julien
Small note: I'm written this based on my general knowledge of muds and could be completely incorrect as far as Arm is concerned.

I don't think Arm has special AI as far as the ordinary commoner and rat mobiles are concerned.  There are generic actions that humanoid NPCs might do (such as picking up 'sids if they see any) and things that only wild beasts might do like approach a room and attack their prey.  All ordinary mobiles will fight back when attacked and things such as that.

Some creatures has common behaviors, and these things are determined by 'Acts' - a creature could have acts 'sentient carnivore wimpy' which would make it come into a room to attack a character whenever it got close, but flee the room if someone came into the room where the mobile was.  They're generally very simple patterns, designed to fit as many mobs as possible.

Beyond this there are scripts; again they're rarely (if ever) complex enough in order to be called actual AI.  Mostly it would be a script allowing the NPC to buy or sell special objects, or cast spells on demand, or unlock  doors for characters in clans.

Some NPCs are definitely goal-driven and will do things on their own; however, these things take place behind the scenes more often than not.

To touch up on what Bestatte said - staff members are able to 'switch' into a mobile, which makes it a player-controlled NPC.  Various players are also able to give orders to their subordinate NPCs, but it's not truly an animation since the player's control over the NPC is significantly lesser than a staff member's.

And finally, Arm's source code is thankfully not available - there is a vast amount of secrets in this game and finding them in-game is much better than stumbling on them in their naked coded forms.
Quote from: Vesperas...You have to ask yourself... do you love your PC more than you love its contribution to the game?

Re:  Source Availability -- No, the source code of ArmageddonMUD is not currently available for download, and you probably don't want it.  There are other code-bases built from much cleaner foundations and which have matured in a much more carefully planned/architected manner than Arm's.  We do have some interesting technology, but it is difficult to find, and even more difficult to use seperately from the rest.  The core is simple C code, using flat-files for all of the game/world/player data.  No database, yet.

We do have a scripting system.  In fact, we actually have several -- from my readings of the code, it looks as though the first stab at coded "specials" was actually built as part of the engine -- that is, in C.  The next stab was an assembly-like scripting language called DMPL (Dan's MUD Programming Language?), and the most recent and most successful stab was JavaScript, using the Spidermonkey engine provided by Mozilla.org.  This last one has been the most successful, as it provides an interface to the game engine that is very flexible and "safe" for less experienced programmers.  More and more, recent efforts have been directed toward moving game-content related code into JS -- Raesanos' automated apartment system is wholly implemented in JS, for example.

Currently, though, very few NPCs have scripted AI in this sense.  There is low-level AI hand-coded into the engine for the various magicker types, similarly low-level AI for city-militias, and then the usual Diku-style "aggressive, wimpy, etc." AIs.  Some critters DO have more interesting high-level AI, and you'll probably know them when you see them (though it is possible you may assume they're being run by staffers).  Halaster implemented a goal-driven "ecosystem"-style AI for one of the game's large regions using the JS bindings, and it is most definitely a goal-driven simulation (am I hungry?  I should kill and eat something.  Am I tired?  I should go home and rest.   There's even breeding; though I don't think you can actually -see- the inixes mate ;)  And so on...)  The labyrinth also has some several "tricks" courtesy of Zagren, and you may find some presents from Dyrinis spinning their webs across the desert.  (Truly, some of these things are more smoke-and-mirrors than sophisticated simulations.  I'm a big fan of smoke-and-mirrors, myself...  it eats less CPU.)

-- Xygax

Thanks for the information. Still on that topic, do you know a MUD that has 'emergent AI' for complex NPCs. I am thinking about humans wandering in a town, buying food when hungry, getting money to buy the food (by working or mugging people ) etc...
I don't think it would be necessarily a great thing to have in a MUD because you never know when your AI will start to do strange things and that could be embarrasing :-) However, I would be interested to study a code who does that sort of things.
Who knows, my next character for Arm may be a biologist doing field stufy on the behaviour of wild desert animals (before being eaten by then in all probability !)  ;-)

Julien

I'm not familiar with any free (as in beer, OR as in liberty) MUD source-base that does stuff like that.  UO had AI kinda like that (guards would gravitate toward people with pastries, for example - a cops/doughnuts joke), but a lot of it was later disabled as yielding (as you suggest) inappropriate results and being exceptionally CPU-intensive.

-- X

QuoteStill on that topic, do you know a MUD that has 'emergent AI' for complex NPCs.

Yes.  When we're done testing, you'll know.

8)
Yes. Read the thread if you want, or skip to page 7 and be dismissive.
-Reiloth

Words I repeat every time I start a post:
Quote from: Rathustra on June 23, 2016, 03:29:08 PM
Stop being shitty to each other.

Here is a really interesting site on AI for NPCs http://www.virtualworldlets.net/Resources/Menu.php?Category=34
quote="Morgenes"]
Quote from: "The Philosopher Jagger"You can't always get what you want.
[/quote]