More progress. Host can now see the client that has joined. Host reacts to networked messages.

This commit is contained in:
2025-12-16 10:51:06 +01:00
parent 996b1a3404
commit 4ea71838b9
8 changed files with 366 additions and 19 deletions

View File

@@ -77,7 +77,7 @@ static void state_tick(Presentation_State *state) {
if(game_instance_pop_local_input(instance, &input)) {
// TODO: SS - We should probably check if this input is invalid for the snake. (pressing "go right" when going left, for example.)
// If it is invalid, the next input in the queue should be tried.
game_session_set_player_input(session, instance->local_player_index, input);
game_session_set_player_input(session, instance->local_player_id, input);
}
game_session_tick(session);
@@ -299,7 +299,7 @@ static void state_render(Presentation_State *state) {
sim_world->game_world->seed,
sim_world->game_world->grid.width, sim_world->game_world->grid.height,
session->settings.tickrate,
instance->local_player_index, instance->local_player_index == 0 ? "true" : "false", // NOTE: SS - You're the host if you're player 0.
instance->local_player_id, instance->local_player_id == 0 ? "true" : "false", // NOTE: SS - You're the host if you're player 0.
game_session_get_amount_of_active_players(session), sim_world->max_players
);