So I’m not 100% sure on this, thought I would ask everyone’s opinion.
The client connection takes a single Scene to receive the replication. On a server where this scene can be anything from a lobby to a map, what’s the best way to handle client-specific logic?
My thought here is to have an attribute on the Scene that tells us the scene type, then the client could read the attribute and assign components to the scene based off its type.
Another idea is to assign “shell” components to the scene that do nothing on the server. Then on the client I register the same components with the full logic. This means that the components act more like an interface on the server, and the client is just filling out the interface. Would this work properly?
Currently I’m handling this by using certain “reserved names” to filter out desired scenes. I like the second idea better because it means less overhead in the client logic (no need to have a special subsystem to handle “loading” local components), but the first may be simpler to implement.
Edit: So I’ve went with the second idea and the concept seems to be working. I defined a LobbyComponent in my server and the same component in my client. Both have their own independent logic. However I’m a bit puzzled about how information is transferred, I thought the attributes were used to transfer data across. I’ve defined the following line in both client/server components:
I also populated it with some sample data. When I debug the server, it shows the proper elements listed. However the client doesn’t appear to be getting the data. If I debug the client, it shows the 1 attribute listed with its proper name. However no data regarding this attribute seems to be propogating from server to client, even if I mark the network update on the server afterwards. On my client, I’m checking this with:
[code]Urho3D::VariantVector vec = this->GetAttribute(“Rooms”).GetVariantVector();
Urho3D::VariantVector vec2 = this->GetAttribute(0).GetVariantVector();
for (Urho3D::VariantVector::Iterator itr = _rooms.Begin(); itr != _rooms.End(); itr++)[/code]
Yet all 3 show 0 elements. Is this the intended behavior or am I missing something?