Jump to content

how can I start with AI on T3D?


Johxz

Recommended Posts

Hi!


I want to start with AI on Torque3D, how can I start? yesterday I play a little with t3d 3.7rc walkabout but I see is not for AI. So, with what resource/addons/products can I start? I only know guidebot but is outdated...


BTW someone kind to share an AI guide/tutorial? focusing on torque3d and in general, I'm new on this.


thank you!


regards,

John

Link to comment
Share on other sites

There are a couple of things,

However the most suitable one would be BadBehavior by GuyAllard

http://www.garagegames.com/community/resources/view/22947


https://github.com/BadBehavior/BadBehavior_T3D


I quote:

The system is currently based on T3D 3.6.2, I will be porting to T3D 3.7 when it is released. The scripts are only included with the FULL template as I got tired trying to keep both FULL and EMPTY updated.


I have released it under the MIT license, so you are free to use and abuse it in any way you like.

 

bd3NeocArRQ

Link to comment
Share on other sites

If you log into GG and then TDN (through the documentation page, TDN section) there's some old but still useful basic information on using AI. http://tdn.garagegames.com/wiki/Torque/Script/Tutorials/Using_Basic_AI_Commands


There's also a load of old tutorials and game examples (by yours truly) in the GG resources section.

Simple SInglePlayer FPS http://www.garagegames.com/community/resources/view/20829

3rd Person Tactics-Action http://www.garagegames.com/community/resources/view/20995

Singleplayer Deathmatch using Chinatown http://www.garagegames.com/community/resources/view/21604


These are all from previous versions of T3D so some of the $typemasks may need updating and stuff like Recast is already in the engine.

Link to comment
Share on other sites

UAISK is also a popular AI product which should be mentioned for completeness' sake. But I'd see if BadBehaviour fits your needs before going to that, if you're into tinkering and making stuff from scratch (AFAICT UAISK's strength is its library of pre-made behaviours).

Link to comment
Share on other sites

thanks you guys! I will check it in a few days I almost finish learning to create my own particles and attach to objects ;)


Reading a bit this seems good https://github.com/logicking/GuideBot outdated (t3d 1.2) I know but nevertheless open source. Is a waste of time if I update it?


thanks daniel I will check BadBehaviour a little more, the last time give me a few errors.

Link to comment
Share on other sites

@Steve_Yorkshire or you could use the actual wiki instead of TDN :P http://wiki.torque3d.org/scripter:how-do-i-get-started-with-ai

Edit: Which, btw, has been updated so it's valid for newest version of T3D.

 

Ok, I'm reading this, but this part of the tutorial don't work for me:


You should see Bob automatically turn to follow Dirk's movements (even up and down hills).

Time to shoot at Dirk!

Bob.setImageTrigger(0,1);

This command tells the weapon/image in slot 0 that it is being "triggered" (same as when you push the mouse button). This causes the Lurker to start rapid firing.


Only shoot once, if I want to do rapid fired, how can I do it?

Link to comment
Share on other sites

Some other weird thing, when I use this "setMoveDestination"

 

Bob.setMoveDestination(LocalClientConnection.camera.getTransform()); // This work fine
Bob.setMoveDestination(Dirk); //This not... "bob" go to the edge corner of the terrain.

If I echo the dirk position and passed to bob, like this:

bob.setMoveDestination(123 123 123);

bob go to the position.


This was a test on t3d 3.7rc. If I do this tutorial on t3d 3.6.3 works fine (rapid fire not just once) even has sound when you load ammo or shoot. With 3.7rc don't have this sound.


Maybe is a update going on related to this?

Link to comment
Share on other sites

Some other weird thing, when I use this "setMoveDestination"

 

Bob.setMoveDestination(LocalClientConnection.camera.getTransform()); // This work fine
Bob.setMoveDestination(Dirk); //This not... "bob" go to the edge corner of the terrain.

If I echo the dirk position and passed to bob, like this:

bob.setMoveDestination(123 123 123);

bob go to the position.


This was a test on t3d 3.7rc. If I do this tutorial on t3d 3.6.3 works fine (rapid fire not just once) even has sound when you load ammo or shoot. With 3.7rc don't have this sound.


Maybe is a update going on related to this?

The issue here is that:

Bob.setMoveDestination(Dirk);

Tells Bob to move to coordinate "Dirk" which will probably be parsed as: "Dirk 0 0" which is wrong. You have to use:

Bob.setMoveDestination(Dirk.getTransform());

--

I don't know what's going on with the trigger image. Are you sure you gave him enough ammo?

Link to comment
Share on other sites

Thanks Lukas, Ok I do a more controlled test.


hahaha this is funny when I set MoveDestination(NAME) go to a random point in 3.7 to a corner of the terrain (very far) but in 3.6.3 go to a random point more centric and casually my other bot was there, so when setMoveDestination always reach my other bot Dirk :lol:


To summarize 3.7rc don't have the sound and the rapid fire don't work, only shoot once.

 

// 3.7rc
Bob.setMoveDestination(Dirk); // don't work
Bob.setMoveDestination(Dirk.getPosition()); // fine
Bob.setMoveDestination(Dirk.getTransform()); // fine
Bob.mountImage(LurkerWeaponImage, 0); // Ok (No sound)
Bob.incInventory(LurkerAmmo, 50); // give him 30 ammo it's ok. (No sound)
Bob.setImageTrigger(0,1); // shoot once (if I shoot four time and then give him ammo fill four bullet). (No sound)
 
