Advanced AI for FPS with A4 templates

Posted By: Anonymous

Advanced AI for FPS with A4 templates - 07/05/01 05:13

The goal of this topic is to create a much better AI for A4 with the help of the templates.
And I'm not just going to ask for some code, because I'm having a good start yet and I hope other guys will help me to make an even better AI. At first I shall tell you guys what you have to change to fix the bugs in the newest A4 war.wdl:

- In state_attack, change
"MY._COUNTER = 16 + RANDOM(32);" in
"MY._COUNTER = -8 + RANDOM(-16);"
and change
"while(MY._COUNTER > 0) { wait(1); }" in
"while(MY._COUNTER < 0) { wait(1); }"
- In attack_approach change
"while((MY._STATE == _STATE_ATTACK) && (MY._COUNTER > 0))" in
"while((MY._STATE == _STATE_ATTACK) && (MY._COUNTER < 0))" and change
"MY._TARGET_PAN = MY_ANGLE.PAN - 15 + RANDOM(30);" in
"MY._TARGET_PAN = MY_ANGLE.PAN;" and change
"MY._COUNTER -= TIME;" in
"MY._COUNTER += TIME;"
- Put "my._counter = 0;" in state_hunt, before the while loop

Jokester999 said there were more bugs, I hope he wants to tell us which and how we can solve them.

Next time I will tell you about my advanced state_hunt.

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/05/01 05:20

i believe in that advanced AI depends on good path finding. if your chars moves smarter, this means they behave smarter.
now, i am working on a special path routine in templates .but u know how it is hard to implement this with a5 Function definations.
when i finished it, people whom triyng to make diablo style game like me. i do not know when it finishes ,but about one or two months it will finish .
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/05/01 05:25

Skater's next project is a path finding workshop. Look in his topic "Anybody want a gun reloading script?", in User Contributions.

Stranded : I will look again at your code you have done so far and try and find all the bugs in it. Then we can analise them and work out how to fix them.

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/05/01 20:00

Hi guys,

probably a bit of topic, but i am working on implementing A* just with wdl. I started two days ago and now i am convinced it can be done and it will probably be pretty fast too. It all comes down to the question on how much data (nodes/states) A* has to search to find the shortest path. I startet implementing it with the Points of Visibility concept. The code so far finds all PoV's in a level and for each PoV constructs a datastructure containing the handles of all other PoV's this one can see .. I might make a tutorial but i am not sure yet cause my time is very limited. Of course, cause the goal was to implement it completely with wdl, the code reserveses around 200K of memory .... This can be improved much by using the SDK and C and dynamic memory allocation however this can be implemented later.

i will post on the progress i made but as i said it all depends on the time my regular job and my family gives me to do this ...

greetings Ronny

Posted By: WildCat

Re: Advanced AI for FPS with A4 templates - 07/05/01 23:57

Ronny,

I'm really excited to see your version of A*. I've heard of it, but don't know how it works, and I need a good path finding system. Let us know when it's ready!

-WildCat

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/06/01 02:57

Can't wait for the pathfinding! Is it going to be like a UT one. That is, you can post nodes on the map in WED, then you tell the actor a point on the map to go to, and it goes to that position along the nodes using the shortest possible route. Is it like that?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/06/01 20:51

Hey Ronny, I work on a Pathfiding-Tutorial, too!
A Script to "walk around" entities (for example a Labyrinth with WMB-Entities) works fine.
At the moment I work for a Pathfinding on Terrain.
But what's your Method to get ALL PoV's in a Level?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/07/01 02:19

HI guys,

Jokester999: Yes that is what A* is all about

Iblis and Jokester : here is how it will work. (i.e what the level designers would have to do).

