OKAY OKAY FINE!!! FREE AI!!

Posted By: PrenceOfDarkness

OKAY OKAY FINE!!! FREE AI!! - 12/05/05 08:16

okay okay, I felt really bad for always taking and not giving, however I desided enough is enough and made a crappy contribution just now with some models. After I posted I felt even worse, so I desided to give up some of my old AI code. A while back me and a friend of mine desided to start developing an AI system of our own. BEFOR YOU CONTINUE READ THIS CARFULLY!

This AI isn't for pro-programmers. This is more for people looking for something free. If you can already program your own, then you probably will find this a waste of time (then agian it might be insperation but i highly doubt that). Befor I get a bunch of negative comments let me tell you what the main focus of this AI was.

I was making a game where there was a war going on between 2sides and and the player was on a side and sometimes on neither side. However this was a problem because general AI that 3dgs has is the type that just kills the player. So me and my friend desided to come up with a solution to this problem. I will briefly explain how it works.

Each enemy sends out a scan to everything around it, further more each enemy can detect anything scanning it. When scanned the enemy will simply check it's internal chart to see 1)what side he's on 2)what side is the thing he scanned on 3)and finally if he's an opponent to attack him. That is really the heart of this contribution. Also like i said this is really old, so some of the animations and other things were inspired from AUMs (thanx george) and it works on A6 and it probably works for A5. With out further BS here is the contribution (any comments would be nice )

http://www.savefile.com/files/2435487
Posted By: Mondivirtuali

Re: OKAY OKAY FINE!!! FREE AI!! - 12/05/05 14:03

Can't dl nothing..Ie and Mozzilla can open the page but, if I click the link or try to save the object with the right click , it don't works.
Posted By: Mondivirtuali

Re: OKAY OKAY FINE!!! FREE AI!! - 12/05/05 14:04

Update
works now.
Posted By: Hellcrypt

Re: OKAY OKAY FINE!!! FREE AI!! - 12/05/05 23:15

I could not download it. But I am guessing what you did was place like a var. Example enemys are 1 and good guys are 2. Then scan if it's one or two. Am I close? What I am most interested is how the enemy moves.
Try using a different server maybe?
Posted By: Pappenheimer

Re: OKAY OKAY FINE!!! FREE AI!! - 12/06/05 00:21

Thank you!

I'm always looking for AI codes that are easy to understand and help to build an AI that does different things than only targeting the player.
Posted By: TeutonicDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 12/06/05 03:55


I can't download it!

Can someone else who has it email it to me
contact@teutonicdarkness.com

or post it where it can be downloaded.



Look forward to trying it and hacking away at it....


Thanks,




*** Teutonic Darkness ***
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 12/06/05 04:18

hey guys...

at ellcrypt
well kinda but go ahead and try that and you'll run into a big problem.. I accually had to make all entities scan, and then it detects what my.id skill is. But ya something like that.

at Pappenheimer
ya no problem man, I remember how pissed off I was when I couldn't make entities attack one another only the stupit player lol

at TeutonicDarkness
I'll try sending it to you now
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 12/07/05 06:03

wow I thought I'd have alot more people posting comments
Posted By: Matt_Coles

Re: OKAY OKAY FINE!!! FREE AI!! - 12/07/05 07:35

Very cool, I'll check it out later today thanks PrenceOfDarkness
Posted By: Atlantis

Re: OKAY OKAY FINE!!! FREE AI!! - 12/08/05 00:36

Thank you for sharing, PrenceofDarkness.
Posted By: Mondivirtuali

Re: OKAY OKAY FINE!!! FREE AI!! - 12/08/05 13:55

A very good contribution, thanks!
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 12/09/05 06:48


Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 12/09/05 11:43

oh and btw i finally found my friend's name it's LarryLaffer on this forum, he deserves alot of credit for this also.
Posted By: LarryLaffer

Re: OKAY OKAY FINE!!! FREE AI!! - 12/09/05 13:07

Quote:

But I am guessing what you did was place like a var. Example enemys are 1 and good guys are 2. Then scan if it's one or two. Am I close?





Quote:

well kinda but go ahead and try that and you'll run into a big problem.. I accually had to make all entities scan, and then it detects what my.id skill is. But ya something like that.





The alliance thing works something like this..

At Game start, you define a few teams. For PrenceofDarkness's demo I've defined the teams Player,vCon,Skeleton.

