anedumgottil / VR-Mazmorra

Procedurally generated VR Dungeon
Apache License 2.0
1 stars 0 forks source link

Grid needs a MutexLock to avoid race conditions or simultaneous Grid modifications #22

Open apodgo2 opened 7 years ago

apodgo2 commented 7 years ago

Very important now that we got Grid modifications happening left and right, especially with the MapGenerator....

And once you consider that the Grid is literally the authoritative source for EVERY item on the map that is stationary or static, it's going to be accessed a lot and we'll need to handle simultaneous access/modification, especially once physics and asynchronous functions begin being used.

It would be nice to have it capable of being run in parallel, just so long as the Grid isn't having two identical memory locations edited, but I'm not quite sure how you'd do that. The issue is if you mutex the whole thing it'll really slow down everything since it's used in almost every class.