Myconnectindex: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Mblackwell (talk | contribs)
mNo edit summary
 
Fox (talk | contribs)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
myconnectindex is a constantly updated [[gamevar]] used to determine the order in which players have connected to a game. This is useful for player manipulation in multiplayer, and player manipulation outside of the player [[actor]].
myconnectindex is a [[gamevar]] which hold the ID of the player using the local computer in a multiplayer game. In single-player it's always zero.


The current version of the network code does not properly keep track of the myconnectindex between players and update their properties accordingly, so any player properties changed outside of the player code this way <i>may</i> cause sync issues, requiring a workaround. Future versions of the network code should address or eliminate this issue.
It is of little actual use in con (despite the impressions of some mod authors who misunderstand dukes netplay). In singleplayer it will always be fixed at the first player index. In multiplayer actor code it will cause different results on different computers which will almost certainly cause some form of [[desync]]. In display code [[screenpeek]] should be used instead to allow viewing of others screens in coop.
 
Initially player indexes go from 0 to [[numplayers]]-1 however they do not change when a player quits so you will end up with non continuous indexes.
 
[[Category:Constantly updated gamevars]]

Latest revision as of 17:49, 17 August 2020

myconnectindex is a gamevar which hold the ID of the player using the local computer in a multiplayer game. In single-player it's always zero.

It is of little actual use in con (despite the impressions of some mod authors who misunderstand dukes netplay). In singleplayer it will always be fixed at the first player index. In multiplayer actor code it will cause different results on different computers which will almost certainly cause some form of desync. In display code screenpeek should be used instead to allow viewing of others screens in coop.

Initially player indexes go from 0 to numplayers-1 however they do not change when a player quits so you will end up with non continuous indexes.