Closed adenflorian closed 4 years ago
I'm just going to write down some possible approaches to avoid the conflicts. IMO all of these are valid approaches, but no single approach should be used everywhere.
deltaTime
Since the fps mods just make the update loop run every "x" frame, we could calculate our own delta time where we need it so the time between updates is correct. Good for stuff like ECAM pages and smaller logic functions.
requestAnimationFrame()
directlyWe could just not hook into the main update loop and use our own. This would be viable for anything within the "core" files, but really shouldn't be used elsewhere.
The game contains various time simvars we could look at to detect the passage of time. This is really only appropriate for stuff that is based off of in-game time to begin with (such as the chronometer).
In the latest patch, Asobo implemented variable screen refresh rate. They achieve this the same way the original FPS mods did by forcing updates every X
frame. Here's what we currently know about this change:
deltaTime
has not been changed to account for this. Funny enough this could have been fixed by a single line change in the update loop code.High
= updates every frame.Medium
= updates (frameCount % 2) === 0
.Low
= updates (frameCount % 4) === 0
.CDU
and FCU
, Asobo introduced an AlwaysUpdate
flag (seen here), which forces the refresh rate to Quality.high
for that instrument. Funny enough Quality.high
is not the same High
as stated above. Quality.high
is the same as refresh rate medium
. It's unclear if this is intentional.a32nxcore
files should probably be moved. Perhaps attach it to the CDU? Even after we move the core files we will want to make them keep their own time in a similar way the AP code in the CDU does. This will be easy for the core files since we can just modify the core class to calculate the delta for each module. Things that use deltaTime
within the other instruments, though, is another problem. We will have to update all of those instances individually. I'm not sure what approach is best for each of those cases, though.
High
, Medium
, and Low
in the game settings actually correspond to ultra
, high
, and medium
in the BaseInsturment
code. Yay for confusing things.Considering there isn't much in the a32nx core anyway, I suggest that people stop implementing core logic into js.(low key been doing so from the start xD)
The apu code is already redone under elec wasm and will be shifted to engines shortly. So I think I'll send in a PR with the wasm src files( can have a look here ) and let the ones who did the implementation redo it as a wasm system or I'll do so after finishing elec circuit mapping.
Master tracking issue for things that get broken by FPS mods. Checked items have been identified and fixed.