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

fix possible concurrency bug #4

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

asvarga
Copy link

@asvarga asvarga commented Apr 13, 2021

Instead of Update both reading and writing from TrailMap, it now reads from DiffusedTrailMap and writes to TrailMap. This seems to avoid concurrency issues because it fixes #2 (at least for me).

@asvarga
Copy link
Author

asvarga commented Apr 14, 2021

Two things worth noting:

  • Executions of TrailMap[int2(newPos)] = min(1, oldTrail + agent.speciesMask * trailWeight * deltaTime); in Update commute, so we don't have to worry about race conditions there.
  • Diffuse does exactly one write to DiffusedTrailMap per pixel, so we don't have to do any other clears/copies.

@asvarga asvarga marked this pull request as draft April 14, 2021 14:10
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.

Can't run project in unity 2020.3.2f1
1 participant