Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Improvements #51

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

Helodity
Copy link
Contributor

@Helodity Helodity commented Dec 21, 2023

This PR adds the following performance improvements with minimal simulation changes

  • Max interaction radius
    This is the maximum range a mob can interact. This includes reaches, hitboxes, and radius/rectangle dimensions. If the distance between a mob is greater than this, we skip all calculations between these mobs.
  • Pathing
    Now uses A* instead of dijkstra. This will most likely need to be re implemented due to recent pathing changes
  • Edge Rendering
    Edge shadows are now individually checked if they are on screen, and culled when not. If a sector's bounding box is fully on screen, this step is skipped. Furthermore, these calculations are now reused to update multiple edge buffers.
  • Mob collision broad search
    The "all" mob list is now sorted by minimum interaction position. Mobs are now grouped into regions based on their interaction radius, and interactions are only processed between regions.

Simulation changes

  • Mobs now tick depending on their minimum interaction x position, rather than spawned order.
  • All mobs are ticked before any interactions are processed. This should negate the changed tick order, but that has not been tested.

Performance Gains
All measurements are taken from a release build on the latest commits, and are recorded upon entering the area.
Specs: i7-9700k @ 4.4 GHz GTX 1060 6GB, 32GB RAM @ 2400MHz

D.E.V. Lab
Master: 99 - 103 FPS
Performance Branch: 240 - 250 FPS

Playful Yard
Master: 180 - 200 FPS
Performance Branch: 290 - 320 FPS

Crash Landing
Master: 220 - 240 FPS
Performance Branch: 300 - 330 FPS

Cryptic Atrium
Master: 150 - 165 FPS
Performance Branch: 205 - 220 FPS

Verdant Agrids (https://discord.com/channels/459094367425134593/1156405792547807244):
Master: 20-22 Fps
Performance Branch: 71- 75 FPS

Espyo and others added 21 commits November 9, 2023 15:45
- This makes their behavior a bit more predictable, and is very slightly more performant.
- This process smoothly (but quickly) fades them out when the game pauses, and back in when it unpauses.
- Different mixers were also created for the upcoming volume sliders.
- General refactor, mostly distinguishing in-world global sounds from UI global sounds.
- Now, there is a dedicated error manager.
- With these changes, error messages shown when an area loads are more helpful.
- In addition, errors can now appear mid-game if necessary.
this acts as a crude broad search, preventing some mobs that are very far away from running checks.
Instead of rendering every sector's edges, they are now checked individually
Now uses A* instead of Dijkstra
We now only iterate over the nodes we want to eventually look at, rather than every unchecked node.
Now actually uses a sweep and prune algorithm, rather than always checking mobs that have a smaller x position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants