Skip to content

WorldStep() error counting totalTime #20

@mikuso

Description

@mikuso

Within the WorldStep function, there is a while loop which repeats until (among other conditions) the total amount of time spent simulating the world during this call exceeds the fixed time step allowance. However, the totalTime variable (which is key to this condition) is reset upon each iteration of the loop, and so only represents the amount of time simulating the most recent step, rather than all the steps during this call.

The return value of totalTime is also therefore inaccurate, as it only returns the time spent performing a single iteration of the loop, rather than the total time spent "stepping".

I think a fix for this just requires changing this line:

totalTime = (end - start) / 1000;

to:

totalTime += (end - start) / 1000;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions