Skip to content

More fine grained callbacks in WASM in MSFS2024, new documentation page #37

Description

@tigert

Logging this here so I wont forget - the MSFS 2024 sdk docs contain a new page:

https://docs.flightsimulator.com/msfs2024/flighting/programming-apis/wasm/update-callbacks/

In previous versions of the simulation, a frame would be split up in the following manner:

Image

So, during the “update” part, the simulation runs first, then any RPN, and then finally the WebAssembly is executed. However, the problem with this is that it can problematic for addons which manipulate cameras, physics, or systems, since the WASM occurs too late in the frmae, which can lead to a noticeable frame shift.

In MSFS 2024, however, a frame will now be split up as follows:

Image

We have now an initial simulation phase which is dedicated only to the physics simulation. At the end of this phase, the position of the aircraft is then determined and the simulation will formulate the new position of the camera (which will have an impact on LOD selection). This means that you can now use the Update API callbacks to target the initial phase before the final camera position is calculated to prevent any graphical issues.

For those modules that don’t change any of the physics or move the camera, the update API also has callbacks that can target before and after the simulation systems update, giving you a lot more granual control of how and when things will happen. There is also a final update phase for WebAssembly which can be used for garbage collection or anything that must be performed at the end of the update phase.

So there are more fine grained callbacks to run WASM stuff. To me it would sound like a good idea to send input events pre-system, and read simvars at post-systems stage, not sure how significant this is in practice though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions