Zay-ES: the Asteroids example and the Scene Graph

Looking at the Asteroids example, I find that it almost completely disregards the scene graph facility, tracking each Spatial entity individually, without making complex hierarchies. As I understand, that devoids us of the good of automatic spatial positioning of Spatials and their children, and if I want, let’s say, some ships escort a bigger ship, I should not rely on scenegraph parenting and instead make it in a true physical/mathematical way, as if the ships are following the bigger ship? This is a more philosophical question here.

As i’m also using the ES, and since i’m using complex parenting, i can tell that the way you handle the scenegraph parenting does not concerne the ES on some extends, as at most, i believe you can store the parent identifier (as entityID or spatial name or i dono) for attaching the child, then if an entity got a parent all positionning become local and not global. This is how i would do it if needed such kind think. But i’ll admit that i’m not sure this still following the ES pattern concerning the fact about having to store an entityID inside a component. (i’ve never did so but it cost nothing to ask :smiley: )

No you don’t have to use the scenegraph that way. You can use it to separate things for picking, rendering, batching etc. and of course also to move things together but you don’t have to. Positioning every single movable object separately is perfectly valid and also not causing any overhead worth mentioning.

Again really : scene graph = view, es = model. They should not blend. As roroah said you can keep track on an entityID on the spatial. but the recommended way is more to use UserData.
But stil…and entity can be represented by a spatial, it can also be represented by a complete subgraph, an icon in the guiNode, or not have any graphical representation at all.

The thing is there is no such thing in asteroid panic. all asteroids have independent trajectories, so does the ship. There is no object on screen that moves relatively to another. So there is no point in having a complex hierarchy for this.
For example if an asteroid was some kind of planet with a moon satellite that rotates around it, the satellite would probably be attached to the planet node. But the ES model behind it would be unchanged.

[quote=“normen, post:3, topic:32838”]
Positioning every single movable object separately is perfectly valid and also not causing any overhead worth mentioning.
[/quote] I’ll sleep less dumb :smiley: