yvanvds
Member
|
Opinion welcome about object selection messages
A more generic question about network communication.
I have gameworld with multiple avatars running around and a lot of objects that can be dragged around and selected. I want every client to know which objects are selected and by whom. For peers, this is not much of a problem, since I send a selection message to peers and to the server. The server also informs players without a direct connection to the selecting player, but within 50m of the selected object. But suppose a player selects an object for a while, and after that a far away player comes closer. He would have missed the selection message. I thought of two solutions, but neither of them seem perfect.
1. Have the server send the selection message to all clients within the same world. But with a lot of players, constantly selecting and deselecting objects in a big world, this could cause a lot of traffic, most of it unneeded.
2. Constantly iterate trough all object positions on the server, compare them with clients positions, keep track of which clients already got the selection message for each object they come close to and send one if needed.
The second solution causes less traffic, but It could become a large load on the server if there's lets say 40 clients and a few hundred objects. And I'd like it to scale to a few hundred players, thousands of objects and a much bigger world. (I'm not sure if I'll ever find so many people wanting to play this game, but it would be a stupid limitation :-)
Has any of you come across a similar problem? And if so, what do you suggest?
Thanks for your time,
yvan
3. After a short walk, I came up with this: resend the selection message to peers that gain a direct connection. If I combine that with automatic deselection of an object when the selecting player goes out of a range of 40m, the new peer would be at least 24m away from the object before he'll get informed of the selection.
Walks are good :-) Still interested in other ideas though.
(This post was last modified: 03-10-2011 12:14 AM by yvanvds.)
|
|
03-09-2011 11:54 PM |
|
rndbit
Member
|
RE: Opinion welcome about object selection messages
server knows which player selected which. so say i am player P1, i run happily and player P2 comes into my range. Obviously server would send information about P2 to P1 (info like what P2 looks like, what it is wearing etc..). That packet could contain info about target. Now to make this more efficient server should keep players divided into containers. Container should have players of certain region in the world. So when moving you should iterate through players that are in same or close regions, not players somewhere in far far away place.
|
|
03-19-2011 08:23 PM |
|