Need help with ambitious feature
by Justin Woods (ESAL) · in Torque Game Engine · 06/01/2006 (9:33 pm) · 11 replies
Recently I finished a project in TGE through alpha, and I was asked to join another team. This team is using the RTS starter kit for their project.
One of the main functions they want is to have simulation data output to the TGE (with the RTS kit if possible). The way this is designed is that we have a batch file containing the data. The data is then streamed to TGE as player data for a SINGLE RTS unit (in the form of continuous x,y,z coordinates). The engine should update the RTS unit's model location based on the constant data it is receiving from the simulation data.
The way that I envision this, which could be wrong, is that we could set up the engine to be a server showing graphical data. Then the batch file would be given the IP of the server, and it would connect. Once the connection was made, the game engine would treat it like multiplayer, and wouldn't treat the data any different than the data from a client being controlled by a human player.
Essentially I just want to have functionality for data-driven control of a unit in the world over a UDP protocol. I have a network programmer and myself. This is probably the most complex task I have on the entire project.
I must point out that though I am classically trained as a programmer, I am more of a scripter/designer these days. I am to be working with the data once the other programmer gets it into the engine. I am concerned with having it actually control a unit. That being said, I am not afraid to get into the engine, provided with some direction.
What I am asking is for some help, as I have been given a fairly unreasonable milestone date for this. Pointing me to resources, people that can help me, theories, anything. I know this sounds very complex, and it may well be, but I would like to believe that Torque already has a lot of what I need, and I just need to put it all together.
Hopefully you are all willing to help. I am willing to post resources for any of the results of this project, supposing it doesn't contain any of our proprietary data.
One of the main functions they want is to have simulation data output to the TGE (with the RTS kit if possible). The way this is designed is that we have a batch file containing the data. The data is then streamed to TGE as player data for a SINGLE RTS unit (in the form of continuous x,y,z coordinates). The engine should update the RTS unit's model location based on the constant data it is receiving from the simulation data.
The way that I envision this, which could be wrong, is that we could set up the engine to be a server showing graphical data. Then the batch file would be given the IP of the server, and it would connect. Once the connection was made, the game engine would treat it like multiplayer, and wouldn't treat the data any different than the data from a client being controlled by a human player.
Essentially I just want to have functionality for data-driven control of a unit in the world over a UDP protocol. I have a network programmer and myself. This is probably the most complex task I have on the entire project.
I must point out that though I am classically trained as a programmer, I am more of a scripter/designer these days. I am to be working with the data once the other programmer gets it into the engine. I am concerned with having it actually control a unit. That being said, I am not afraid to get into the engine, provided with some direction.
What I am asking is for some help, as I have been given a fairly unreasonable milestone date for this. Pointing me to resources, people that can help me, theories, anything. I know this sounds very complex, and it may well be, but I would like to believe that Torque already has a lot of what I need, and I just need to put it all together.
Hopefully you are all willing to help. I am willing to post resources for any of the results of this project, supposing it doesn't contain any of our proprietary data.
#2
06/01/2006 (10:03 pm)
Just time code the positional data, buffer about 20 seconds worth and carry on streaming.
#3
I'm more concerned with how I can use the data coming in to control my units. Like I said, I have a networking guy, and I'll pass your advice on to him, but from my perspective my part is very complicated.
06/01/2006 (10:32 pm)
@PaulI'm more concerned with how I can use the data coming in to control my units. Like I said, I have a networking guy, and I'll pass your advice on to him, but from my perspective my part is very complicated.
#4
Anyways all you have to do is receive the data from your net code and update their positions based on the timecode I mentioned.
eg heres some data for instance.
time = 0; x = 100; y = 200; z = 50;
time = 15; x = 105;y = 200; z = 50;
time = 18; x = 107; y = 200; z = 50;
time = 25; x = 112;y = 200; z = 50;
time = 37; x = 118; y = 200; z = 50;
time = 39; x = 122;y = 200; z = 50;
Now you know what time to move to their new positions.
06/01/2006 (11:17 pm)
You probably have the easy part, streaming aint that easy.Anyways all you have to do is receive the data from your net code and update their positions based on the timecode I mentioned.
eg heres some data for instance.
time = 0; x = 100; y = 200; z = 50;
time = 15; x = 105;y = 200; z = 50;
time = 18; x = 107; y = 200; z = 50;
time = 25; x = 112;y = 200; z = 50;
time = 37; x = 118; y = 200; z = 50;
time = 39; x = 122;y = 200; z = 50;
Now you know what time to move to their new positions.
#5
But then if you shot at him and he got hit and moved all the data after would be off.
06/01/2006 (11:33 pm)
Your probably better off recording keystrokes with timestamps.But then if you shot at him and he got hit and moved all the data after would be off.
#6
I no doubt have the easier part. That being said I haven't done anything with netcode integration in Torque before. I'm new to it, and I don't know what files or functions to even look at. However, your theory is of use to me. He will be sending data from his program in whatever format I choose.
As far as I can tell TGE accepts Eulers for movement and rotation, is this correct? I found this to be the case when digging in aiplayer.cs.
06/01/2006 (11:45 pm)
@ PaulI no doubt have the easier part. That being said I haven't done anything with netcode integration in Torque before. I'm new to it, and I don't know what files or functions to even look at. However, your theory is of use to me. He will be sending data from his program in whatever format I choose.
As far as I can tell TGE accepts Eulers for movement and rotation, is this correct? I found this to be the case when digging in aiplayer.cs.
#7
06/02/2006 (12:23 am)
I havent used aiplayer yet as am building webecam capture library so can't say.
#8
Does anyone else have anything they can provide me with?
06/02/2006 (12:33 am)
I'll keep my eye out for that.Does anyone else have anything they can provide me with?
#9
I would also suggest not posting the same issue multiple times on the forums, it muddies the water when someone (like you) need info and does a search and irks those that try to help around here. This is definitely a private SDK issue.
Good luck!
06/03/2006 (4:49 pm)
If I understand your problem correctly: my suggestion is to get familiar with the pack/unpackupdate functions (look in the player or vehicle classes) as these are used to communicate move data over the network. Also get a handle on the Move data structure and the updateMove function in the player/vehicle classes. I would do a search on TDN for these functions as a start. You may be best served under a tight deadline to subclass player and override functions and have your new player class read data streamed from disk/memory and simply send the moves as if it were it's own player meaning your simulation server will be running it's own full client. It is very possible for someone familiar with the networking code, but I don't envy you.I would also suggest not posting the same issue multiple times on the forums, it muddies the water when someone (like you) need info and does a search and irks those that try to help around here. This is definitely a private SDK issue.
Good luck!
#10
I still want to hear what anyone else has to say.
06/04/2006 (12:17 pm)
In retrospect I would not have posted twice. I sent a moderator request to delete the other but it is still around. Anyway, Jameson, that sounds very good and I'll look into it first thing on Monday.I still want to hear what anyone else has to say.
#11
I had trouble finding any information on the Move data structure and the updateMove function.
06/05/2006 (12:31 am)
Jameson,I had trouble finding any information on the Move data structure and the updateMove function.
Torque Owner Paul Griffiths
Step two: See how big it is and what sort of data.
Step Three: Wait until you have answer two.