excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️
https://excaliburjs.com
BSD 2-Clause "Simplified" License
1.77k stars 189 forks source link

Fixing global window reliance of Excalibur #3175

Open Autsider666 opened 1 month ago

Autsider666 commented 1 month ago

Context

Not a single part of EX is usable outside of the main thread in the browser, making it really hard to use (partially) in workers or in server-side-rendered code without throwing window is not defined. I'm aware that some parts of EX won't be able to function without access to some window specific functionality, but I'm quite sure that something like Vector should be accessible without access to window.

This will be a good step towards making Offscreen/off-main thread rendering investigation for v1.0 viable.

Proposal

I'm not a library/package expert, so I've no clue where to start searching for a solution, so my main proposal is to use this issue to brainstorm potential reasons/fixes.