Skip to main content
GameDev.net gamedev.net
🔒 Locked

AI software (API) help

Started by Mille Jan 13, 2007 at 3:52 PM 11 replies 5.3k views
Original Post
Mille
Mille
Hey guys, I working on a small 3D shooter game (FPS style), and I’ve come to the stage where it makes sense to put some AI into the game, that is, I have the total scene (with physics) set up, and it is possible to make ray/sphere collision checks, and frustum checks (and through objects). In the game the AI will be the enemy, and the player (you) will be its target (as always). I was thinking of 10-15 enemies, all moving along specified paths with way points. Their purpose is simple, find you and shoot you!, if you (the player) shoots back, try hide if possible or move away. Finally to my question: is there any AI implementation (API/lib) which has such functionality that I can use straight out of the box ? (free or open source) – or must I travel the long way and make it all by my self (an I’m NOT an AI expert )? Any input is highly appreciated!
www.pokersniffer.org
Ferretman
Ferretman
I agree with the anonymous poster. You are unlikely to find a freeware API that will do much of what you're looking for, and so you'll end up building so much of it I wouldn't even bother with a freeware API.

Fortunately you can build it gradually...it doesn't have to do everything at once. First, just get the enemies to move around realistically....that's harder than you might think. Then, get them to face towards and shoot the player (bet ya a buck you see them shooting 180 degrees away from the player at least once). Work on getting these basic behaviors down.

After that you can get fancier. Want them to hide? Okay, that involves a lot of "thinking"---what kind of cover is nearby? how bad am I being hurt? does the player look like he's nearly dead himself? Moving from protected location to protected location is also an interesting challenge...rather than plotting the best path through a room you're plotting the one with the least visibility to the player (or at least where the AI thinks the player is). Etc.

My point is that you can very much do what you want, but it'll take iteration and building on the pieces you got working before. Get the basic bits of behavior down first (move, shoot, find) and then you can use them to "build" more complex behaviors.

Good luck!

Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com
Mille
Mille

Thanks for your input! - I get the point. Its just so that I know of api’s for sound setup and physics for game programming, and I was wondering if there also was a nice AI api out there somewhere .. but then again, AI depends highly on the type of game so I may just start doing what I need by my self.

However, I did find kynogon.com, I think it can do "almost anything", but it is missing one BIG feature – its not free :)

Thanks again ..
www.pokersniffer.org
Steadtler
Steadtler
Im working on something, but its for a specific engine, and its not gonna be totally free. Also, *any* AI middleware is still gonna require some development on your part.
Raghar
Raghar
Nearly finished program, it needs just an AI... It could mean a complete rewrite of such program.
Raghar
Raghar
Quote:
Original post by FerretmanFortunately you can build it gradually...it doesn't have to do everything at once. First, just get the enemies to move around realistically....that's harder than you might think.


Goal driven AI with penalty methods might be nobrainer to implement. That is if he could do pathfinding, or non intersecting polyline path description.
IADaveMark
IADaveMark
Quote:
Original post by Ferretman
Fortunately you can build it gradually...it doesn't have to do everything at once. First, just get the enemies to move around realistically....that's harder than you might think. Then, get them to face towards and shoot the player (bet ya a buck you see them shooting 180 degrees away from the player at least once). Work on getting these basic behaviors down.


This is the key to doing anything for the first time... and actually doing AI at all times. The great Brian Reynolds (Civ II, Alpha Centuri, Rise of Nations) actually said in a lecture at GDC, "a random number between 1 and 3 with a select statement IS a legitimate AI to start with".

That being said, you will likely want to do some serious reading on established techniques. Remember you don't have to do fancy stuff like neural network trained weapon aiming, etc. Just point and shoot. And don't worry about hiding. If you don't know where to start with running and gunning, hiding is a bitch.

I wish you luck... but you can do it. Continue to ask for specific things around here as you go. They are much easier to address in this format than open ended questions.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit<
Raghar
Raghar
Is a random integer between 1 and 3 still an AI? ~_^ Probably not because it's a deterministic function, which is in disagreement with purpose of AI.

Of course roll dice, for 3+ roll he will have snack, for lower roll he would attempt to kill the character, IS an AI.

Mille

One advice, if you'd like to implement an AI for FPS, do it in a way you'd see the behavior easily on the screen. Walking through tons of debug output is often the more nasty way.
Digitalfragment
Digitalfragment
@Millie. Yes there are APIs out there, but they require alot of work to implement and you would also need to understand the fundamentals of AI to use them anyway.

From the toolset you said you have, you can easily start implementing your own ai using them. Start by creating an agent that just randomly decides to run, turn or shoot. Basically an object that duplicates the player object, that has a Think() function that manipulates that objects inputs (your game should be able to treat these inputs the same as the players, just for the new object).

Then, in your Think function, instead of using a random, use your Ray intersection tests to see if the agent is about to run into a wall. If it is, make it turn. If it isnt, make it run. Super simple FSM to start with. Then, again using your Ray/Sphere tests, only shoot if the agent is aiming at the player. And keep building on it from there.



@Raghar. InnocuousFox quoted "a random number between 1 and 3 with a select statement IS a legitimate AI to start with"
What you described yourself is a random value between 1 and 6 plugged into a switch statement :P
Raghar
Raghar
Actually what I described is a standard notation from rulesystems. 3+ at D6 aka 2/3 probability. Where do you see a switch statement?

As for that random number between 1 and 3 (on integers). It's a standard joke from people that worked with random generators.

If "a" is an integer. Valid "a" would be in range (1,3) (non inclusive). (1 < a < 3)

^_^
vetroXL
vetroXL
Hi,

I would start off with learning about steering behaviours, and then implement a state-machine from there. A very excellent book is AI Game Programming by Example from wordware publishing, this book has a steering behaviour on hiding... The book is very straight foward. I started with steering behaviours, then added a state machine and my AI looks and behaves pretty good, no neural net. From what I learned, AI is alot of tweaking until it "looks" right.

PS, it's really not that difficult to get a simple AI going if you have a good reference. I found the AI implementation to be more tediouse than difficult. Apparntly, Neural Nets are supposed to make this process simpler because you can "train" your AI, but I have not played around with neural nets.

Good luck, and I hope my ramblings help in someway....
Digitalfragment
Digitalfragment
@Ragar: Lol, stupid me, i didnt realise that between 1 & 3 non inclusive can only be 2. But what you said:
"Of course roll dice, for 3+ roll he will have snack, for lower roll he would attempt to kill the character, IS an AI."

*is* a random put into a switch statement:

switch ( rand()%6 )
{
// 1 & 2
case 0:
case 1:
AttemptToKillPlayer();
break;

// 3+
case 2:
case 3:
case 4:
case 5:
HaveASnack();
break;
}

it just logically works better to say "if (rand()%6 >= 2) {} else {}"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.