okay, because you asked i will tell ya ...
The PoV's are just entities, can be map entities, sprites (as a matter of fact i am testing with arrow.pcx). Level designer needs to place an entity at each convex part of the level and would have to attach an action i wrote to those entities. This action just sets some SKILLS and then goes into a while loop with a waitt (big number). It's just that the entities stay there until all intialization is done. Now you have to invoke an initilization function (once per level). It will use the new ent_next instruction to loop thru all entities and find out which ones are PoVs. It will store them and then invoke another function which builds a new data structure for every PoV which (among other data) hold the handles of all other PoV's it can see, this is my quick representation of a connectivity graph . But as i said in my first post, i just want to prove that it can be done .....

hope that helped

Ronny

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/07/01 02:35

I agree that a good AI needs a good pathfinding system. Else they walk against walls etc.
I'm following Skaters topic a long time yet and I read about his path finding workshop.
Cyberkid, I hope you want to share your pathfinding with us if it is finished.
And Ronny, I'm really excited to see what you are going to make. It must be almost the same as Half-Life.
And if we can make something like that, we can create a much better AI.

But now about my advanced(?) state_hunt. It is not really difficult. You just change state_hunt into this:

code:

function state_hunt()
{
MY._STATE = _STATE_HUNT;
create(<arrow.pcx>, PLAYER.POS, _last_know_target_loc);
ent_marker = MY.ENTITY1;
// calculate a direction to walk into
temp.X = ent_marker.X - MY.X;
temp.Y = ent_marker.Y - MY.Y;
temp.Z = ent_marker.Z - MY.Z;
vec_to_angle(MY_ANGLE,temp);
MY._TARGET_PAN = MY_ANGLE.PAN;
// turn towards target
MY_ANGLE.PAN = MY._TARGET_PAN;
MY_ANGLE.TILT = 0;
MY_ANGLE.ROLL = 0;
force = MY._FORCE * 2;
actor_turn();

hunt_transitions();
patrol();
}


Now change
"scan_sector.PAN = 360;" in
"scan_sector.PAN = 180;"
(actors.wdl, actor_patrol).

Also remove all
"IF(MY._HEALTH <= 20) { EXCLUSIVE_ENTITY; wait(1); BRANCH state_escape; }"
(war.wdl).

This is not necessary, but escape looks horrible, they just walk away until they hit a wall and then they do nothing.

I shall explain what these changes do:

If an enemy now loses the player, he starts patrolling over a path from positions until he finds the player.
He first turns towards the player to move into the right direction. He only scans in front of him, so he doesn't make big turns, this looks bad. This is a lot better than the standard state_hunt that just approaches the player until it gets stuck in a wall. But with the new state_hunt you have to add a path of positions in your level, this is rather difficult and costs a lot of time. But then you're having a better AI. Of course there are better solutions with other ways of pathfinding, but this is a good start, especially for A4 users like me. Hope everyone wants to help improving this code or thinking of better ways of pathfinding in A4.

Also check out http://www.conitec.net/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=1&t=002434 for more pathfinding.

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/07/01 02:51

I really really like the quake & quake II AI... can anyone here be able to try something like, implimenting quake AI into wdl? i like it because they aim very well, shoot at only necessary times, and if another monster hits them, they forget you and attack whoever starts attacking them.. they have anger towards each other too. i like all their ai.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/07/01 09:30

Hi Ronny, thanks for your fast answer.
I sit the whole day at home and asked me how jou get the PoV's.
But now it's clear, the Mapper has to set them (I understodd you've made a script which set it itself).
It's no bad idea and I think it is the only way to get a good Pathfinding-AI in a Level with normal "Map-Walls".
But I guess you're Pov's will ignore moving Entities in the Level. I think we need a Script which is a combination of different Pathfinding-Algorithms.
For the Entities my (yet not finished) Entity-Pathfinding (of course in use of the MAX_X/Y/Z-Values) could help, and for Terrain I start a Script.
I hope in future A5-Versions there will be an IGNORE_TERRAIN for tracing_mode, than I can combine my Entity-Pathfinding and Terrain-Pathfinding.

