Logo Platform
Company of Heroes 3
Universe banner wording

John_RE

John_RE

10 days ago Apr 25,2024, 16:55:54 PM

1.6.5 Unit Responsiveness

Reply
4 220 Views
21 Comments


It’s hard to cover everything in our game that can influence input latency in a single patch note, so while the following may summarize a few key points, it is by no means the whole picture. With that said, the CoH3 engine operates on a variable-framerate-fixed-timestep-simulation model. This model gives our engine the stability and determinism of running a fixed framerate game state combined with the flexibility of rendering a variable framerate on-screen visual state. The components of this model can be broadly categorized into an input layer, a deterministic game state processor, and a visual state processor. When the player generates an input, it is registered in the input layer and processed through the deterministic game state. Once the new game state containing that input has been generated, it is released to the visual state processor to be interpolated up to 30, 60, 144fps or more. 


Let’s look at the changes coming in the 1.6.5 PC patch, and then we’ll go into specifics about what’s going on behind the scenes. 




With CoH2, the input layer, game state processor, and the visual state processor all run in a single synchronous CPU processing thread with each system taking its turn in rotation as required for a given processing cycle. This means that an input generated by the player could be immediately followed sequentially by an update to the game state, which in turn could be followed immediately by an update to the visual state. This order of events provided a tight processing flow for inputs that led to a high response rate that we still hope to match with CoH3 today. However, this approach also comes at the cost of visual smoothness. Since each system works in rotation, each one will incur a periodic CPU usage spike resulting in unstable framerates. Being limited to a single processing thread also means that we cannot utilize the processing power of stronger CPUs and as a result this approach does not often scale well to modern hardware. 


With CoH3, the deterministic game state processor and the visual state processor are each allocated their own CPU threads. This allows for a much higher and smoother throughput of frames but comes at the cost of having to synchronize data between these threads. Since these threads run independently, the order of events is not guaranteed to be as straightforward. As a result, an input may be left unattended until the game state processor thread is ready to service it. A common colloquialism used to describe this sort of latency is a ‘frame rule’ or ‘bus stop’ delay. If an input arrives just before the game state processor is ready to start processing a new game state, then its response is seen immediately. If it arrives just after processing has already started, then it “just missed the bus” and must wait an entire game state cycle before being processed. Another problem to consider is that the visual state processor cannot interpolate past the most recent game state. This means that if the game state (running asynchronously) takes too long, then the visual state must halt until the new game state is ready. This manifests on screen as a visual hitch or stutter in the game flow. To combat this, we employ a buffer of game states. If the game state (or network server for an online game) takes too long, we can subtly adjust the speed of interpolation for the remaining buffered states to seamlessly hide the visual stutter. 


What we found in this update was that the buffering algorithm for game states was acting far too conservatively towards game smoothness. And while this commonly produced impeccable visual clarity, it also did so at the cost of undue input latency. The changes introduced in this patch reduce the weighting on the buffer table regarding network latency and CPU load, which should result in a significant reduction in input latency. However, this may make the game more susceptible to network and CPU usage spikes, so some players may notice a drop in visual smoothness or other artifacts. We will be monitoring this change and be ready to adjust things further as needed. 


- The CoH3 Programmer Team 

Copied to clipboard!
10 days ago
Apr 25, 2024, 5:09:12 PM

With the turret of a tank it looks better. Inf it is difficult to see.

Updated 10 days ago.
0
10 days ago
Apr 25, 2024, 5:11:48 PM

Nice! Explained it very well, too. I can't wait to give it a spin!

0
10 days ago
Apr 25, 2024, 5:13:59 PM

I really appreciate whoever wrote this taking the time to describe what's happening under the hood in-depth. I think the vast majority of players will favor reduced input latency over visual smoothness if that's a trade we have to live with. The game feeling better and reading inputs sooner is way more important to moment to moment satisfaction. 

0
0
10 days ago
Apr 25, 2024, 5:46:03 PM

