How to synchronize shared memory access? multithreading?

In this case, multi-threading tools won’t help you. This is because the overlaps aren’t really happening simultaneously, not in the threaded sense. They may be happening in the same frame but they are still happening sequentially, one after the other.

You’ll likely have to build something on your own, like tracking the most recent actor that made modifications and if it’s not the same one as last time resetting all the shared variables.

Or come up with a different algorithm that doesn’t involve shared state.

1 Like