// 3.6.3
Bob.setMoveDestination(Dirk); // don't work
Bob.setMoveDestination(Dirk.getPosition()); // fine
Bob.setMoveDestination(Dirk.getTransform()); // fine
Bob.mountImage(LurkerWeaponImage, 0); // Ok (With sound)
Bob.incInventory(LurkerAmmo, 50); // give him 30 ammo it's ok. (With sound)
Bob.setImageTrigger(0,1); // fine - Rapid fire (With sound)
Bob.setImageTrigger(0,0); // fine - Stop fire
Link to comment
Share on other sites

Hi,


I'm doing this tutorial https://www.garagegames.com/community/resources/view/21604


I already do the second part, but I have a doubt, this:

Now we need a "navPath" to use "theNavMesh" and for or Ai to run down. Again this is under (library -> level -> navigation) and you want to call this object "navPath1". In it's "mesh" field enter "theNavMesh" so it's linked to our navMesh.

the navPath that refer the tutorial is this, right?

 

navPath.JPG.e14c280b0d9785d1772ad873ba428cc0.JPG

BTW, I don't see a error in the console, but the Bot1 go to the corner far in the terrain, see my reply above. :o


What this mean? I copy and paste the script from Steve. :?

Link to comment
Share on other sites

Bob.setMoveDestination(Dirk);

Should be

Bob.setMoveDestination(Dirk.getPosition());

I think. EDIT: oops, didn't see page 2.


But that other stuff sounds worrying. This is the first thing that comes to mind. Will investigate.


As for the Chinatown deathmatch code, it uses an old version of the Recast/navPath code. The new version works differently, so you'll have to modify his code. The old code looked something like this:

for(%i = 0; %i < %path.getCount(); %i++) {
   %obj = %path.getObject(%i);
   %pos = %obj.getPosition();
}

You now use:

for(%i = 0; %i < %path.size(); %i++) {
   %pos = %path.getNode(%i);
}
Link to comment
Share on other sites

Hi Daniel,


I saw the tutorial videos from walkabout a few weeks back, but don't know how to mix AIPlayer with walkabout...I will go to read the documentation, thanks I miss this link "WalkaboutDocumentation.html".

 

What are you trying to do?

 

Become familiar with AI on T3D. If you have some relevant info about this I really appreciate it.


Right now I want my "Bob.Bot" go from A to B without collide with walls. :)

Link to comment
Share on other sites

Thanks that was looking for...


I have another question sorry. I already read this

https://eightyeight.github.io/walkabout/Documentation/WalkaboutUserManual.html#scripting-navpath


From the Steve tutorial

Now we need a "navPath" to use "theNavMesh" and for or Ai to run down. Again this is under (library -> level -> navigation) and you want to call this object "navPath1". In it's "mesh" field enter "theNavMesh" so it's linked to our navMesh.

 

coverPoint.jpg.14713dd0358f7fdf6fcc43499fc18580.jpg

 

But in navigation folder only have Cover Point. How I can create a NavPath? :?


the question is: walkabout have a object "graphically" for add a path? like cover point?

:?: :?: :?: :?:

Link to comment
Share on other sites

@buckmaster sorry to ask again :roll: navPath object don't exist on 3.7rc, I already have an AI Player going to a waypoint to another using specific position, but how can I use navPath?


how can I use it? I trying using script but don't work for me.


I use this example

 

%path = new NavPath() {
   mesh = "Nav";
   from = "0 1 0";
   to = "0 10 0";
};
// Path now goes from (0, 1, 0) to (0, 10, 0)
 
// Change the destination!
%path.to = "10 0 0";
// And replan
%path.plan();
Link to comment
Share on other sites

Oh dear. That should work. Sorry for not getting back to you about the editor. I think at some point I removed the nav-specific object classes from the editor, though it appears cover point is back. Though I should probably stick navpath back as well.


That script breaking is concerning. Any errors in the console at all?

Link to comment
Share on other sites

Sorry for not getting back to you about the editor.

 

Don't worry mate... Well sorry I was a little confused because some tutorials around walkabout always says add from gui. No error on the console. I will do more test with navPath, maybe it's me, not using it the way it should.


by the way, I already have a bot running around walls from a waypoint to other :lol: so thank you for all the help. (setPathDestination)


EDIT:


I'm doing all wrong? I do this...

==>new NavPath(myPath) { mesh = "MissionGroup\theNavMesh"; from = "94.79 156.83 512.75"; to = "119.9 115.4 512.9"; };
5724
==>myPath.from
94.79 156.83 512.75
==>myPath.to
119.9 115.4 512.9
==>myPath.plan();
0

 

==>new AIPlayer(Bob) { datablock = "DefaultPlayerData"; position = LocalClientConnection.camera.getPosition(); };
5725

 

Here nothing...

==>Bob.followNavPath("myPath");
==>5725.followNavPath("myPath");
==>Bob.followNavPath(myPath);
==>5725.followNavPath(myPath);

 

==>myPath.size();
0
==>myPath.getNode(0);
0 0 0
==>myPath.getNode(1);
0 0 0
==>myPath.getLength();
0
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...