How To Make AI Discussion
by Bryce · in Technical Issues · 11/04/2004 (2:44 pm) · 156 replies
I'm making a game called Metal vs. Flesh and I cant figure out how to make AI players.
#2
As advised, take the player code from the demo and study it. Then apply it to other models/ai characters that you add. You can use Blender to create models for Torque for free in the demo.
11/04/2004 (8:00 pm)
Please don't notify people of your age. It's simply easier that way for all parties involved. COPPA can be extremely irritating, and can also be extremely beneficial.As advised, take the player code from the demo and study it. Then apply it to other models/ai characters that you add. You can use Blender to create models for Torque for free in the demo.
#3
11/05/2004 (6:51 am)
Im notifying you of my age so that you know that i dont work. i only have an allowance. thats why i cant afford the source code
#4
Load up the demo and the fps example.
Some things to try at one line at a time on the console: (BTW: bring it up with ~)
11/05/2004 (12:43 pm)
*Quoted from a post by Pascal Retting that I found useful when I first dabbled with AI in TGE:Load up the demo and the fps example.
Some things to try at one line at a time on the console: (BTW: bring it up with ~)
// press F8 to drop the camera at the player, then fly around somewhere above the ter
rain
// and put the following command all on one line to drop in a player
new AIPlayer(bob) { datablock="LightMaleHumanArmor"; position=localclientconnection.c
amera.getPosition(); };
// fly a little distance away and do the following:
bob.setMoveDestination(localclientconnection.camera.getTransform());
// repeat the above a couple time to give bob a workout
// make bob temporarily invisible:
bob.setCloaked(1);
// bring him back:
bob.setCloaked(0);
// fly around to get a goood look at bob and give then give him a crossbow:
bob.mountImage(CrossBowImage,0);
// load him up with some ammo
bob.incInventory(CrossbowAmmo,5);
// now fly around to another location near bob and create dirk:
new AIPlayer(dirk) { datablock="LightMaleHumanArmor"; position=localclientconnection.
camera.getPosition(); };
// aim bob at dirk
bob.setAimObject(dirk);
// fire away!
bob.setImageTrigger(0,1);
// if you want bob to aim higher (he's probably shooting at dirk's feet) try this:
bob.setAimLocation(VectorAdd(dirk.getPosition(),"0 0 1"));
// you may need to give him more ammo:
// (his trigger image is still 1 so he should fire right away)
bob.incInventory(CrossbowAmmo,5);
// bob's done enough harm, take him out
bob.kill();
#5
11/05/2004 (5:06 pm)
Nice, Matthew[Thanks,Pascal], that's a good first testing on a few TGE items.....and it helps with ai...this place is so helpful!
#6
I modified the player.cs to read:
aiAvoidThis = false;
But still nothing....
I can see the attack code in the aiPlayer.cs but just cant trip it ...
11/07/2004 (2:22 pm)
So how do you "trip the bit" so the bots will attack?I modified the player.cs to read:
aiAvoidThis = false;
But still nothing....
I can see the attack code in the aiPlayer.cs but just cant trip it ...
#7
11/07/2004 (10:23 pm)
As mentioned in my post above:// aim bob at dirk bob.setAimObject(dirk); // fire away! bob.setImageTrigger(0,1);
#8
@Phil: did you try the whole ensemble? Did it work as expected?
11/08/2004 (12:44 am)
@Matthew: do you have any idea whybob.setMoveDestination(localclientconnection.camera.getTransform());won't work? I tried it, it just turns Bob in some random direction.
@Phil: did you try the whole ensemble? Did it work as expected?
#10
11/12/2004 (5:13 pm)
How do I add paths and make the AI run across them, and how do I add AI in the game world?
#11
files to look at:
starter.fps\server\scripts\game.cs
in
startGame()
starter.fps\server\scripts\aiPlayer.cs
specifically the AIManager think/spawn functions at the bottom.
11/12/2004 (5:17 pm)
Bryce look through the start.fpd scripts, here an AI is added and made to follow a path.files to look at:
starter.fps\server\scripts\game.cs
in
startGame()
starter.fps\server\scripts\aiPlayer.cs
specifically the AIManager think/spawn functions at the bottom.
#12
Here is a useful tutorial on Bots and paths
www.codesampler.com/torque.htm
for me I think its time to hang it up until decent docs to come out. it took days of reading/searching just to figure out something as easy as adding inventory min/max to the player.cs to pick up a different weapon and use it.
11/12/2004 (5:37 pm)
Making AI run around is the easy part. Good luck getting them to shoot back. Been a nightmare for 2 weeks, I find nothing but outdated code that will not run in v 1.3, and the doc's need serious help. There are hundreds of ways to to things, but us beginners only have a point of reference of the samples, which isn't good enough in the AI shoot back category ...Here is a useful tutorial on Bots and paths
www.codesampler.com/torque.htm
for me I think its time to hang it up until decent docs to come out. it took days of reading/searching just to figure out something as easy as adding inventory min/max to the player.cs to pick up a different weapon and use it.
#13
Ai spawners are multi-faceted in their spawning manners. They can spawn one bot a ta time, a dozen bots at once, or any combonation of the two. They can also be set to limit the number of spawns or to infinately spawn during the entire mission. How they act is up to you and it won't get any easier to do. Open you mission editor, drop in your Ai Spawners where you want them and define their parameters, save the mission, restart the mission and PRESTO!!! Bot's ready to kick your butt.
11/12/2004 (5:48 pm)
I'll be releasing some exceptional scripted AI pretty soon. It's so advancd that it manages itself. No more "How do I do this...How do I do that?...." Or what command for this and that. Simply place your AI spawners and that's it. They spawn themselves, manage themselves, respawn themselves, etc... They also, attack, evade, chase, wander, seek health, etc... based on their type(currently 4 different Ai types) and assignment as well as actual conditions. Pretty soon they'll be able to ask each other for help to gang up on you, as well as switch weapons and hunt ammo if needed. Comes with complete admin support functions to allow bot management if neccesary in times of mission editing or other needed situations. Oh, and when they kill you, they taunt, lol.Ai spawners are multi-faceted in their spawning manners. They can spawn one bot a ta time, a dozen bots at once, or any combonation of the two. They can also be set to limit the number of spawns or to infinately spawn during the entire mission. How they act is up to you and it won't get any easier to do. Open you mission editor, drop in your Ai Spawners where you want them and define their parameters, save the mission, restart the mission and PRESTO!!! Bot's ready to kick your butt.
#14
Sounds great , when is "pretty soon"? e-me and I'll be the first to buy ....
11/12/2004 (6:01 pm)
Gonzo , if I had half your knowledge, my head would explode !Sounds great , when is "pretty soon"? e-me and I'll be the first to buy ....
#15
Sounds great , when is "pretty soon"? e-me and I'll be the first to buy ....
11/12/2004 (6:10 pm)
Gonzo , if I had half your knowledge, my head would explode !Sounds great , when is "pretty soon"? e-me and I'll be the first to buy ....
#16
will what you are saying is really interesting all that stuff is greate, I can't wait tell you do it, but please can you tell us more details when it will be release even if it estimated date, price and more details, like if it can avoid obtacles...etc.
and last question : is your pack differant than this:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5892
Regrads
11/13/2004 (12:47 am)
Gonzo I don't beleave what I see (I mean your post) I feel really tired after 2 day of fighting with AIPlayer to make him avoid obstacles and I didn't do it :(will what you are saying is really interesting all that stuff is greate, I can't wait tell you do it, but please can you tell us more details when it will be release even if it estimated date, price and more details, like if it can avoid obtacles...etc.
and last question : is your pack differant than this:
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5892
Regrads
#17
11/16/2004 (3:34 pm)
Thanks a ton Gonxo I really need that. Now I can back to vehicles and stop trying to get AI in.
#18
11/16/2004 (11:09 pm)
Hmmmm... This seems like it would be helpful. ETA? 2 weeks or so?
#19
This would be very helpful , for all of us i think !
11/17/2004 (11:42 am)
Ye Gonzo you are the man.This would be very helpful , for all of us i think !
#20
See the plan...
11/18/2004 (10:22 am)
Thanks for the kind words guys. I've posted a plan that will answer a lot of your questions and then some....See the plan...
Torque Owner Gonzo T. Clown
There is Ai hope in the future, just be paitient or get to writing your own.
Good luck.