Author Topic: Scripted AI - And AI In General  (Read 1816 times)

Kozuka

  • Wayfarer
  • *
  • Posts: 2
    • View Profile
Scripted AI - And AI In General
« on: November 30, 2004, 10:39:18 am »
If this has been posted before I apologize, I know how much you guys rag on about using the search button.. The basic consept of what I am trying to get across is the abillity for AI to work together and to setup scripted tactics-based events like the abillity to setup an ambush or use stratagy against it\'s player opponets. Now I know the first person who comes here is going to post \"that eats up to much system resources\" or something to that affect but may I remind you that \"anything is possible with an open mind\" the developers here have the unique oportunity to create something unique. But aside from that what I am asking is feezibly possible with good code and scripting remember that this doesn\'t have to apply for every mob in the game only certain ones.

Let me make a few examples of what I am asking so everyone understands.

1. Let\'s say a team of orc\'s (example) consisting of a team of 2 archers 3 mages and 5 warriors the warriors move the the front to hold the line the mages heal the orcs and buff the archers to deal in the damage.

2. A path with a hill on each side with a tree line on both sides and a gate on one end, infact in setting up an ambush the orcs hide in the trees on each side wait for the player to come into a possition where they can surround him and *bang* he didn\'t know what hit him.

If your wondering why I didn\'t use the search function I have been having a problem with the forums with it not letting me view topics and even not letting me use the search function it\'s weird if anyone can help me it would be a great help, I am using firefox and I am on a gentoo linux..

Anyways thanks for listening..
Peace
Kozuka

Moogie

  • Forum Legend
  • *
  • Posts: 4551
  • Artist/Flash Animator
    • View Profile
(No subject)
« Reply #1 on: November 30, 2004, 05:49:59 pm »
Hiya Kozuka. :) It\'s not really a matter of \"it\'ll take too much system resources\", but this is some heavy code you\'re talking about. For it to become a reality, the main thing the developers need is someone willing (and able) to write it.

The idea is good, and would certainly make the world seem a whole lot more \'alive\'. Caravans and travellers would need to hire guards (whether NPC or PC) incase they get ambushed on the road. It\'s also good for roleplay. :)

I\'m not sure if it\'s been posted before, but we forgive you. ;) About your problems... hmm, I use Firefox aswell, and sometimes the only page I can ever load is the main forum index. After that, it gives up. I sometimes have to close and reload Firefox several times before it will actually load any of the pages I try... and I\'ve even resorted to using Internet Explorer to reach my destination at times... *shudders*

Under the moon

  • Forum Addict
  • *
  • Posts: 2335
  • Writer extraordinaire.
    • View Profile
(No subject)
« Reply #2 on: December 01, 2004, 01:29:19 am »
Why have an AI script for situations like this at all.  If it was up to me, I would have a RI (real intelligence) behind sneek attacks, ambushes, and organized assults.  An idea has been suggested in other threads that players should be able to log on temporarily as a Mob.  I like the idea of player controlled creatures. I also think that evil PCs should be able to take control of and give orders to certain Mob groups such as bandits or semi-intelligent pack creatures, maybe for a fee.
This would add a different aspect to the game.  Is that group of One Eyed Flying Purple Kran Eaters normal AI or is some devious mind at work :evil:?

Zorium

  • Hydlaa Citizen
  • *
  • Posts: 224
    • View Profile
(No subject)
« Reply #3 on: December 01, 2004, 03:28:12 am »
Quote
Why have an AI script for situations like this at all. If it was up to me, I would have a RI (real intelligence) behind sneek attacks, ambushes, and organized assults. An idea has been suggested in other threads that players should be able to log on temporarily as a Mob. I like the idea of player controlled creatures. I also think that evil PCs should be able to take control of and give orders to certain Mob groups such as bandits or semi-intelligent pack creatures, maybe for a fee.
This would add a different aspect to the game. Is that group of One Eyed Flying Purple Kran Eaters normal AI or is some devious mind at work ?


Thats not going to happen, the devs have said that there will be no more player races (unless Talad changes mind of course) than those listed on the main page.  Also this just screams to be abused (bribing a mob anyone?).

Kozuka: Although I like the idea of NPC\'s seeming real it would require huge amounts of AI coding (actually and AI team would be needed), of course if your volunteering :P

