MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiSendPositionalUpdates

Function MultiSendPositionalUpdates

Descent3/multi_server.cpp:1988–2154  ·  view source on GitHub ↗

Sends out positional updates based on clients pps

Source from the content-addressed store, hash-verified

1986extern int Multi_occluded;
1987// Sends out positional updates based on clients pps
1988void MultiSendPositionalUpdates(int to_slot) {
1989 uint8_t data[MAX_GAME_DATA_SIZE];
1990
1991 // Figure out if we should send positional updates to players
1992 for (int i = 0; i < MAX_PLAYERS; i++) {
1993 uint8_t send_position = 0, timer_popped = 0;
1994
1995 if ((Netgame.flags & NF_PEER_PEER) && i != Player_num)
1996 continue; // Don't send out other positions if in peer mode
1997
1998 // Don't send out position of the server in dedicated mode.
1999 if (Dedicated_server && (i == Player_num))
2000 continue;
2001
2002 // Don't send out position of dead players (ghosts) or observers
2003 if (Objects[Players[i].objnum].type != OBJ_PLAYER)
2004 continue;
2005
2006 if (i != Player_num)
2007 Multi_last_sent_time[to_slot][i] += Frametime;
2008
2009 if (i == to_slot)
2010 continue;
2011
2012 if (!(NetPlayers[i].flags & NPF_CONNECTED)) {
2013 Multi_visible_players[i] &= ~(1 << to_slot);
2014 Multi_visible_players[to_slot] &= ~(1 << i);
2015 continue;
2016 }
2017
2018 if (NetPlayers[i].sequence != NETSEQ_PLAYING) {
2019 Multi_visible_players[i] &= ~(1 << to_slot);
2020 Multi_visible_players[to_slot] &= ~(1 << i);
2021 continue;
2022 }
2023
2024 // Find out the player priority of this player in relation to the to_slot player
2025 float pps_check_time = NetPlayers[to_slot].pps;
2026
2027 /*if (pps_check_time>=8)
2028 {
2029 vector subvec=Objects[Players[i].objnum].pos-Objects[Players[to_slot].objnum].pos;
2030 float mag=vm_GetMagnitudeFast (&subvec);
2031 subvec/=mag;
2032
2033 float dp=vm_DotProduct (&subvec,&Objects[Players[to_slot].objnum].orient.fvec);
2034 dp=fabs(dp);
2035
2036 pps_check_time=((float)pps_check_time/2.0)+((dp*((float)pps_check_time/2.0))+(dp*.9));
2037 pps_check_time=std::clamp(pps_check_time,6.0,20.0);
2038
2039 int pps=pps_check_time;
2040 pps_check_time=pps;
2041 }*/
2042
2043 // Set the timer as popped if it actually did
2044 if (Multi_last_sent_time[to_slot][i] > (1.0 / pps_check_time))
2045 timer_popped = 1;

Callers 1

MultiDoServerFrameFunction · 0.85

Calls 6

BOA_IsVisibleFunction · 0.85
MultiStuffPositionFunction · 0.85
MultiStuffPlayerFireFunction · 0.85
MultiStuffGuidedInfoFunction · 0.85
nw_SendFunction · 0.85
nw_SendReliableFunction · 0.85

Tested by

no test coverage detected