Then you define the initial alliances that members of those teams will have with each other when they are first created. Since we wanted vCons to team up with the Player against the Skeletons the definition was something like that:

PlayerTeam Towards VconTeam-->Ally
PlayerTeam Towards skeletonTeam-->Enemy

VconTeam Towards PlayerTeam-->Ally
VconTeam Towards VconTeam-->Ally //other team members
VconTeam Towards SkeletonTeam-->Enemy

SkeletonTeam Towards PlayerTeam-->Enemy
SkeletonTeam Towards VconTeam-->Enemy
SkeletonTeam Towards SkeletonTeam-->Ally //other team members

Now let's say we create a few models. By defining the .id skill from WED we can define if the model belongs to the Player, Vcon or Skeleton Team. So we make 1 player, 2 vcons and 2 skeletons

When the models are created, the alliance Array which keeps track of all the models in the game, will look something like that:

Code:
 

|Player | vCon A | vCon B | Skeleton A | Skeleton B
---------------------------------------------------------------------------
Player |Undefined Ally Ally Enemy Enemy
vCon A | Ally Ally Ally Enemy Enemy
vCon B | Ally Ally Ally Enemy Enemy
Skeleton A | Enemy Enemy Enemy Ally Ally
Skeleton B | Enemy Enemy Enemy Ally Ally




Now all we need to do is check this array to see if model A is Hostile or not with model B. If Skeleton A spots Vcon B around(scans him or something), he checks the Skeleton A raw and VconB column to find a field saying: 'Enemy'. So he attacks.

The beauty with this system is that alliances can take any form in the future. Since the array keeps track of individuals instead of just noting down their teams, models on the same team may go against each other, individual alliances can be made etc..

for example, the player is initially Allied with all the Guards of a village. But one day he goes loco and kills one of the Guards in plain view of two other really suprised Guards. The Guards turn hostile with the Player and charge on him. Now if the Player manages to kill both of them, although those two indvidual models turned hostile on the Alliance table, the rest of the Guards are still Allies with the player cause they have no idea what happened!

and so on..


That's really old code though.. I'm suprised it came up.. But I guess it still works ok. Prence PMed me to explain some things here about it, so i did... hope someone has fun with it..

Aris
Posted By: Anonymous

Re: OKAY OKAY FINE!!! FREE AI!! - 12/09/05 20:40

That's a great idea! I was looking for something just like this a while ago, and after resigning myself to scripting it, here this comes! I think I will still script it, though, I have a lot of things dissimilar to any other script (I think... because everyone is more seisible at coding than me...). But do you mind if I nick the enemy/friend array idea?
Posted By: LarryLaffer

Re: OKAY OKAY FINE!!! FREE AI!! - 12/10/05 00:01

Hey, it's Prence's contribution now, i just helped out:). But I'm guessing he doesn't mind, that's the point of a user contribution afterall..
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 12/10/05 06:06

@Larry
Thank dude for clearing this up.

@Gorthaur
YA SUSE ITS ALL URS and everyones Infact if you do change anything and it's alot better then mine please show it to me I really was hopinh people would take this and update it and add to it and optimize it and all
Posted By: Anonymous

Re: OKAY OKAY FINE!!! FREE AI!! - 12/10/05 07:23

Sure thing, but it might take me quite a while...
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/28/07 04:54

Hey guys, sorry to bring up this ANCHIENT thread... but I've gotten tons of request for my old AI contribution... sadly I don't have it any more.. my appologizes for that.. however, i'm hoping someone has a long lost copy of it.. I'll PM larry and hope he still has a copy...

hope to hear from someone soon...
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 05/28/07 07:17

i would love to get a great code like this! please repost when you can.
Posted By: Nicolas_B

Re: OKAY OKAY FINE!!! FREE AI!! - 05/28/07 10:16

File not found :'(
Posted By: LarryLaffer

Re: OKAY OKAY FINE!!! FREE AI!! - 05/28/07 13:34

This, is so old...

I might still have it, cause i rarely delete code, but i'll need someone to tell me a filename that i can search through the 300gig of junk. WDL filename, folder filename, anything would do i guess
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/28/07 15:33

i think it has to do with something like... test_cube_ai or something to close to that... try test_ai or test_cube... testing cube should be something like that...

I know the file you created is called is_ai_engine.wdl
i still have you private message larry:
Quote:


PS: Ooops.. Nearly forgot.. Here's the link: http://www.intense-illusions.com/TestCubeAiUpdate.zip




I don't know if that helps... but maybe u still have TestCubeAiUpdate.zip on ur Hard Drive...
Posted By: LarryLaffer

Re: OKAY OKAY FINE!!! FREE AI!! - 05/28/07 17:26

Quote:


I know the file you created is called is_ai_engine.wdl





lol...



And yet, I couldn't find your program. I just use this code a lot.

So although i don't have the complete folder anymore, if you send me your program without my modifications, i can update it once again


sorry I couldn't be of any more help.
Posted By: TeutonicDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/29/07 02:40

I found this file on my hardrive...
I do indeed have it.

I never delete any code.. even the bad stuff


Someone give me a e-mail and I'll be happy
to send it your way...


*** Teutonic Darkness ***
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/29/07 03:41

prenceofdarkness@earthlink.net
Posted By: msl_manni

Re: OKAY OKAY FINE!!! FREE AI!! - 05/29/07 04:25

Please post a link so that everybody can downlod it.
Posted By: aztec

Re: OKAY OKAY FINE!!! FREE AI!! - 05/29/07 08:13

Quote:

Quote:


I know the file you created is called is_ai_engine.wdl





lol...



And yet, I couldn't find your program. I just use this code a lot.

So although i don't have the complete folder anymore, if you send me your program without my modifications, i can update it once again


sorry I couldn't be of any more help.




lol Indeed

Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/29/07 18:11

@msl_manni I'll post a link asap. However I still haven't recieved it yet ...
Posted By: TeutonicDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 01:38

I dont currently have webspace anymore or I would gladly
post it...

someone take it and host this demo and post the link.

I knew it would come in handy someday...



*** Teutonic Darkness ***
Posted By: TeutonicDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 01:39

Quote:

@msl_manni I'll post a link asap. However I still haven't recieved it yet ...





Check your e-mail...
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 02:26

can you send it to me as well? it sounds like a great code.
Posted By: TeutonicDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 03:34

Quote:

can you send it to me as well? it sounds like a great code.




sure whats your e-mail addy?
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 04:05

sent you a pm, thanks.
Posted By: Sharx

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 04:33

Quote:

Befor I get a bunch of negative comments...




This sucks! What the hell, were you floatin in extacy when you posted this. I would finish complaining but I don't feel good, I threw up because your contribution was so sickening. Horrible!

Nah, just playing. Thanks for sharing, it's really not much help to me but I'm sure it is to others. And even if it had been a bad contribution...IT'S FREE, how do you complain?
Posted By: msl_manni

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 05:27

I havent recieved it yet. And my e-mail is msl_manni@hotmail.com, it would be nice if you can send it to my mail.
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 06:01

I haven't recieved it either.. again my email is prenceofdarkness@earthlink.net once I recieve it i'll host it somewhere for everyone to download it... maybe this time i'll put it up in a more perminant place..

@Sharx: I was starting to get a bit pissed off... and then I read the bottom of your post and I started laughing.. that was a good one.. lol really lightned me up.

I hope to get the code to all of you asap...
Posted By: DoC

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 07:44

sends the files to soulreaver2@freenet.de
i will upload it on my space
Posted By: robertbruce

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 13:38

Thanks to TeutonicDarkness who sent me this file.


http://www.internalarts.co.uk/conitec/TestCube.zip

I'm using A6.5 comm and unfortunately got a function error message when running. If anyone gets this to work with this version I'd appreciate a copy. I'm not a programmer but will give it a try.
Posted By: Anonymous

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 14:01

i just added this to the main script.it works fine
function remove()
{
ent_remove(me);
}
Posted By: PrenceOfDarkness

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 15:09

Wow I didn't even know I made it that complex... lots of credit to larry as well
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 15:52

I got downloaded the code, I will test it when I get home, thanks PrenceofDarkness and Larry.
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 21:20

i get an error. how do i fix? non-existent function, wait. i added the remove suggested.
Posted By: Anonymous

Re: OKAY OKAY FINE!!! FREE AI!! - 05/30/07 21:25

@Blink I have posted it before how you fix it.
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 05/31/07 02:59

i know, i came up with an error. i guess i put it in the wrong place.
Posted By: mpdeveloper_B

Re: OKAY OKAY FINE!!! FREE AI!! - 06/01/07 14:07

i want this as well, i'm sending you my email in pm
Posted By: Anonymous

Re: OKAY OKAY FINE!!! FREE AI!! - 06/01/07 14:09

@Manslayer101: you can download the Ai on the 4th page.
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 07/02/07 21:49

did anyone get it to work without the errors? can someone post a fixed code, please?
Posted By: Grafton

Re: OKAY OKAY FINE!!! FREE AI!! - 07/03/07 17:03

The "remove()" function is obsolete, you need to change it to "ent_remove()".

Open sed, do a "find text in files", select the folder you have the files in
and search for "remove", it should find several occurences. click on the first
one and sed will open the file with the occurance at the top, change it
to "ent_remove" by adding "ent_",. do this with all occurances, then save all
the files you modified before closing them. Should run fine then.
Posted By: Blink

Re: OKAY OKAY FINE!!! FREE AI!! - 07/03/07 20:29

Code:
//********start of gravity******\\
function gravity
{
var tempgravar; //used instead of the temp var
vec_set(tempgravar,my.x);
tempgravar.z -= 10000; // calculate a position 4000 quants below the player
// set a trace mode for using the player's hull, and detecting map entities and level surfaces only
trace_mode = ignore_me+ignore_sprites+IGNORE_MODELS+USE_BOX;
result = trace(my.x,tempgravar); // subtract vertical distance to ground

if (result > 5) // in the air?
{
force.x = 0; // no pushing force
force.y = 0;
force.z = -10; // gravity force
move_friction = 0.1; // air friction
}
else // on or near ground
{
force.x = my.speed; // translation force
force.y = 0;
force.z = -1 * result; // ground elasticity
move_friction = 0.7; // ground friction
}
my.ahead_speed = time_step*force.x + max(1-time_step*friction,0)*my.ahead_speed; // calculate ahead speed
my.vertical_speed = time_step*force.z + max(1-time_step*friction,0)*my.vertical_speed; // calculate vertical speed
dist.x = 0; //time_step * my.ahead_speed; // distance ahead
dist.y = 0;
dist.z = time_step * my.vertical_speed; // distance down
move_mode = ignore_passable + glide;
ent_move(dist,nullvector); // move the player
}
//**********end of gravity******\\

function special_damage //used to handle magic attacks and other detected entities
{
if(event_type == event_scan && my.health >0)
{
if(you.id == 10)
{
my.health -= 2.5;
}
}
}

function check_event
{
if(event_type == event_scan && my.health > 0)
{
gravity();
special_damage();

if(you.id < 4 && you.id >0) //detection of anything that is a guardian, sprite or user
{
wait(1);
entity_scanning_me = you; //detects who ever scans the skell

if(closest_scanning_entity == 0) // when there is no closest entity then whoever scans me is closest
{
closest_scanning_entity = entity_scanning_me;
}
you = closest_scanning_entity;

if(vec_dist (my.x, you.x) <= my.detection_range && vec_dist (my.x, you.x) > my.attack_range && you.id < 4 && my.state == waiting_state)
{//when something is detected and all the above conditions are true walk up to the closest entity
my.state = walking_state;

while(my.state == walking_state)
{
var varyoux[3]; // At the end of this the you.x will change. This keeps the current you.x
if(you != 0)
{
varyoux.x = you.x;
varyoux.y = you.y;
varyoux.z = you.z;
}
wait(1);
vec_set(temp, varyoux);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp); //face the enamy
my.tilt = 0;
ent_move(my.speed, nullvector);
ent_animate("walk", my.animation); // play walk frames animation
my.animation += my.speed; // animation forwrd / backward
my.animation %= 100;
if (my.animation > 100)
{
my.animation = 0; // loop animation
}
trace_mode = ignore_me+ignore_sprites+USE_BOX;
result = trace(my.x,you.x); //this trace is used so the skell can't see through walls

if(vec_dist (my.x, varyoux) > my.attack_range)
{
my.state = waiting_state; //my state is no longer walking_state
}
}
}

if(vec_dist (my.x, you.x) < my.detection_range && vec_dist (my.x, you.x) <= my.attack_range && you.id < 4 && my.state != attacking_state)
{//if all the above conditions are true attack the closest entity

my.state = attacking_state;
my.animation = 0;
while (my.state == attacking_state)
{
wait(1);
//attack start-----------------------------------------------------------------
if(you != 0)
{
varyoux.x = you.x;
varyoux.y = you.y;
varyoux.z = you.z;
}
vec_set(temp, you.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;

while (my.animation < 100)
{
wait (1);
ent_vertex(my.weapon_tip, 291); // sword tip vertex coords - get the value in Med
ent_vertex(my.weapon_base, 306); // sword base vertex coords - get the value in Med
trace_mode = ignore_me + ignore_passable;
trace (my.weapon_base, my.weapon_tip); // trace between these sword positions
if (result != 0) // hit something
{
if (you != null)
{
you.health -= 1 * time_step;
}
}
ent_animate("attack", my.animation); // play attack frames animation
my.animation += my.speed; // "attack" animation speed
}

if(my.animation >= 100)
{
// wait (1);
my.animation = 0; // reset "attack" frames
}

wait (6); // slows down the skell and reduces the number of traces per second
//attack end-------------------------------------------------------------------
if(vec_dist (my.x, you.x) > my.attack_range)
{
my.state = waiting_state; //my state is no longer attacking_state
}
}
}
return;
}
}
else
{
my.state == waiting_state;
return;
}
}