-Zorium
I reserve the right to be wrong.

Kozuka

  • Wayfarer
  • *
  • Posts: 2
    • View Profile
(No subject)
« Reply #4 on: December 01, 2004, 06:22:26 am »
Quote

Thats not going to happen, the devs have said that there will be no more player races (unless Talad changes mind of course) than those listed on the main page.  Also this just screams to be abused (bribing a mob anyone?).

Kozuka: Although I like the idea of NPC\'s seeming real it would require huge amounts of AI coding (actually and AI team would be needed), of course if your volunteering :P

-Zorium



I would actaly love to help, but what I am asking involves actaly knowing a programming language, this I am sorry to say I lack. I have read many books (or at least tried), in my fault of wanting to teach myself everything I possibly can and everytime I fail for some reason.

#include iostream.h

int main()
{
int responce;

  std::cout>>\"Yeah you know I own!\\n\";
  std::cout>>\"1=Yes 2=No\\n\";
  std::cout>>\"Your Responce: \";
  std::cin<< responce;
  if ( responce==1) {
     std::cout>>\"Damn Strait\\n\";
}
  if ( responce==2 ) {
     std::cout>>\"Well Screw You Two\\n\";
}

return 0;
}

Happy Compiling

Peace
Kozuka
« Last Edit: December 01, 2004, 06:33:26 am by Kozuka »

Under the moon

  • Forum Addict
  • *
  • Posts: 2335
  • Writer extraordinaire.
    • View Profile
(No subject)
« Reply #5 on: December 01, 2004, 10:41:55 am »
Zorium, read my sig.

Besides, there would be no \'new\' races.  You would simply step into the \'body\' of an existing random mob.  No chat, no stats, no exp. Just a sorry attempt at killing a player.

And what is wrong with bribing mobs? ?(

Zorium

  • Hydlaa Citizen
  • *
  • Posts: 224
    • View Profile
(No subject)
« Reply #6 on: December 02, 2004, 05:13:33 am »
Quote
Zorium, read my sig.

Besides, there would be no \'new\' races. You would simply step into the \'body\' of an existing random mob. No chat, no stats, no exp. Just a sorry attempt at killing a player.

And what is wrong with bribing mobs?


In regards to your sig.  Things are actually written in stone, just visit Egypt, Greece and Italy and look at all the old ruins (or alternatively go to your local museum).  By the way stone can take a very long time to erode.

With your idea people could just remain a mob permanantly essentially making mobs player races which is not exactly what you had in mind but it will happen (just look at n00b killers in RPG\'s and teamkillers in FPS\'s).

The problem with bribing (now sentient mobs) is that it may not actually be appropriate for that mob, imagine a creature thats too stupid to figure out which end of a sword to hold being paid off by the next rich character to walk past it.

-Zorium
I reserve the right to be wrong.

Under the moon

  • Forum Addict
  • *
  • Posts: 2335
  • Writer extraordinaire.
    • View Profile
(No subject)
« Reply #7 on: December 02, 2004, 07:23:26 am »
I do believe I said \"certain Mob groups such as bandits or semi-intelligent pack creatures\", not \"a creature thats too stupid to figure out which end of a sword to hold\"

Not all \'bad guys\' are out to kill you.  Most just want your money. So what is wrong with giving up a few tria to avoid a fight that you either don\'t want to waste your time on or know you can\'t win?  However, this would not work if the creature is simply hungry or cranky.

Besides, my original post was not about bribes.  It was about an evil aligned player hiring a group of mobs that has a legitimate reason to want money.  The player could then set up ambushes or attacks in the immediate vicinity.  The player himself would not be allowed to combat.  This would make it impossible to attack newcomers with high level creatures.  If(and this is a big if, see #5 below) the creatures win, some of the loot could go to the hirer.

As for remaining a mob permanently, I don\'t think this would happen for several reasons.

1. Mobs would be confined to their original spawning area.

2. Random spawning would make it extremely unlikely that players could form PKing mob groups.

3. Mobs don\'t get exp., items, money, or weapons from a kill.  In other words, they get nothing to show for it.

4. Mobs are static entities.  They cannot evolve or advance like the PC races.  This would make it very boring to play for a very long time, but interesting in the short run.

5. How long do you actually think a PC mob would last?  I mean, come on, they are designed to be killed.:)

Aerig

  • Hydlaa Resident
  • *
  • Posts: 76
    • View Profile
(No subject)
« Reply #8 on: December 03, 2004, 06:31:33 am »
Some AI is not that hard to implement.

For example, the orc situation where they hide behind a bush etc can be simply created by having the orc spawn there with a general directive to remain there until a PC comes within LoS / distance of them.

That type of AI, ie the type that basically involves certain types of functionality can be created easily enough and a library of AI simulative functions built up which the devs can then attach to different mobs.

The more complex idea, where an orc warrior decides to protect the mages and the mages decides to hide behind the warrior is not that much different.

Each mob will inevitably have charactersitics. In a broadish sort of context, some of those characteristics will inevitably relate to how the mob reacts to events around it.

But, importantly, the mob needs to be aware of context, or its behaviour will seem very cardboard and unrealistic as would seem the case if you saw a bunch of orcs walking around randomly in circles without any particular interaction.

So you take that basic idea and, at a crude level, you say that, okay, some of the time the orcs are going to interact and some of the time they are going to saunter about ....

That leadds to the basic idea if a random action table. At a roll of n% or lower, the orc will go over to its compatriot and seem to be talking, arguing or even fighting with it.

Each time an orc gets into some sort of interaction, it is then in a different context, ie the context of that type of interaction and a separate table for that action context can then be referred to to decide what the probabilities are that the orc will undertake some sort of action whilst in that context.

Even five basic context maps for any mob would make its behaviour incomparably more realistic.

But lets get back to the idea of the orc warrior leading the fight ...

An orc scout spots a PC and it gets into \'threat spotted\' context
In that context it has a 75% possibility of alerting any other orcs nearby and a 25% probability of attacking.
It alerts two warriors and a mage and then hits into the 25% probability that leads to attack, thus entering the attack context.
The other orcs have similar, not necessarily identical patterns for what happens when they are in \'threat spotted\' context (which they will be as soon as they are alerted by the scout)
The warriors have a 90% chance of attacking straight off with the result that they are highly likely to lead an attack
The mages on the other hand have a lower likelihood of attacking straight off, their highest probability being to move cautiously toward the target and stop to cast a spell as soon as they are within range.
The combination of the warrior and mage probabilities results in the appearance of intelligence simply because the warrior moves ahead at reasonable speed and the mage moves forward cautiously.
The scout has probably run into bow range and is firing arrows.

So its not that difficult to create the appearance of good AI, you just need to define the various contexts that a mobs behaviour can fall into and then map what the probability of different types of behaviour will be in each context.

Processing power can be conserved by not having mobs continuously cycle through their behaviour options except when PC\'s are within a certain reasonable distance from them.

ie you dont activate the mobs if noone is in the town but you might allow the mobs to get higher frequency chance to change behaviour as PC\'s get closer toward them.


Sorry if that explanation is not that clear but I hope it gets the general idea across.

Toadhead

  • Hydlaa Citizen
  • *
  • Posts: 249
    • View Profile
(No subject)
« Reply #9 on: December 03, 2004, 01:14:16 pm »
Quote
#include iostream.h

int main()
{
int responce;

std::cout>>\"Yeah you know I own!\\n\";
std::cout>>\"1=Yes 2=No\\n\";
std::cout>>\"Your Responce: \";
std::cin<< responce;
if ( responce==1) {
std::cout>>\"Damn Strait\\n\";
}
if ( responce==2 ) {
std::cout>>\"Well Screw You Two\\n\";
}

return 0;
}
 



#include
using namespace std;


int main(int argc, char** argv)
{
int response;

cout << \"Yeah you know I own!\" << endl;


cout << \"1: Say he doesn\'t\" << endl;
cout << \"2: Say he does\" << endl;

cin >> response;

if ( response == 1)
{
cout << \"Damn Strait\" << endl;
}

else if ( response == 2 )
{
cout << \"Well Screw You Two\" << endl;
}

else
{
cout << \"Error: Wrong input\" << endl;
exit(1);
}

system(\"pause\");
return 0;
}
« Last Edit: December 03, 2004, 01:18:29 pm by Toadhead »

sashok

  • Hydlaa Citizen
  • *
  • Posts: 448
    • View Profile
(No subject)
« Reply #10 on: December 03, 2004, 04:02:23 pm »
I don\'t know the current structure of AI, but if they have global functions that would permit these kinds of behaviors, then maybe it\'s possible.

 The bush situation, it could simply be programmed that when a hostile for ex. orc npc that has ability to track, sight, etc. sees a player or group of players coming (by seeing I mean simple distance from npc towards orc)  so then the code looks for nearby bush or tree where an orc stands, then orc runs to and waits until the group or player come closer, then runs out of tree or bush and attacks.  Now this would be cool, but however limited to smart hostile npc.  

Now, this could be global function that any smart npc that have abilities like track or sight or ambush. etc. could use.  Even this code could be assigned to multiple hostile npcs, but bigger bush would have to be around.  There\'s no need for tons of code for this...

Let\'s look at other situation:
2 archers 3 mages 5 warriors.  simple ai would consist of few functions for group dynamics.  npc walks around in a group all scattered, npc spots a player, npc begins to group (depending on their lvl of intelligence how good their formation is).  Formation itself I believe is not that difficult to program .  You have your group that is divided into subgroups of # of classes.  Then tank classes sent in front, archers middle, mages (support)  in the back.  There\'s no need to form lines, but basically it could be programmed so that mages heal warriors, while archers shoot n stuff.
Another cool feature would be if depending on the total group intelligence  for example (warriors = 10 archers = 20, mages = 50)  80 in total intelligence of group would enchance group function.  Group functions would be healing, how fast they react, if they run away when they get scared (some pc ability for ex.)  or scatter when they see one of theirs fall.

tygerwilde

  • Hydlaa Notable
  • *
  • Posts: 739
    • View Profile
(No subject)
« Reply #11 on: December 03, 2004, 05:55:44 pm »
wouldn\'t neccessarily have to be controlled by AI either, that\'s what ingame DMs are for, someone with tools to place mobs in strategic places, give them \"cover\" and aggro them at the right moment, all they would need would be some competent DMs and simple tools that could be used quickly and easily

with good tools, a dm could set up instances of just about any kind of event. towns could be attacked, unique quests could be given to PCs, rewards could be given (out of pre defined items and money)
« Last Edit: December 03, 2004, 05:58:37 pm by tygerwilde »
we are the music-makers, we are the dreamers of dreams - Gene Wilder as willy wonka

Johnny Depp\'s a poser to the throne. No one will ever play the part as well as Gene Wilder

Merdarion

  • Hydlaa Notable
  • *
  • Posts: 547
    • View Profile
(No subject)
« Reply #12 on: December 03, 2004, 06:52:34 pm »
There should also be some kind of percentage being here. So 50% of the time the mob\'s there, the rest of the time he sets up a camp somewhere nearby.
I want to be a flame, to crumble to ash, but never ever burnt.

I want to rise higher, rise up to the heavens, but sink, just sink down deeper and deeper into nothing,

I want to be an angel, a chosen, a devil, but I am just a creature that ever wants what it wont get.


tygerwilde

  • Hydlaa Notable
  • *
  • Posts: 739
    • View Profile
(No subject)
« Reply #13 on: December 03, 2004, 07:47:49 pm »
in a perfect game, there would be no static spawns... *wishes*

an end to camping forever
we are the music-makers, we are the dreamers of dreams - Gene Wilder as willy wonka

Johnny Depp\'s a poser to the throne. No one will ever play the part as well as Gene Wilder

Meketh

  • Traveller
  • *
  • Posts: 42
    • View Profile
(No subject)
« Reply #14 on: December 11, 2004, 03:16:00 pm »
Basically what \"Sashok\" said goes into the right direction.

If there is interest for a more elaborate workout of a rule set I could do this.

In \"turn-based\" strategy games AI often follows the line of assigning \"Values\" to a map overlay (basically you could assign wood, plain or whatever type of terrain there is different values concerning cover, defence value, movement and so on). By overlaying such a \"terrain map\" onto the actual textures it`s not that hard to work out some of the above mentioned scenarios.

Furthermore npc`s can/should have their own stats (probabilities) for things like attacking out of cover, ambushing, using certain formation tactics, supporting classes, fleeing combat, general awareness, threat assessment and such.

I would be willing to contribute a working concept of such a system if needed. Just let me know.
Dante
"The Blitzer“s Guild"