So on, we will see...

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/08/01 07:44

Hi Iblis,

right using PoV's mainly deals with obstacle avoidance, it can't deal with moving entities, but that is easy and i have already resolved that (using trace).

greetings Ronny

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/08/01 22:44

I've used something like a "Robust Trace",too (for entities).

So, we will see how effective your A* will be. The Heuristic is one of the most interesting thinks in it! For Terrain-Pathfinding you need it,too. I hope I can develop a good one

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/09/01 15:30

Hi Iblis,

yeah the heuristic is an interesting part ... however until the algorythm fully works, i don't do any tweaking and tuning, so i will use the geometrical distance to start with.

greetings Ronny

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/12/01 06:47

this may be old news, but viperbyte put out ALL of the Winthrops mansion wdl code for download, for free. it is really good, but it just works with A5, i think. (thats why i orderd A5, its comming in a couple days!! )
anyway, you can look at that. they have some pretty good AI. it may help...
here's the link:
Here
or if that one doesn't work, click here: http://a4a5.hypermart.net/Interview_V_B_/WM_WDL.zip
hope this helps ya'll.
now i'm off to read the new version of the user magazine... till later!
-merlingames
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/14/01 07:50

Didn't know that yet. thanks for the link.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/16/01 02:50

sure! anytime.
-merlingames
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/20/01 20:21

Implied proclamation of self-importance to no justifiable end #2

Thanks to Merlingames

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/21/01 22:04

errr...
you wanna run that by me again in English?
i can't figure out if you just dissed me or not.... *sniff*
-merlingames
p.s. if you dissed me i gotta dis you back... working.... working....
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/24/01 20:10

This project seems to have come to a halt. Has everybody given up?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 07/31/01 02:06

Hello everybody, I just came back from almost 3 weeks of vacation in Slovenia.

merlingames: thanks for the link, Sikkens_Software want to tell us that he is keeping this post at the top.
It was a idea of Eldurin to say it like this.

I hope you guys don't give up, but I think everyone is working very hard on pathfinding.
But Jokester, what the bugs in my code? You're right with your signature, finishing a game is the most difficult about making one.

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/05/01 23:04

We don't need to make our AI with the templates in this topic, hope that's clear for everyone. But I hope the AI and the pathfinding stuff is compatible with A4, because else it won't help me much.
Has someone made progess with his pathfinding yet? Jokester, have you made progress with fixing the bugs yet?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/06/01 01:19

Sorry! My mistake! I was using your code at the same time as some other one aswell and it made yours go funny! Sorry! But one thing we definately need to do first is to make it so the enemy reacts quicker. At the moment, if you keep straffing round him in a circle, then he will always miss you. He fires to early. We need to find a way to fix that.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/08/01 02:28

You're right, some time ago I already tried something to let the enemies fire only at the player when they could really hit him, but then they didn't fire at all anymore. There will probably be a way to fix this. And you're also right about the strafing around the enemy, if there is only one enemy he can't beat you if you keep strafing. I will try some things to fix this bugs. I already know what's the problem, the enemy checks or he sees you and then he shoots, but the trace function also looks backwards so if you're behind the enemy he sees you and start shooting at nothing. What we have to do is making the player only shoot if you're in front of him. Have you also used my advanced state_hunt? It works good, but adding the paths to the levels is a lot of work.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/08/01 03:59

I was on vacation,too. And now I have much to do before I can come back to pathfinding again. My code will be optimized for A5, but the Entity-Pathfinding should also works for A4. My second project, Terrain-Pathfindg won't probably work with A4 ;-)!
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/09/01 07:15

I hadn't noticed that advanced hunt, i'll try it out. I have another small idea for state_hunt that doesn't use paths, but might not be as good. For state_hunt, could you make the enemy face the players direction, then walk in that direction and then use the SHOOT command to see if any walls are in the way and if so, turn away until his path is clear, then keep shooting at the wall which was blocking him initially, and when it is gone, continue to follow the player. I havn't realy thought this through, but could it work?

