### AI tutorial

There are no stupid questions, just stupid answers.
• 1
• 2

#### AI tutorial

GAN
Posts: 16
Joined: Sun Oct 14, 2018 6:50 pm
Hi all

Is there an AI tute for noobs? I sure would appreciate it. Thanks.

#### Re: AI tutorial

Duion
Posts: 1335
Joined: Sun Feb 08, 2015 1:51 am

It provides some examples and includes a behavior tree editor (which is broken currently) where you can simply edit your AI behaviors.

While a basic AI is pretty simple in Torque3D, I would recommend you using a framework it will be easier in the long run. I think adding an AI is just a single command in Torque, you can see it when you are in the NavMesh editor and add a bot for testing, but to make the bots act intelligent is some more work, thats why using a framework may be better. It depends on what you want to do. If you just want a bot randomly running around like a headless chicken, it is just one function or even one line and you don't need more, in that case you do not need a framework, but otherwise you should use one. You can write you own of course, but if you are a noob, I would not recommend that.

#### Re: AI tutorial

Steve_Yorkshire
Posts: 319
Joined: Tue Feb 03, 2015 10:30 pm

It's a bit old (recast is now part of the engine) but the Chinatown Ai Deathmatch resource I wrote has Ai scripts.
http://www.garagegames.com/community/re ... view/21604

#### Re: AI tutorial

GAN
Posts: 16
Joined: Sun Oct 14, 2018 6:50 pm
Please allow me to introduce my noobiness.....

I didn't use the Chinatown set to learn about AI. I thought I could just open the simplest of maps, add a simple datablock, and have an AI guy standing there not really doing too much, but he would be there. And then I could kind of see how things are linked together. Didn't happen. And then I think, my I should just play around with Coppercube? I really want to grasp T3D. The discouraging thing with learning game engines for me and its just not T3D; I have noticed it in Unity and Cryengine: the Tutes and Docs don't match the current interface due to age differences.

#### Re: AI tutorial

Duion
Posts: 1335
Joined: Sun Feb 08, 2015 1:51 am

I already told you, you open the NavMesh editor and switch down in the menu on the left and you enter a feature where you can spawn an AI test player and order him around, this is just to test the NavMesh, but it is a start to give you a feeling how it works.

#### Re: AI tutorial

fLUnKnhaXYU
Posts: 81
Joined: Wed Nov 15, 2017 8:19 am
the scripts/server/aiPlayer.cs is the best place to find the functions related to aiPlayers / . The Torque3d manual 3.5.1 covers aiPlayer and spawnSpere methods and things , I highly reccomend the manual its available at readthedocs.com . Study the spawnShere and aiPlayer relationship . with the spawnScript you can execute commands relative to the Bot spawned at that particular spawnSphere such as goto obj or goto path , set animation threads kind of things plus re-spawning control . The spawned object ID is saved as \$spawnObject which can be used in the script . The spawn script has a limit of 255 characters . Youll need paths and waypoints and a couple of finickey little things will come with that . You might need to learn how to make a path . It involves grouping a set of waypoints into a path object . something like that .They have to be numbered . Setting a bot to a path with the argument -1 for the path marker to proceed to will result in a constant loop of the path . heres a little test path . you might have to adjust the Z values , maybe just snap to terrain .
 new Path(path1) {
isLooping = "1";
locked = "1";
canSave = "1";
canSaveDynamicFields = "1";

new Marker() {
seqNum = "0";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "-741.996 -541.291 233.284";
Rotation = "1 0 0 0";
scale = "1 1 1";
locked = "1";
canSave = "1";
canSaveDynamicFields = "1";
};
new Marker() {
seqNum = "1";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "-763.352 -545.388 233.079";
Rotation = "1 0 0 0";
scale = "1 1 1";
locked = "1";
canSave = "1";
canSaveDynamicFields = "1";
};
new Marker() {
seqNum = "2";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "-781.852 -530.86 234.705";
Rotation = "1 0 0 0";
scale = "1 1 1";
locked = "1";
canSave = "1";
canSaveDynamicFields = "1";
};
new Marker() {
seqNum = "3";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "-763.724 -509.504 235.157";
Rotation = "1 0 0 0";
scale = "1 1 1";
locked = "1";
canSave = "1";
canSaveDynamicFields = "1";
};
new Marker() {
seqNum = "4";
type = "Normal";
msToNext = "1000";
smoothingType = "Spline";
position = "-732.683 -525.893 233.416";
Rotation = "1 0 0 0";
scale = "1 1 1";
locked = "1";
canSave = "1";
canSaveDynamicFields = "1";
};
};


Once you've spawned your bot be sure to type in objectID.dump(); in the console for a list of the available methods and things objID.dump(1); will give more details .
spawnSpheres , Paths , wayPoint Markers , Triggers , all seem pretty much fundamental . Some nifty aI oriented GUI might seem a natural progression .

#### Re: AI tutorial

GAN
Posts: 16
Joined: Sun Oct 14, 2018 6:50 pm

#### Re: AI tutorial

GAN
Posts: 16
Joined: Sun Oct 14, 2018 6:50 pm
Someday, I am going to find this navmesh editor
And then I will get excited

#### Re: AI tutorial

XIXWYRMEXIX
Posts: 44
Joined: Sat Mar 07, 2015 3:13 pm
The editor is right there with all the rest of the tools in the torque SDK.

#### Re: AI tutorial

GAN
Posts: 16
Joined: Sun Oct 14, 2018 6:50 pm
I was able to build a Nav mesh using the Navigation editor. To demonstrate my noobness, I was expecting someone standing there after entered play mode.
• 1
• 2

#### Who is online

Users browsing this forum: No registered users and 3 guests