mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 01:52:31 +00:00
Increase MP Command delay to 4 turns, decrease MP turns to 200ms.
To hide network latency, MP turns send commands not for the next turn but N turns after that (introduced inc684c211a2). Further, MP turn length was increased to 500ms compared to 200ms SP turns (introduced in6a15b78c98). Unfortunately, increasing MP turn length has negative consequences: - makes pathfinding/unit motion much worse & unit behaviour worse in general. - makes the game more 'lag-spikey', since computations are done less often, but thus then can take more time. This diff essentially reverts6a15b78c98, instead increasing COMMAND_DELAY from 2 to 4 in MP. This: - Reduces the 'inherent command lag' in MP from 1000ms to 800ms - Increases the lag range at which MP will run smoothtly from 500ms to 600ms - makes SP and MP turns behave identically again, removing the hindrances described above. As a side effect, single-player was not actually using COMMAND_DELAY, this is now done (can be used to simulate MP command lag). Refs #3752 Differential Revision: https://code.wildfiregames.com/D3275 This was SVN commit r25001.
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
extern CStrW g_UniqueLogPostfix;
|
||||
|
||||
CNetClientTurnManager::CNetClientTurnManager(CSimulation2& simulation, CNetClient& client, int clientId, IReplayLogger& replay)
|
||||
: CTurnManager(simulation, DEFAULT_TURN_LENGTH_MP, clientId, replay), m_NetClient(client)
|
||||
: CTurnManager(simulation, DEFAULT_TURN_LENGTH, COMMAND_DELAY_MP, clientId, replay), m_NetClient(client)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ void CNetClientTurnManager::PostCommand(JS::HandleValue data)
|
||||
NETCLIENTTURN_LOG("PostCommand()\n");
|
||||
|
||||
// Transmit command to server
|
||||
CSimulationMessage msg(m_Simulation2.GetScriptInterface(), m_ClientId, m_PlayerId, m_CurrentTurn + COMMAND_DELAY, data);
|
||||
CSimulationMessage msg(m_Simulation2.GetScriptInterface(), m_ClientId, m_PlayerId, m_CurrentTurn + m_CommandDelay, data);
|
||||
m_NetClient.SendMessage(&msg);
|
||||
|
||||
// Add to our local queue
|
||||
//AddCommand(m_ClientId, m_PlayerId, data, m_CurrentTurn + COMMAND_DELAY);
|
||||
//AddCommand(m_ClientId, m_PlayerId, data, m_CurrentTurn + m_CommandDelay);
|
||||
// TODO: we should do this when the server stops sending our commands back to us
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void CNetClientTurnManager::OnDestroyConnection()
|
||||
// Attempt to flush messages before leaving.
|
||||
// Notice the sending is not reliable and rarely makes it to the Server.
|
||||
if (m_NetClient.GetCurrState() == NCS_INGAME)
|
||||
NotifyFinishedOwnCommands(m_CurrentTurn + COMMAND_DELAY);
|
||||
NotifyFinishedOwnCommands(m_CurrentTurn + m_CommandDelay);
|
||||
}
|
||||
|
||||
void CNetClientTurnManager::OnSimulationMessage(CSimulationMessage* msg)
|
||||
|
||||
Reference in New Issue
Block a user