Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gamenetwork): mark the slowest player only below the match's speed

Olcay Seygan33bb33a0f8cf
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 665dda891..aebcde5bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1302,7 +1302,7 @@ A third pass went through the generals' powers, promotions and unit abilities.
## Tab: who is in the match, and money for an ally
- Tab opens EA's diplomacy screen, as it did in 2003: every player with his general, team and status, and the button that mutes him in chat. The scoreboard that held Tab for a while left with the old interface.
-- In a LAN or online match the list shows each player's ping and frame rate, updated twice a second, on every machine. The slowest player's numbers are yellow: the whole match runs at his speed, so when the game drags you can see whose machine or line is holding it back.
+- In a LAN or online match the list shows each player's ping and frame rate, updated twice a second, on every machine. When the slowest player falls more than a tenth under the match's speed his numbers turn yellow: the whole match runs at his speed, so when the game drags you can see whose machine or line is holding it back. A room where everyone keeps up shows no yellow at all.
- The list has a money column now. Each ally still in the match gets a minus button, the amount, a plus button and Send. The mouse wheel over a row moves its amount by $100; hold Ctrl for $1,000, Shift for $10,000, both for $100,000. The buttons step the same way, and the amount never goes past what you hold.
- Send hands the money straight over. You read "You sent $5000 to Alice." in the feed, Alice reads "Bob sent you $5000.", and both hear the cash sound. A player gone from the match, or one who is only watching, gets no row to send to.
- Every machine checks the transfer the same way, so it works on LAN, against the computer in a skirmish, and plays back in a replay. A doctored request for more than the sender has moves only what he has, and nobody's bank goes below zero.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h
index d951d47b0..932293fc2 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/NetworkInterface.h
@@ -111,7 +111,7 @@ public:
virtual Int getAverageFPS() = 0;
virtual Int getSlotAverageFPS(Int slot) = 0;
virtual Real getSlotAverageLatency(Int slot) = 0; ///< seconds, round trip to the packet router
- virtual Int getSlowestSlot( void ) = 0; ///< the slot setting the room's speed, or -1
+ virtual Int getSlowestSlot( void ) = 0; ///< the slot holding the room under the match's speed, or -1
virtual void attachTransport(Transport *transport) = 0;
virtual void initTransport() = 0;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp
index 6d9cc70fb..455fe93a8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/ConnectionManager.cpp
@@ -2484,11 +2484,17 @@ Real ConnectionManager::getSlotAverageLatency(Int slot) {
return m_latencyAverages[slot];
}
-/// the player whose frame rate sets the room's speed, as the packet router picks him, or -1
+/// the player whose frame rate sets the room's speed, as the packet router picks him, or -1 when
+/// he keeps up with the match anyway
Int ConnectionManager::getSlowestSlot( void ) {
Int minFps;
Int minFpsPlayer;
getMinimumFps(minFps, minFpsPlayer);
+ // nobody is holding the room back while everyone keeps within 10 % of the match's speed; a frame
+ // or two of jitter under the cap would otherwise light a different player every half second
+ if (minFps * 10 >= getMatchFps() * 9) {
+ return -1;
+ }
return minFpsPlayer;
}