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

Terrible FPS (20-25) with boats with 4000+ gameobjects #20

Closed
zolantris opened this issue Dec 21, 2023 · 2 comments
Closed

Terrible FPS (20-25) with boats with 4000+ gameobjects #20

zolantris opened this issue Dec 21, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@zolantris
Copy link
Owner

zolantris commented Dec 21, 2023

The issue:

  • Each object is iterated through and fires an LateUpdate which Unity uses as a lifecycle. This means in areas with more than 1 boat it will get multiplicativity worse on loading.
  • Adding these to a coroutine may make things more optimized, but it still is extremely inefficient and also is error prone. Coroutines can get out of sync and could cause the boat to collapse.

As an example, a still object version of the same boat has 120FPS or more. But the boat is firing a updates every game ticket that iterates through 4000+ objects (for the larger boats).

Workarounds:

  • use larger prefabs
  • use smaller boats
  • deal with the extremely bad fps and lag.

Solution(s)

  • making the boat be the sole block that updates and all other items are considered children of the boat. All position coordinates should be updated as the boat parent moves.
  • This will require a larger re-write but would jump a large boat performance from potato to speedboat.
@zolantris zolantris added the enhancement New feature or request label Dec 21, 2023
@zolantris
Copy link
Owner Author

This may be significantly improved in 2.0.0. Much less rendering component getters required per update.

Plus rendering logic is being combined into a zone controller that renders a boat per zone. If the boat swaps the zone it will smoothly pass of the rendering thread to that boat.

@zolantris
Copy link
Owner Author

zolantris commented May 18, 2024

Resolved in v2.0.0. New WaterVehicle Rafts had their updates moved to FixedUpdate which calls way less than Update. FPS should jump 20-40%. Though moving objects are always going to be terrible on performance.

4.5k instanced boats can easily hit 80fps now. Lowest I dropped to (this is i9-10900k cpu, 32GB ram ddr4, 3090 ti GPU) was 45fps.

Noting that the low FPS problems seems mostly related to CPU, not GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant