Skip to content

Conversation

marcushutchings
Copy link
Collaborator

Smooth Mesh will now respond the changes in the heightmap during gameplay. Algorithm changed to reduce computational load. Typically peaks at 0.1% CPU for me; though, I've seen very rare spikes a little higher 0.3-0.4%. It was able to keep up nicely with a 6v6 Barbarian match.

Optmizations include:

  • Switching Gaussian blur for Linear blur
  • Removal of blur kernel
  • Use of rolling averages instead of recomputing them at every point
  • Smooth Mesh is strictly aligned with heightmap to remove the need to interpolate during maxima calculations
  • Use of SSE to speed up calculating local maximas
  • The map is divided into tiles of 64m by 64m, which are now the processing elements used in updates
  • Damage is tracked by tile, so already damaged tiles are not added to the pipeline a second time
  • Dynamic updates are delayed and then submitted through a pipeline
  • The pipeline will do a single piece of work on a single tile per sim frame
  • The pipeline will process all tile maximas first, then all tile horizontal blurs, and then finally all tile vertical blurs this avoids artefacts from appearing in the smooth mesh
  • Multi-threaded workloads have been turned to single threaded workloads because the work load is too small for multi-threading.

I have added a Mod Option to disable the SmoothMesh (and hence the dynamic updates.) It will be on by default. Set system.enableSmoothMesh = false to disable.

@marcushutchings marcushutchings requested a review from lhog May 31, 2022 17:14
@marcushutchings marcushutchings changed the title Bar105 Smooth Mesh dynamic updates BAR105 Smooth Mesh dynamic updates Jun 1, 2022
@marcushutchings marcushutchings merged commit aae0f10 into BAR105 Jun 2, 2022
@lhog lhog deleted the BAR105-smooth-mesh-dynamic-udpates branch December 19, 2022 12:54
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.

2 participants