#include #include #include #include #include void deerith::update_players_characters() { auto view = get_entity_registry().view(); for (auto [entity, position_input, client, sync_coords] : view.each()) { glm::vec2 ps{}; if (position_input.position.read_synced(ps)) { sync_coords.position = ps; } else { sync_coords.position = sync_coords.position; } } } void deerith::send_entity_data() { packet_update_entities_coordinates_t sync_entities_coordinates; auto coordinates_view = get_entity_registry().view(); for (auto [entity, network_id, sync_coords] : coordinates_view.each()) { sync_entities_coordinates.entities_ids.push_back(network_id.network_id); sync_entities_coordinates.positions_to_update.push_back({}); sync_variable_transport_t &position_trasport = sync_entities_coordinates.positions_to_update.back(); position_trasport.load(sync_coords.position); } auto clients_view = get_entity_registry().view(); for (auto [entity, client] : clients_view.each()) { router_send_packet(sync_entities_coordinates, client.client); } }