player contexts in DPlay8
Ok, probably my last question in here for a while as this is the last thing that has me stumped.
I''m doing a client/server implementation first of all. The documentation (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dx8_c/directx_cpp/Play/Using/ContextValues/PlayerContextValue.asp) says that playercontexts are not used on the client end since the client only communicates with the server. If this is the case, do you then have to perform "time-consuming operations" to lookup the player object on the client?
I ask this because when the server updates the clients, I am currently sending a message for each entity that needs to be updated to all the clients. When the clients receive the update message, they go through and look for the corresponding entity on the client then update it. This is really slow. What is the best way to do it instead of hundreds of linear searches each frame?
When an entity is created on the client side, add that players ID(an ID that is sent from the server) into an array. When the server sends updates to the client it will send with it an ID that you can then check for in the array. When the client finds the corresponding index of the ID array you can use that same index for any other objects that you have put into an array upon entity creation.
Its plenty fast as well...short of having 10000000 entities that need to be updated. Trust me when i say that you will run into bandwidth problems waaaay before array speeds are an issue.
Hope this helps![](smile.gif)
Synth0id
Its plenty fast as well...short of having 10000000 entities that need to be updated. Trust me when i say that you will run into bandwidth problems waaaay before array speeds are an issue.
Hope this helps
![](smile.gif)
Synth0id
There is no point in doing anything at all, you'll die pretty soon anyway.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement