#Inserting world as a resource? Cursed or not?

16 messages · Page 1 of 1 (latest)

waxen gazelle
#

Lol I couldn't be bothered to use DynamicScenes because I am using some custom serialization code so I came up with an idea that is probably stupid but seems to work so far. (Also the example on github for scenes didn't make any sense to me)

Basically in order to seperate the game world from the rest of my program, I made this struct and inserted it as a resource.

#[derive(Resource)]
pub struct GameWorld {
    pub world : World,
}

This basically creates a new seperate world and inserts it as a resource.

It seems to work so far??? but is this cursed?

rancid scaffold
#

Recommended pattern! Kind of cursed and emergent yes, but something the community has found very useful and reliable

#

Eventually we're hoping to have first class multiple world support at the app level

waxen gazelle
#

Well seeing as scene is literally the same thing pub struct Scene { pub world: World, } why not just have scene derive Resource and Component lol

#

I could open an issue/make PR or at least add some docs

queen flint
#

you could just newtype it

waxen gazelle
#

yeah that's true

rancid scaffold
#

Otherwise you'll get scenes from different crates clobbering each other

narrow talon
#

Hell yeah. Just today I was thinking of World as part of a Component. You can do it but I'm not sure that has any use case

rancid scaffold
indigo sand
indigo sand
#

I want millions of agents basically

#

the entire use of just the core and the feature PR, just a means to an end of slower compilations in that scenario

#

I want a tree of:
App
SubApp
World, World, ...
SubApp
World, World, ..
...