Need help with net update code
by Bill Vee · in Torque 3D Beginner · 10/19/2012 (7:40 am) · 4 replies
What I have is a gamebase derived object that contains some data that is mostly kept on the server side object and the client side objects only need a small portion of the server side data at any given time.
The client side objects also will need different portions of this data ,
Example ...
Client1 needs data 1 thru 3 and client2 needs 2 thru 7. And client1 may need 5 thru 7 later and client2 may need 1 thru 10 later as well.
I may be over simplifying it but that is it in a nut shell.
The reason I can't send all the clients all the data is for 3 reasons.
1 The data in question can be a very large amount over all.
2 The data may change after it has been sent and will need to be updated.
3 Because of 1 and 2 if I tried to send all the data every time it is changed to all the clients it will consume all the bandwidth and bring the clients and server to a crawl.
I know about packUpdate and unpackUpdate and how they work.
I have tried sending as much data as the server object has when a client joins then sending the updated data as it is updated but that ends up going to all the clients and wasting bandwidth.
I can't figure out how to send separate clients different data from the same object on demand.
The client side objects also will need different portions of this data ,
Example ...
Client1 needs data 1 thru 3 and client2 needs 2 thru 7. And client1 may need 5 thru 7 later and client2 may need 1 thru 10 later as well.
I may be over simplifying it but that is it in a nut shell.
The reason I can't send all the clients all the data is for 3 reasons.
1 The data in question can be a very large amount over all.
2 The data may change after it has been sent and will need to be updated.
3 Because of 1 and 2 if I tried to send all the data every time it is changed to all the clients it will consume all the bandwidth and bring the clients and server to a crawl.
I know about packUpdate and unpackUpdate and how they work.
I have tried sending as much data as the server object has when a client joins then sending the updated data as it is updated but that ends up going to all the clients and wasting bandwidth.
I can't figure out how to send separate clients different data from the same object on demand.
#2
I already use one for the same class that returns data from a second thread I use to crunch the data in question.
What I am unclear on is how do I tell the client object to "subscribe" to a NetEvent that acts on the server objects data.
Or do I have both the client and server objects "subscribe" to the NetEvent object?
And if so is there an example you could point me too of this?
10/19/2012 (12:46 pm)
I have looked at NetEvent but I am unsure how to use it in this case.I already use one for the same class that returns data from a second thread I use to crunch the data in question.
What I am unclear on is how do I tell the client object to "subscribe" to a NetEvent that acts on the server objects data.
Or do I have both the client and server objects "subscribe" to the NetEvent object?
And if so is there an example you could point me too of this?
#3
10/26/2012 (9:38 am)
If it is a lot of data, putting it in a netevent might not resolve it. It might reduce the traffic to all clients, but it still needs to send the data and it is sending it from the T3D application. so while it is sending, the cpu is under load thus slowing it down. I haven't looked lately, but I'm not sure how well threaded this section of code is.
#4
About 1k of data per chunk uncompressed. With compression it's between 11 and 350 bytes.
I have a pretty good working model of this right now and it appears to be working out very well.
10/26/2012 (10:15 am)
@Vince - It is surprisingly not a lot of data to be sent.About 1k of data per chunk uncompressed. With compression it's between 11 and 350 bytes.
I have a pretty good working model of this right now and it appears to be working out very well.
Torque Owner Guy Allard
Default Studio Name