I am thinking of developing the game in pure JavaScript and html5, without using any third-party plugins. The problem I am facing is that I can’t find a way to split the different “modules” of the game into separate threads, such as rendering work, game logic, loading assets, etc.
Web workers seem to be able to split the code into different threads, but the problem with them is the limited information that I can pass between them. For example, for a rendering job, I need to transfer the whole "world" with all the entities, meshes, textures, etc. For each game update, because worker threads cannot share memory. It can be optimized, for example, send static objects only during initialization (grids, textures), and then send only the state of the object when updating (this is a world transformation), but it is still undesirable.
Is there a way to send big data between them or share them with some objects? Or is there another way to fully achieve true multithreading? I know that there are simpler ways to achieve this using plugins / gears, but I need to use only available methods on an open network;
source share