action skell
{
my.id = 7;
my.health = 100;
my.speed = 4;
my.transparent = on;
my.alpha = 100;

my.detection_range = 500;
my.attack_range = 55;

my.enable_scan = on;
my.enable_detect = on;

my.enable_impact = on;
my.enable_entity = on;
my.event = check_event;
my.state = waiting_state;

while(my.health > 0)
{
wait (1);
temp.x = 360;
temp.y = 0;
temp.z = my.detection_range;
scan_entity(my.x,temp);

while(my.alpha > 10)
{
wait(1);
my.alpha = my.health;
}

if (my.health <= 0) // the skell is dead
{
my.passable = on; // the corpse can't be hit by the sword from now on
my.enable_scan = on;
my.enable_detect = on;
my.enable_impact = on;
my.enable_entity = on;
my.id = 0;
if(vec_dist (my.x, player.x) < 1000)
{
player.experience += 50;
}

my.animation = 0;
while(my.animation < 90)
{
wait (1);
ent_animate("death", my.animation); // play death frames animation
my.animation += 1; // "death" animation speed
my.alpha -= 2;
}
ent_remove(me);
return;
}
}
}

action corps
{
my.passable = off;
my.frame = 34;
}

action virull
{
my.id = 3;
my.health = 50;
my.detection_range = 750;
my.attack_range = 100;
my.speed = 5;
my.transparent = on;
my.alpha = 100;
my.enable_scan = on; // the skell is sensitive to scanning
my.enable_detect = on;
my.enable_impact = on;
my.enable_entity = on;
my.event = check_event;
my.state = waiting_state;

while(my.health > 0)
{
wait(1);
randomize();
my.alpha = random(100);

var float;
randomize();
float = random(2)+15;

if(my.state == waiting_state)
{
//
wait(1);
my.z += my.speed;

if(my.z < 100)
{
while(float > 0)
{
wait(1);
my.z += my.speed;
float -= 1;
randomize();
my.alpha = random(100);
}
}

if(my.z > 150)
{
while(float > 0)
{
wait(1);
my.z -= my.speed;
float -= 1;
randomize();
my.alpha = random(100);
}
}
}

temp.x = 360;
temp.y = 0;
temp.z = my.attack_range;
scan_entity(my.x,temp);

my.tilt -= you.tilt;
my.pan -= you.pan;

if(you.id == 2)
{
ent_create(virull_mdl,you.x,virull);
you.health = 0;
}

}
while(my.health <= 0)
{
my.passable = on;
my.id = 0;
my.enable_scan = off; // the skell is sensitive to scanning
my.enable_detect = off;
my.enable_impact = off;
my.enable_entity = off;

my.alpha = 50 + random(50);

var tilt_or_pan_death;
tilt_or_pan_death = random(2);

if(tilt_or_pan_death > 1)
{
my.tilt = random(100);
}
else
{
my.pan = random(100);
}

while(my.alpha > 1)
{
my.z -= 2;
wait(1);
my.alpha -= 1;
if(tilt_or_pan_death>1)
{
my.tilt += 20+random(5);
}
else
{
my.pan += 20+random(5);
}
}
my.alpha = 0;
ent_remove(me);
return;
}

}

function create_virull
{
ent_create(virull_mdl,player.x,virull);
}

// on_t = create_virull;


© 2024 lite-C Forums