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

High Performance Particles #34

Closed
caibear opened this issue May 12, 2021 · 4 comments
Closed

High Performance Particles #34

caibear opened this issue May 12, 2021 · 4 comments
Labels
client Only related to the client performance Performance related

Comments

@caibear
Copy link
Member

caibear commented May 12, 2021

There are currently only wake particles that are created on the client behind boats. The particles are updated in JS and aren't very fast (~500/ns per update on my computer). This limits the amount of particles that we can spawn and also impacts frame rate on lower end devices. If we can reach at least 100/ns per particle update I think it will meet our goals.

Proposed solutions:

  1. Optimize the update code on the CPU by using Web Assembly.
  2. Rewrite the particles to be only updated on the GPU with a vertex shader.
  3. Reduce the number of particles based on computer specs/frame rate.

Once the particles have high enough performance we can add more effects such as smoke/fire.

@caibear caibear added performance Performance related client Only related to the client labels May 12, 2021
@finnbear
Copy link
Member

finnbear commented May 23, 2021

I implemented option solution number 3 by scaling particle emissions by FPS.

@caibear
Copy link
Member Author

caibear commented Jul 2, 2021

A lot of effects such as fire and smoke are blocked by this. We need to figure out how to get level access to WebGL from PIXI.js so we can implement option 1 or 2. If that can't be done we should look into other methods to do these effects.

@finnbear
Copy link
Member

Could still be more efficient, but the WebAssembly version is good enough.

@finnbear
Copy link
Member

finnbear commented Oct 4, 2021

Just added smoke to ships and fire to oil rigs. Performance seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Only related to the client performance Performance related
Projects
None yet
Development

No branches or pull requests

2 participants