Thanks for the detailed explanation (and for working on one of the game's major issues)! I was curious if the "bus stop" method of receiving and then applying inputs can ever lead to orders for one unit being applied to another? 


For example, when inputting a reverse command on a vehicle, then selecting an infantry unit, can the inputs get mixed up and a reverse order end up being a retreat command on the infantry? I've heard players report this, though I've not experienced it myself, was curious if it was possible.

0
10 days ago
Apr 25, 2024, 5:56:20 PM

Will this fix the random non responsiveness to commands when trying to exit a building?


Thanks.

0
10 days ago
Apr 25, 2024, 5:57:38 PM
DanielD wrote:

Thanks for the detailed explanation (and for working on one of the game's major issues)! I was curious if the "bus stop" method of receiving and then applying inputs can ever lead to orders for one unit being applied to another? 


For example, when inputting a reverse command on a vehicle, then selecting an infantry unit, can the inputs get mixed up and a reverse order end up being a retreat command on the infantry? I've heard players report this, though I've not experienced it myself, was curious if it was possible.

The short answer is no. The delay applies to information sent from the input layer to the deterministic game state processor. When the input layer receives an input for a command, that command becomes associated with the selected unit. As a result, it is not possible for a command to be mis-issued to a different unit even if you select a different unit during the latency period.

0
10 days ago
Apr 25, 2024, 6:18:09 PM

Great explanation!

It's super interesting to get under the carpet of multi threading, this change alone should be huuuge in terms of enjoyment.
I hope the drawbacks won't be sever... also, darn infantry animation on the last clip xD
Please guys iron animations out, they keep doing weird stuff I hope you can stabilize this for good!

0
10 days ago
Apr 25, 2024, 6:35:46 PM

Thank you for the technical explanation.


From my experiences with multi-threaded game engine programming, I try to avoid CPU locks and synchronization primitives for reasons like this wherever possible. I'm in favor of lock-free programming utilizing lock-free queues especially in an ECS and job scheduling architecture, keeping render and input logic decoupled and stateless (i.e. lamdas).


21 frame delays (assuming 60fps) before input is manifested visually is wild, I'm glad it is reduced to ~10 frames and seems closer to a typical delay.

Updated 10 days ago.
0
10 days ago
Apr 25, 2024, 9:30:32 PM

These new behind the scenes devblogs are really cool. Keep them coming please!

0
10 days ago
Apr 25, 2024, 10:04:37 PM

I'm encouraged by the depth of the article. Please do not introduce bad frame pacing or stutters.

0
0
10 days ago
Apr 25, 2024, 10:27:28 PM

John_RE

John_RE wrote:
DanielD wrote:

Thanks for the detailed explanation (and for working on one of the game's major issues)! I was curious if the "bus stop" method of receiving and then applying inputs can ever lead to orders for one unit being applied to another? 


For example, when inputting a reverse command on a vehicle, then selecting an infantry unit, can the inputs get mixed up and a reverse order end up being a retreat command on the infantry? I've heard players report this, though I've not experienced it myself, was curious if it was possible.

The short answer is no. The delay applies to information sent from the input layer to the deterministic game state processor. When the input layer receives an input for a command, that command becomes associated with the selected unit. As a result, it is not possible for a command to be mis-issued to a different unit even if you select a different unit during the latency period.

Dear John_RE,

Does the team plan to work on animations and vehicle physics in one of the new major updates?

Most of all in Company Of Heroes I like to play tanks, that’s why it’s important to me how the equipment looks and works, I think there are a lot of such players.


and at the moment I don’t like that in the new Company Of Heroes 3, which is much newer and more modern, in CoH3 the animation and tank physics look much worse and more primitive than in CoH2.


Here are 2 videos that demonstrate the difference in the quality of tank animations:

Company Of Heroes 2 tank animation



Company Of Heroes 3 tank animation



firstly, in CoH3 compared to CoH2, many tanks have practically no animations and physics, and please also pay attention to how in CoH3 the tanks rotate and turn their turret sharply and unnaturally, they just jerk sharply to the side...
I think that after watching this video you will agree that in CoH3 the animations and physics of tanks (in particular the panther and tiger tanks) look much more primitive than in CoH2.


I am very grateful to you that the team continues to try and work on our any RTS strategy and improving the animation and physics of tanks in the game is my most anticipated update in the game.

I believe that the animations and physics of tanks should be at least at the CoH2 level.

Updated 10 days ago.
0
0
9 days ago
Apr 26, 2024, 1:49:49 PM

Are you guys have in mind how super weak the Wehr early state is right now?? Wehr sucks so bad in the early stages. 

Brit & USF has way better inf. + even more of them! And the recent buff to the Dingo AND Humber makes it even harder to survive anyhow. And those super big new maps in 4vs4 favors even more the blob roaming Allies, being able to flank easily. I tried so many different strategies. But if I am not lucky somehow, I lose 9/10 of the early fights.

I do think the entire Art, or techtree Wehr has to offer, is really bad. And should get reworked entirely!
Think about it.. Wehr Pios are super weak and have no dps at all. Grenadiers cannot compete with any other early inf. Allies has. Transferring? Too expensive
Talking about AT ? Or especially T2 tanks such as Marder or Stug are just front faced.. while Allies come along with Stuarts or Greyhounds, able to roam and shot 360°(and both are good vs inf as well). Even the Pak, also just front faced... Even the AT upgrade to the 221 Scout Car as well. Ok, you have Jägers, but going for them every single game is also tiering. Wher are things like the Puma?

 For example, swapping the 251 Medium Carrier with the 221 Scout Car would be a good idea. So you would be able have Jägers(both variants) with heal support, or

Panzergrenadiers with 221 mobile anti-tank cover. This would also slightly boost the arriving of the 221 and makes it more value having it a bit earlier, competing with dingo or the overwhelming allied Inf.

 I feel like there is a huge skill gap between Allies and Wehr. Especially Brits have an easy counter to everything to Wehr right from the start.

0
9 days ago
Apr 26, 2024, 4:33:31 PM

very cool explanation. Thank you very much!

0
8 days ago
Apr 27, 2024, 4:22:43 PM

so please remove instant accelerate of vehicle, it gives vehicle great advantage.

0
6 days ago
Apr 29, 2024, 5:43:19 AM

I've had a problem because of which I can't start the game for the 3rd day

John_RE wrote:
DanielD wrote:

Thanks for the detailed explanation (and for working on one of the game's major issues)! I was curious if the "bus stop" method of receiving and then applying inputs can ever lead to orders for one unit being applied to another? 


For example, when inputting a reverse command on a vehicle, then selecting an infantry unit, can the inputs get mixed up and a reverse order end up being a retreat command on the infantry? I've heard players report this, though I've not experienced it myself, was curious if it was possible.

The short answer is no. The delay applies to information sent from the input layer to the deterministic game state processor. When the input layer receives an input for a command, that command becomes associated with the selected unit. As a result, it is not possible for a command to be mis-issued to a different unit even if you select a different unit during the latency period.


0
6 days ago
Apr 29, 2024, 8:29:49 PM

Really appreciate the informative and relatively easy to understand post and excited for the big improvements to input delay!

0
6 days ago
Apr 29, 2024, 8:31:13 PM
RPSky-UA wrote:

John_RE

John_RE wrote:
DanielD wrote:

Thanks for the detailed explanation (and for working on one of the game's major issues)! I was curious if the "bus stop" method of receiving and then applying inputs can ever lead to orders for one unit being applied to another? 


For example, when inputting a reverse command on a vehicle, then selecting an infantry unit, can the inputs get mixed up and a reverse order end up being a retreat command on the infantry? I've heard players report this, though I've not experienced it myself, was curious if it was possible.

The short answer is no. The delay applies to information sent from the input layer to the deterministic game state processor. When the input layer receives an input for a command, that command becomes associated with the selected unit. As a result, it is not possible for a command to be mis-issued to a different unit even if you select a different unit during the latency period.

Dear John_RE,

Does the team plan to work on animations and vehicle physics in one of the new major updates?

Most of all in Company Of Heroes I like to play tanks, that’s why it’s important to me how the equipment looks and works, I think there are a lot of such players.


and at the moment I don’t like that in the new Company Of Heroes 3, which is much newer and more modern, in CoH3 the animation and tank physics look much worse and more primitive than in CoH2.


Here are 2 videos that demonstrate the difference in the quality of tank animations:

Company Of Heroes 2 tank animation



Company Of Heroes 3 tank animation



firstly, in CoH3 compared to CoH2, many tanks have practically no animations and physics, and please also pay attention to how in CoH3 the tanks rotate and turn their turret sharply and unnaturally, they just jerk sharply to the side...
I think that after watching this video you will agree that in CoH3 the animations and physics of tanks (in particular the panther and tiger tanks) look much more primitive than in CoH2.


I am very grateful to you that the team continues to try and work on our any RTS strategy and improving the animation and physics of tanks in the game is my most anticipated update in the game.

I believe that the animations and physics of tanks should be at least at the CoH2 level.

That's a really good comparison. It's a shame that these details were lost in CoH3 and I hope they address them in a future update. I think they've done a good job on the sound design though - sounds a lot more punchy now.

0
?

Click here to login

Reply
Comment
0