Skip to content

experimental patches for online coop#986

Open
Himanshu-01 wants to merge 2 commits intopnill:development-newfrom
Himanshu-01:sync-3
Open

experimental patches for online coop#986
Himanshu-01 wants to merge 2 commits intopnill:development-newfrom
Himanshu-01:sync-3

Conversation

@Himanshu-01
Copy link
Contributor

  • Can go ingame from coop lobby but has few bugs to be fixed (bsp/checkpoints - requires simulation_queue encoding/decoding)
  • game will also desync randomly if it feels like it, <OUT OF SYNC, random seed differs> , something to do with weapons and projectiles , to be further investigated
image image

@Berthalamew Berthalamew self-requested a review February 19, 2026 22:53

/* private code */

void __cdecl player_action_encode(c_bitstream* packet, struct player_action* action)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 4 functions here aren't private, they're publicly accessible in simulation_encoding.h

}


void __cdecl synchronous_update_encode(c_bitstream* packet, struct simulation_update* update)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name for this is simulation_update_encode


int8 player_index = 0;
player_action* action = update->player_actions;
do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for loop here

packet->write_bool("flush-gamestate", update->flush_gamestate);
packet->write_integer("verify-game-time", update->game_time_ticks, SIZEOF_BITS(update->game_time_ticks));
packet->write_integer("verify-random", update->random_seed, SIZEOF_BITS(update->random_seed));

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get encoded size here and include fatal network event for update

else
{
int32 update_itr = 0;
if (player_update_count > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for loop here instead of the if followed by do while loop


int8 player_index = 0;
player_action* action = update->player_actions;
do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for loop here

@@ -16,5 +18,7 @@ struct simulation_machine_update
/* prototypes */

void __cdecl simulation_player_update_encode(c_bitstream* packet, const simulation_player_update* player_update);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

place struct before simulation_player_update in both function prototypes here so we can get rid of #include "simulation_players.h"


/* structures */

struct simulation_update;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the forward declaration here

WriteValue(Memory::GetAddress(0x41F6B1), 0);
}

if (options
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a comment before this explaining why we're calling the function here

if (!game_is_playback() && simulation_reset_in_progress())// // make sure simulation is still in resetting
{
sim_globals->world->send_player_acknowledgements(true);
if (sim_globals->world->exists() && !sim_globals->world->is_authority())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be an assert here to make sure simulation_globals.simulation_reset_in_progress is true. Should we leave the conditions as is and include the assert or is there some other code that's calling this that shouldn't be?


// increase the network heap size
WriteValue<int32>(Memory::GetAddress(0x1ACCC8, 0x1ACE96) + 6, k_network_heap_size);
WriteValue<int32>(Memory::GetAddress(0x1ACCE0) + 6, k_network_heap_size); //increase network heap for campaign
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should fix the function call at 0x1ACCB7 and make it use map_memory_configuration_is_campaign_offline rather than map_memory_configuration_is_campaign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants