Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • openmw openmw
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 833
    • Issues 833
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 31
    • Merge requests 31
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenMWOpenMW
  • openmwopenmw
  • Issues
  • #5431
Closed
Open
Issue created May 22, 2020 by elsid@elsidDeveloper

Physics performance degradation after a specific number of actors on a scene

Here is a graph with dependency between number of actors and physics time taken. Mechanics is added to compare. actors_frame_time

  • Source: stats.release.1590101186.zip
  • Script: https://gist.github.com/elsid/995c1c6db11d756a292c23726672c91b
  • Benchmark video record: https://youtu.be/quo6cTOWjaM

Here is a profile for a scene with 173 actors: profile

It's noticable that MWPhysics::MovementSolver::move takes most of the main thread CPU time. This happens because of increased number of calls per actor per frame: calls_per_frame_time

And this is quite interesting because the limit of 20 calls is not reached. And there is an explanation. The game time limit per frame is 200 milliseconds. Default physics FPS is 60. So if consider that each MWPhysics::MovementSolver::move call represent one frame of physics we can get only 0.2 / (1 / 60) = 12 calls per frame.

Another thing is why we have this limit of 200 milliseconds of game time per frame? The most common FPS for movies is 24. 5 FPS makes game unplayable. Changing this limit to 1 / 24 make situation quite better. 0.045s for 200 actors instead of 0.2s: actors_frame_time_2

And this change confirms the hypothesis with the actual limit of MWPhysics::MovementSolver::move calls (1 / 24) / (1 / 60) = 2.5: calls_per_frame_time_2

The visible effect of the game time limit per frame change is game instead of slide show becomes slow motion. But I'd consider this as an improvement because at least it becomes playable.

Assignee
Assign to
Time tracking