Hi,
I am working on a game that has AI logic, movement, etc and drawing. Does it make sense to calculate moving and AI logic using Web Workers? But how do I do that -- because the workers need to know so much about the main thread like the positions of certain objects for collisions, amount of bullets, etc. It feels like impossible because the worker is completely separate from the main thread with no access what so ever. I do know that there a postMessage() system, but that feels so ... umm, painful?
For example, I have a rifleman object that represents a rifleman with a sprite, position, health, etc. I want him to patrol. So, how do I do that patrolling code on a worker? It would need pretty much the whole access to that object.