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.

docs: changelog for the command bar and state object frame savings

Olcay Seygan104ccd333966
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a5ac2a9bf..74a5ecade 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ found and fixed — EA's own, not port damage.**
- The new renderer stopped redoing work between two pieces of ground that look the same. The map's terrain goes out as hundreds of tiles a frame under the same camera and the same settings, and for every tile the game worked the camera's arithmetic out again, rebuilt its description of the surface and of each texture's filtering, and compared the lot with the tile before. It now notices nothing was changed and goes straight to drawing. The fog of war is sent to the card only where it moved since the last frame, instead of all of it every frame. Two brutal computer players on Twilight Flame at 1920x1080 went from 2.46ms a frame to 2.24ms, and every picture is the one it was.
- The command bar and the observer's panel stopped reading their own pages from scratch every frame. The bar's page alone is 38 KB, and the game copied it, lowercased it and hunted through it for the blanks four times a frame before it wrote in a single number. Each page is read once now, and a frame only fills in the numbers. The same two computer players on Twilight Flame went from 2.03ms a frame to 1.84ms watched as an observer, and from 2.75ms to 2.50ms from a player's seat. Every page still comes out letter for letter as it did: two matches filled 270,000 of them both ways and found no difference.
- Ground painted with a third texture, the dirt over grass and the rock over sand, cost a trip to the memory manager for every corner of every such patch on screen, every frame, only to light that corner. Nearly a tenth of the game's time went to taking and releasing the memory manager's lock for it. Lighting a corner asks for nothing now: the same Twilight Flame match went from 1.88ms a frame to 1.71ms as an observer and from 2.56ms to 2.26ms from a player's seat, and eight views over five maps came out the same as before.
+- The command bar stopped throwing its own layout away every frame. The few hundred positions and sizes it hands its page were written into a fresh list each frame, copied twice for the frames in front of the buttons, and thrown out, and every price and build time on a button was looked up by copying the text of every figure the bar was already showing. The list is written over in place now, nothing is copied, and the graphics card settings that did not change between two draws are not looked up again. The same Twilight Flame match from a player's seat went from 2.29ms a frame to 1.96ms, and as an observer from 1.64ms to 1.58ms. The picture is the same one.
- Raise the particle limit as far as you like and every puff gets drawn. Past about sixteen thousand smoke and fire sprites on screen the game quietly stopped drawing the rest: a test with 68,000 of them showed barely a fifth. A test with 101,000 now draws all of them at 8.3ms a frame, and in 1,200 frames not one fell below 60 a second. The first version that drew them all took 22.4ms; the rest came from sorting and copying them far less and from sharing the work across every core of the processor.
- Big fights no longer drag the picture down into the twenties. Every moving tank and soldier, and every puff of smoke, goes to the graphics card through one shared scratch area, and it was so small that a big fight on Bombardment Beach filled it about fifty times a frame. Each refill made the processor wait for the card, 8 to 12ms of every frame, while the card sat two thirds idle. The area is made full size once now and refills about seven times a frame, in 0.02ms. The same 16,000-frame battle, fast-forwarded, finishes in 226 seconds where it took between 263 and 325, and the seconds that fell under 50 frames a second went from 125 or more to 4.
- Every animation runs on a clock instead of counting frames.