Also, for the escape part, you could do the same thing but face away from the player. What do you think?

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/11/01 05:02

Haven't found a solution to fix the bugs yet, but I've got something else. In my advanced state_hunt, enemies can't get through doors, I've fixed this. Add:

code:

MY.__TRIGGER = ON;
MY.TRIGGER_RANGE = 16;


to the action of your enemy.
Now make skill7 of your doors 20 and the enemy opens the doors.
You can adjust the values if necessary.

Escape is a useless function I think, because what's the use of the enemy escaping to another room or even if he does it really good, escaping to the end of the level. In other games you don't see these either, for example Half-Life.
About your state_hunt, that might work, but I don't think it's easy to make. For example a enemy hits a wall on the left side of a opening and goes to the left, what should he do then when he hits the corner? Should he walk around the room, with a chance that he goes to another opening. Or maybe you can let him go the other way until he finds the opening, but what if there's no opening in that specific wall. And should he always keep walking into the players direction, because what if the players goes to another direction. You see there are a lot of problems, but if you can overcome this problems it might be a good state_hunt. The only way to find this out is to try it.

Iblis: off course your terrain-pathfinding won't work for A4, but I will be glad if the entity-pathfinding works for A4.

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 08/20/01 02:11

Well, any progress yet?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/01/01 04:02

Just informing everyone that I will go to England for a week tomorrow morning. It's for school. I will go to Bath, close to Bristol and will be back friday morning. See you all later.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/10/01 00:59

Still no news yet from anyone?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/11/01 00:41

for the state hunt couldnt you make the npc face the char in a given distance, but do a collision detection for walls and objects in between npc and char. if an object is there then scan another direction until i find my out???
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/13/01 04:34

Can anyone code that the enemy stores the players last position and then walks towards it when he is in state_hunt?
Posted By: Doug

Re: Advanced AI for FPS with A4 templates - 09/13/01 09:58

He already does (or should).
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/14/01 03:32

In the newest A5 you mean. I have a4.25.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/17/01 17:56

Doug can you please give us an idea how to do that?.

Thanks

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/24/01 04:12

Well?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/24/01 05:49

I just took a look in my download file: at the 12th of january this year I found a template

quote:
// Template file v4.22a (12/12/00)

with a feature like

quote:
_last_know_target_loc()


hope that helps

Achim

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/29/01 07:23

Here are some of my AI thoughts as well. works well on Vain, maybe they'll do the trick for u as well.No work for the level designer either.

Friendly,
LLaffer

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/30/01 07:49

That would be great!!!
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 09/30/01 07:52

AL:

It does the following:

code:

// Desc: used to "tag" the last know target location
// "CREATE <arrow.pcx>, MY.POS, _last_know_target_loc;"
function _last_know_target_loc()
{
YOUR.ENTITY1 = ME;
MY.INVISIBLE = ON;
MY.PASSABLE = ON;
}

I don't understand what exactly is it doing or is supposed to do, in each case it doesn't do what I like to see.
But thanks anyway.

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/10/01 20:44

Just keeping this post at the top. I quess it's false hope but you just never know.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/15/01 03:26

Okey,
let's talk about AI a little:

(something like a restart of the post)
there are in the templates and in the free demos and games that are offered on the download page and in the acknex magazine and on different links and on sites of the A5 webring that one should combine to get new ways of behavier.

Especielly the Adept scripts are underestimated. Look at the npc_random_navigation or the scorpion's actions for example.

HOW to combine them - that is one of MY special interests.

This post did a good start with small modifications of the status quo of the given AI.

Let's try it with a little stupied modification of the actor_follow action. Instead of following, the actor runs around the player. If you replace the escape action with this and make him shoot at the same time (I don't know how to manage this, may be you have an idea) it won't be soooo stupied.

