bool physx_client::tick() {
if (!repstate.is_connected()) {
fprintf(stderr, "Disconnected from server so terminating client\n");
// process all the messages that arrived since last update
while (void *msg = repstate.tick(&msg_size)) {
process_packet(msg, msg_size);
void physx_client::process_packet(uint64_t id, void *message_data, size_t count) {
auto demarshaller = aether::trivial_marshalling<trivial_marshalling_traits>()
// use the marshaling utilities from aether to decode the network packet
const auto ret = demarshaller.decode(message_data, count);
assert(ret == 0 && "Failed to decode packet from simulation");
const auto headers = demarshaller.get_worker_data();
for(const auto &[id, header] : headers) {
// process cell headers, each cell is a single worker
const auto message_entities = demarshaller.get_entities();
for(const auto &entity : message_entities) {
protocol::base::net_decode_position_3f(entity.net_encoded_position);
point.p = { position.x, position.y, position.z };
// process entity updates received from the server
// in this case we update the cache in the physx client