lunedì 17 ottobre 2016

Day 179: Instantiation over network

Today I started by creating a better Address class, which extends and improves sockaddr_in.
Then I spent most of the afternoon implementing a system to instantiate objects over the network.
The Scene class now has a virtual function that gets called whenever a new message is received by a client not already registered. I'll probably make this function more general, as a "handle_server_message" function.
In the datagrams are included the ip and port of the sender in a compressed form, and they are stored in each network_object, along with a local id, to get a unique reference across the network.
In the picture the top right client starts to send a packet, and gets registered on the server.
The bottom left client then sends a message, and the message is forwarded to the first client, because it is registered. The scene then instantiate the gameobject in the handler function and adds to it a mesh and material.



Nessun commento:

Posta un commento