quote:
ACTION actor_run_around
{
while(1)
{
WAIT 1;
IF (MY._FORCE == 0)
{
MY._FORCE = 2;
}
IF (MY._MOVEMODE == 0)
{
MY._MOVEMODE = _MODE_WALKING;
}
IF (MY._WALKFRAMES == 0)
{
MY._WALKFRAMES = DEFAULT_WALK;
}
IF (MY._RUNFRAMES == 0)
{
MY._RUNFRAMES = DEFAULT_RUN;
}
IF (MY._WALKSOUND == 0)
{
MY._WALKSOUND = _SOUND_WALKER;
}
CALL anim_init;
// turn away from player
temp.X = MY.X - player.X;
temp.Y = MY.Y - player.Y;
temp.Z = 0;
TO_ANGLE MY_ANGLE,temp;
MY_ANGLE.pan -= 90;// This is the only thing I changed
MY_ANGLE.TILT = 0;
MY_ANGLE.ROLL = 0;


force = MY._FORCE * 6;
CALL actor_turn;
force = MY._FORCE * 2;
MY._MOVEMODE = _MODE_WALKING;
CALL actor_move;
MY._TYPE == _TYPE_ELEVATOR;
}
}
}


Just to give an AI discussion some stuff.

Achim

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/15/01 03:46

quote:
Originally posted by Stranded:
Can anyone code that the enemy stores the players last position and then walks towards it when he is in state_hunt?

A late second answer:

the code of the templates that I had quoted does exactly this: it stores the last position and the enemy walks towards it and if the player is still visible from that position the enemy attacks him again.

Your quotations of the code are an enigma to me too, but it works. Test it! Build a wall, place an enemy behind, go to him with the player until he recognizes him and run behind the wall!

Posted By: Homey

Re: Advanced AI for FPS with A4 templates - 10/15/01 07:06

Hello,

Try commenting out..
// MY.INVISIBLE = ON;

you will actually see the little arrow marker
, then function hunt_approach() uses this marker as a position to walk too...

A better way that i've been kickin around in my head, would be to leave a trail of player positions, think of it as a trail of bread crumbs...

Possibly have an array and store 10 POS locations in there, then have the NPC follow from POS to POS scanning for player, this would result in much more realistic movement since he's following the players exact walk directions...He'd never bump into walls again
, well unless the player did... =)

I first read about this on another game dev board, and it supposably works quite well..

If I get anywhere on it, I'll post it up...

Homey

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/15/01 10:27

Tell me if you think this is worth doing: When an enemy reaches a certain amount of help and it is forced to run away it will go and find the nearest enemy and alert him to find and attack you, kind of a 'rasing the alarm' code.

DaZ

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/16/01 20:36

thanks guys.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/17/01 02:54

AL: I'll test it when I have time and I'll think about running and shooting at the same time.
Homey: That's a very good idea, I've thought about it myself one time, but didn't know how to code it. But if you can code it, then it should work perfectly. But it is a little unrealistic, but who cares about that.
CD: You should try making that, it's makes the AI much better. In Deus Ex they use alarm panels for that, works fine too.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/18/01 03:51

The only thing your adjustment does is letting the enemie turn 90 degrees and then walk stupidly into the wall. Maybe you did something wrong or you forgot something? You wanted them to walk around the enemie, didn't you?
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 10/22/01 04:46

You are right, the only thing I did was to turn the actor_follow by 90 degrees. but I didn't say that I did more. Okey, this way it is useless to you, so I tried to combine it with the AI script from the Acknex Magazine. It didn't work.

The intention of my post was just to give ideas, not to give solutions. I thought that an enemy who runs around the player is less easy to shoot and a harder opponent.

This topic searchs for solutions, so I posted useless.

I beg your pardon!

Achim

Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 11/06/01 19:35

Putting it at the top again.
Posted By: Anonymous

Re: Advanced AI for FPS with A4 templates - 12/27/01 03:31

And again!
© 2024 lite-C Forums