AI Move Ends-> rotate to Goal Object ?
by Steve Acaster · in Torque 3D Professional · 06/16/2010 (4:24 pm) · 18 replies
I was going to list this as a bug ... but I think it's my memory that is buggy ...
I was hoping that calling getTransform on the destination object would align the Ai to that rotation when they had finished their move.
eg:
This would align %myBot to face the same rotation as %theGoal at the end of the Ai's move.
But it doesn't, and I dug out my old TGE demo and it doesn't there either ... so, so much for memory. :P
Now, calling setTranform() on the player at the end of the move would just instantly align them in a "piff paff poof" sort of manner, and I was rather hoping for them to actually turn to face the direction than being mystically teleported to it ...
[edit]
I suppose using some sort of getForwardVector/setAimLocation would do it ...
I was hoping that calling getTransform on the destination object would align the Ai to that rotation when they had finished their move.
eg:
%myBot.setMoveDestination(%theGoal.getTransform());
This would align %myBot to face the same rotation as %theGoal at the end of the Ai's move.
But it doesn't, and I dug out my old TGE demo and it doesn't there either ... so, so much for memory. :P
Now, calling setTranform() on the player at the end of the move would just instantly align them in a "piff paff poof" sort of manner, and I was rather hoping for them to actually turn to face the direction than being mystically teleported to it ...
[edit]
I suppose using some sort of getForwardVector/setAimLocation would do it ...
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#2
I was actually more after setting the rotation of the Ai to the node after they had stopped - rather than the player's movement vector.
I came up with the idea of giving my destination nodes a target so once the Ai has stopped they have something to aim at that is roughly in the node's forwardVector ... eg: Ai approaches node from the side, then turns to aim at the node's forward-facing target.
Don't know why I didn't think of that last night (sun+beer+WorldCup=answer), as I've got my AI's final destination nodes sending various other information to them on arrival.
Seeing a blue sky with a big orange ball in it, up here in Northern England, sent my brain a little haywire ... ;o)
06/17/2010 (5:05 am)
Thanks Tobias,I was actually more after setting the rotation of the Ai to the node after they had stopped - rather than the player's movement vector.
I came up with the idea of giving my destination nodes a target so once the Ai has stopped they have something to aim at that is roughly in the node's forwardVector ... eg: Ai approaches node from the side, then turns to aim at the node's forward-facing target.
%this.setAimLocation(%goal.aimObject.getPosition());
Don't know why I didn't think of that last night (sun+beer+WorldCup=answer), as I've got my AI's final destination nodes sending various other information to them on arrival.
Seeing a blue sky with a big orange ball in it, up here in Northern England, sent my brain a little haywire ... ;o)
#3
sounds like you had another intention, but I understand now.
Seems like others had the same thinking problem (beer+worldcup=answer). But you have solved your problem now, right?
Keep an eye on your bed to hear a snoring noise... ;-)
Looks like we won´t have an orange ball here in Germany today! The Britains took it with them on the move... ;-)
Another question, maybe you can help, because you´re playing with AIPlayers. I tried to start an AIPlayer from the tutorial in a network game, but I always get the error message, that no AIPlayer is avaiable on client and on the server? Obviously this tutorial is only for singleplayer games, isn´t it?
Thanks in advance,
kind regards
Tobias
06/21/2010 (3:40 am)
Hi Steve,sounds like you had another intention, but I understand now.
Seems like others had the same thinking problem (beer+worldcup=answer). But you have solved your problem now, right?
Keep an eye on your bed to hear a snoring noise... ;-)
Looks like we won´t have an orange ball here in Germany today! The Britains took it with them on the move... ;-)
Another question, maybe you can help, because you´re playing with AIPlayers. I tried to start an AIPlayer from the tutorial in a network game, but I always get the error message, that no AIPlayer is avaiable on client and on the server? Obviously this tutorial is only for singleplayer games, isn´t it?
Thanks in advance,
kind regards
Tobias
#4
An orange ball??? You must be talking about the Dutch team ;P
Sorry guys, just couldn't let this go.
06/21/2010 (3:47 am)
@both:An orange ball??? You must be talking about the Dutch team ;P
Sorry guys, just couldn't let this go.
#5
lol :)
@Tobias
Funny ... even "singleplayer" in Torque is a network ...
I'm not very "up" on networking in general - but I've had AI working on a server on the same computer.
Do you have a link to this AiPlayer tutorial?
06/21/2010 (6:21 am)
@Richardlol :)
@Tobias
Funny ... even "singleplayer" in Torque is a network ...
I'm not very "up" on networking in general - but I've had AI working on a server on the same computer.
Do you have a link to this AiPlayer tutorial?
#6
rotfl
Living next to them it´s always a big fight, specially in football... ;-)
@Steve:
I used the following
RTS Prototype
I know that even in single player I have a client server, but on two PCs it doesn´t work. But I learnt a lot about the console system. ;-)
I tried to instanciate an AIPlayer next to an real player like described in Spawning enemy targets. But there I get the error message, that the defaultplayerdata datablock wasn´t found for AIPlayer. Ok, not the problem, so I worked through RootGroup.listObjects() on the Client to find out that in DatablockGroup.listObjects() nothing is defined. On the server instead I have all the datablocks defined.
Nevertheless I tried to generate an AIClient object on the client, with
I worked through all resources I found regarding AIClient, AIConnection, AIPlayer here in the forum. I figure out that I´m just making a small mistake.
Probably all the AI generation has to be done in script on the server. Hope that the bis orange ball will bring the answer... ;-)
//Edit:
I found the console function aiAddPlayer("Name"); which creates obviously an AI Client but the player is not visible and seems to exist on the client only without connection to the server! (otherwise it must have been connected via the GameConnection of the client)
Arrgh, found a resource AIClient deprecated to aiAddPlayer whereas in the second newer link a aiClient is used...
06/21/2010 (10:44 pm)
@Richard rotfl
Living next to them it´s always a big fight, specially in football... ;-)
@Steve:
I used the following
RTS Prototype
I know that even in single player I have a client server, but on two PCs it doesn´t work. But I learnt a lot about the console system. ;-)
I tried to instanciate an AIPlayer next to an real player like described in Spawning enemy targets. But there I get the error message, that the defaultplayerdata datablock wasn´t found for AIPlayer. Ok, not the problem, so I worked through RootGroup.listObjects() on the Client to find out that in DatablockGroup.listObjects() nothing is defined. On the server instead I have all the datablocks defined.
Nevertheless I tried to generate an AIClient object on the client, with
$aicl = new AIClient();which works until I say
$aicl.connect($ServerInfo::Address);This unconnects my present server connection, but doesn´t give any further commend on client or server. So I´m just a littlebit wired.
I worked through all resources I found regarding AIClient, AIConnection, AIPlayer here in the forum. I figure out that I´m just making a small mistake.
Probably all the AI generation has to be done in script on the server. Hope that the bis orange ball will bring the answer... ;-)
//Edit:
I found the console function aiAddPlayer("Name"); which creates obviously an AI Client but the player is not visible and seems to exist on the client only without connection to the server! (otherwise it must have been connected via the GameConnection of the client)
Arrgh, found a resource AIClient deprecated to aiAddPlayer whereas in the second newer link a aiClient is used...
#7
I'm baffled.
Though haven't I read that the RTS tut has ... issues ... with the code base having changed considerably since it was written?
06/22/2010 (6:11 am)
0_0I'm baffled.
Though haven't I read that the RTS tut has ... issues ... with the code base having changed considerably since it was written?
#8
But as said, I'm not in the client-server stuff, but the code in this UAIK scripts have helped me a lot.
06/22/2010 (6:45 am)
Don't know if this helps or works on a client-server system (cause I'm going for single player), but I use a the UAIK for my AI. In this kit there is a function which spawns an AI at an object. And if you read player instead of object this sounds to me like the thing Tobias is trying to accomplish.But as said, I'm not in the client-server stuff, but the code in this UAIK scripts have helped me a lot.
#9
According to Post in Poor Docs there will be an update for the RTS tutorial. So there might be a small chance, that the AI system documentation will get an update as well. ...Issues... nice word... *smile* *thumbup* I would say your´re right!
In my client/server setup with 2 independent machines there seems to be some changes in architecture.
I suspect that my client and an AIClient share one network connection with the server, to reduce the bandwith and connection count. Because the AIClient generated with aiAddPlayer hooks into the connection.
But I haven´t found out yet how to spawn an AI player in my game. On the client I get the error message "No Datablock found" and on the server I don´t have the aiAddPlayer function "Parse error!"
For my intention there must be a command to tell the server: "Spawn an AI Player on client" but I haven´t found it yet...
@Richard:
It seems not the problem to spawn AI Players on a singleplayer machine, but on client-server systems this seems to be slightly difficulter...
06/23/2010 (12:07 am)
@Steve:According to Post in Poor Docs there will be an update for the RTS tutorial. So there might be a small chance, that the AI system documentation will get an update as well. ...Issues... nice word... *smile* *thumbup* I would say your´re right!
In my client/server setup with 2 independent machines there seems to be some changes in architecture.
I suspect that my client and an AIClient share one network connection with the server, to reduce the bandwith and connection count. Because the AIClient generated with aiAddPlayer hooks into the connection.
But I haven´t found out yet how to spawn an AI player in my game. On the client I get the error message "No Datablock found" and on the server I don´t have the aiAddPlayer function "Parse error!"
For my intention there must be a command to tell the server: "Spawn an AI Player on client" but I haven´t found it yet...
@Richard:
It seems not the problem to spawn AI Players on a singleplayer machine, but on client-server systems this seems to be slightly difficulter...
#11
I learnt a very important thing again today! Sending Commands to Server and client. Thanks a lot!
Ok, no Problem to provide the message and generating the AIPlayer. But I suspected a second client on the server then, holding the AIPlayer and doing the Position Update, but it isn´t there! Also there is nothing showing up in the client screen.
Some things got clearly visible now!
06/23/2010 (3:34 am)
As I though already, just single-player. I learnt a very important thing again today! Sending Commands to Server and client. Thanks a lot!
Ok, no Problem to provide the message and generating the AIPlayer. But I suspected a second client on the server then, holding the AIPlayer and doing the Position Update, but it isn´t there! Also there is nothing showing up in the client screen.
Some things got clearly visible now!
#12
:)
06/23/2010 (6:08 am)
Actually I was just popping back here to say ... have you tried a server command?:)
#13
???:-/
I send a message to the server to create the AI player. Ok it seem´s that there has to be some more to do, like creating an AI Client which does the movement and runs in the back of the server then.
Or is there something other in your mind? ;-)
06/23/2010 (1:57 pm)
@Steve:???:-/
I send a message to the server to create the AI player. Ok it seem´s that there has to be some more to do, like creating an AI Client which does the movement and runs in the back of the server then.
Or is there something other in your mind? ;-)
#14
I've never really had a look at AiClient and AiConnection .... always just figured that those worked automatically ...
I only have the one "box" to work with ... and haven't branched out onto multiplayer yet...
My only thoughts could be that there are numerous reported issues with things working on a dedicated server that I've noticed bug reports coming in for ....
06/23/2010 (2:25 pm)
Something else on my mind ... something Deutschland shaped and happening at the weekend? ... no, not really ... ;o)I've never really had a look at AiClient and AiConnection .... always just figured that those worked automatically ...
I only have the one "box" to work with ... and haven't branched out onto multiplayer yet...
My only thoughts could be that there are numerous reported issues with things working on a dedicated server that I've noticed bug reports coming in for ....
#16
The calculation of the AI is done on the server then and the new position just send over to all clients connected to the server.
So no need for any further clients... Is the AIClient/-Connection obselete then?
06/24/2010 (3:22 am)
Ok, now I get a player on the screen. From code I believed the AI player would spawn in my player, but it spawns in the spawn point of the level. So the camera position of the client is obviously set up at connection, but not updated then. The calculation of the AI is done on the server then and the new position just send over to all clients connected to the server.
So no need for any further clients... Is the AIClient/-Connection obselete then?
#17
also FGE sample is a best sample for this class that usefull for me.
My email:moj.heidari@yahoo.com
11/13/2012 (4:14 pm)
I need AiFlyingvehicle class but not found.the download link for this class broken.anyone can help me and send to me this class?also FGE sample is a best sample for this class that usefull for me.
My email:moj.heidari@yahoo.com
#18
11/13/2012 (5:15 pm)
The RTS Tutorial works multiplayer - I tested it extensively that way, mainly trying to get move destination decals showing for the client but not for everyone (don't want to broadcast where you're sending troops, do you?).
Torque Owner Tobias B.
mercatronics
a fast look in the code: with moveDestination only the direction vector is set. Try out clearAim for the AI, this should set up the rotation towards the movement vector.
setTransform is a cool utility for teleporting... ;-)