1
\$\begingroup\$

im having trouble phrasing the issue, so apologies if the title isn't correctly descriptive.

I'm creating a basic game engine for the first time and have an idea for setting up the worlds data. The idea is to create basic "components" and build a tree of "collections" that contain these components then load these in and out during runtime. hard to put it in other words so heres an example:

id create objects traditionally: a book contains its relevant variables and meshes, a rock object does the same, chairs, walls, people etc. then if i create a house, it wouldnt be an object like those primitive types, it would be a collection of the primitives. It would contain references to walls, chairs, books and other objects at locations in and around the house. but collections would have their own data as well (house price, house name, etc) Then if i made a town it would consist of those house "objects" as well as other things that would be collections as well and maybe some primitive types. then if its an open world i would place those towns and locations all around. and maybe as an example, if theres many planets they would all be their own unique open worlds with their own collections placed at certain spots. but even the planets should have their own data as well (sky color, biomes etc) and finally there would be a "universe" node that contains all those planet nodes.

So the runtime loading would be checking which level of the tree to load. if (in_space) { if (in_range_of_planet) {load_planet();} }

but it shouldnt load every node that the planet contains until you get in range. only the planet nodes own variables. so it would load the planet mesh and consequently the towns low LOD meshes but none of the town data or what those nodes contain. and unload all other planets. then if you got in range of a town, it should load that towns node but no other towns. and only the visual meshes of the objects that town contains. then if you got into a house, it should load the houses collections and variables and unload everything up the tree and all other things the town contains. etc etc.

is there a name for this system? ive been learning about entity component systems but i haven't seen this idea of component trees. (components made of components made of components). or can they be used this way? thank you in advance, if i can clarify in any way please let me know.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ It sounds like you're describing a scene tree/graph, which is a hierarchical organisation of different game components (visual or not). Take a look at Godot or Unity for examples of how game engines organise components. \$\endgroup\$ Commented Mar 15, 2023 at 9:20

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.