AI code for FPS/3PS

Blitz3D Forums/Blitz3D Programming/AI code for FPS/3PS

Alienforce(Posted 2005) [#1]
Hi all,

Struggeling hard to get my AI codes to behave :)

Does anyone have any good examples or links to share.
Found mrpye´s "Collision Avoidance V2" but i having trouble getting the bots to work on a nonflat surface. :(

The AI FSM code i am working on will hopefulley include the states Guard,Search,Panic,Hunt,Shoot to kill.

If anyone has used the "Collision Avoidance V2" for anything i would be glad to get some inputs.

Best,

/Alienforce


David819(Posted 2005) [#2]
The A.I really depends on the level you have, if it's a basic level where floor and wall are joined in the one file then if the A.I bumps into a floping floor then it will think it is a wall, you need to make two separate meshes for floor and wall and only apply the collision aviodance to the A.I and wall meshes. Hope this makes sense and helps abit.


ozak(Posted 2005) [#3]
Waypoints are a good way too. Works excellent in UT. Far better than Q3's level scan approach :)


Alienforce(Posted 2005) [#4]
Thanks for the input!

Setting up the waypoints now and seperated the "floor" from the level mesh.

/Alienforce


puki(Posted 2005) [#5]
In addition to "ozak", I use waypoints - I didn't post before as I think you are looking for answers with regard to 'Collision Avoidance V2'.

However, waypoints are really for moving entities. You still need to take into account collisions. An easy way to do it is to use 3 lanes of waypoints in a line (for example in a corridor), this allows an entity to 'overtake' another entity whilst maintaining oncoming entity 'traffic'. Or you could just sling-shot around (left or right) on a single waypoint line.

You can constantly load the current status of waypoints into a look-up table - a bit like a traffic management system - so rather than a multitude of linepicks, etc your AI can just *know*.


John Blackledge(Posted 2005) [#6]
I completely agree with Puki.

I spent weeks making my characters randomly move, bump off walls, etc, but inevitably they always got stuck somewhere.

Eventually I had to junk the system and start again using paths of waypoints.

The downside is that you couldn't use this for any kind of combat system (which luckily I didn't need).

The upside is that once you have such a system running, as puki says, you can have 'traffic lanes' of people that look pretty random but which actually aren't.

The final thing I added was that if two people collided they would turn to each other and say 'How are you?', pause, then move on.
A lot of work, but staggeringly good - the first time I saw them do that I whooped!


puki(Posted 2005) [#7]
Well, technically, you can use waypoints for combat - you can use a reusable, dynamic, floating, waypoint grid. A bit like a dynamic waypoint grid in an 'Elite'-type space game for space stations and stuff like that.


Raitsun(Posted 2005) [#8]
If you have an area where bots have to fight the player it is not that difficult to simulate pseudo-combat-A.I. throug waypoints.
You can set a net of waypoints that lead to cover-positions, alarms, etc. The Bots than have a simple A.I. System that leads them to special places in the waypoint-Net, dependent on the situation.

That's what i am going to use in my Action Game.

Raitsun


Alienforce(Posted 2005) [#9]
Thanks again guys for the inputs, Just one more thing..
If i will be able to sneak up behind my bots and suprise them :) Then Fredborgs examble of "line of sight 3d" the way to do it ??

/Alienforce


Raitsun(Posted 2005) [#10]
should not be that difficult to make something like that yourself using linepicks.


Techlord(Posted 2005) [#11]
Alienforce

When I was working on my B.R.A.I.N FMS for the Project Plasma FPS I found myself employing a combination of LinePicks, 3D A* Pathfinding, and Waypoints/Triggers. Each technique had its hi and low points. A* worked well in open exteriors, Waypoints were excellent for interiors. The goal was to developed a expandable AI system with the basic states Guard, Search, Evade, Hunt, Shoot.

LinePicks and other collision algos were used to perform search/scan patterns. I had plans to replace them with hidden geometry, but, not sure about performance impacts.

The 3D version A* was based on 2D A* with Blitz mesh collision used in path calculation on X/Z Plane and gravity applied to the Y axis. The A* was multi-tiered to handle long and short distances. Although, it wasn't initially intentional, the A* algo had decent collision avoidance built in.

Waypoints were simple collision points that simply altered the direction of a moving bot upon contact. These are great for creating patterns of movement or navigating narrow corridors.


Triggers on the otherhand were more complicated offering more trigger mechnism and scripted control. Triggers were use to activate actions/events. Although they weren't specific to bots, they another component of BRAIN System and responsible for much of the interectavity.

I ran into some bugs that pretty much brought development to a halt. I would like to restart work on this though as it was supposed to have been ultimate contribution to the Project PLASMA FPS.


Alienforce(Posted 2005) [#12]
It sounds like a great system Frank.

The B.R.A.I.N FMS is it included in the Plasma lib. ?



/Alienforce


Techlord(Posted 2005) [#13]
Alienforce

Unfortunately, the BRAIN FMS was never completed nor fully tested for Project PLASMA. I could drum up the code. However, developing A* pathfinding algo was really useful for learning collision avoidance and highly recommended. Patrick Lester's A* Pathfinding for Beginners was one the best tutorials I found on A* and helped me design my version.