I'd like to have multiple (maybe 5 or so) instances of a Bevy game with slightly different configurations on a page. For example, one might have a square player while one has a circle, or another might have one enemy while the next has two. To save download capacity, I'd like for them to all be instantiated from the same binary. Is there any way to input variables into the instances? I've been looking at this page, and it seems like Bevy puts the game in the init() function by default, which doesn't take any arguments. Could I maybe pass some sort of environment variable-like value?
#Inputs to WASM build
4 messages · Page 1 of 1 (latest)
its defo not easy but here would be my take:
you have different functions that instantiate different apps. these funcs you export with wasm-bindgen and call them from js. Make sure that you use different canvases otherwise they would override each other.
Also dont build as a standard bin so you dont need to have a main()
Creating different instances from a binary is feasible, for example: https://github.com/jinleili/bevy-in-web-worker