new_netcode_contextmethod. This event is called when Connect starts to create a new instance of the netcode. Connect will create a new instance for each Connect thread.
generic_interest_policywhen it is created. This interest policy allows you to tell the netcode how frequently updates should be submitted for a particular entity to a particular client. The
genericinterestpolicycalculates these frequencies based on the distance between the client entity and all other entities, and compares this to the list of
ringsprovided during initialisation.
netcode_new_simulation_messagemethod. This allows the netcode to update its internal representation of the simulation state. When using the generic netcode this event is forwarded directly onto the generic netcode instance.
worker_idlets the netcode know which worker this update is received for, and what tick the worker was simulating when it sent the data. Using this the netcode can ensure a consistent view of the data for clients.
netcode_new_connectionmethod, allowing the netcode to initialise the connection to the client. This is a good moment to send any initial static data that the client will need to know about. When using the generic netcode this event is forwarded directly onto the generic netcode instance.
netcode_notify_writablemethod. The netcode responds by querying its representation of the simulation state and finding all entities that are near the client entity then sending out updates as appropriate.
netcode_drop_connectionmethod to allow the netcode instance to clean any state being held for this connection. When using the generic netcode, this event is forwarded directly onto the generic netcode instance.
per_entity_datatype to allow the netcode to indicate that an entity has moved out of range. When this happens, the entity is described as having been 'dropped'. To do this, we add a couple of methods to our protocol file.
is_entity_droppedto test if a particular entity has moved out of range.