Architectural doubts of my game: The role of jme3 objects and how to use them properly

But the question for point 2 still remains: How do you save/load the entities? I used SceneComposer for specifying the game objects (visual + data) but this is not possible. Is there something like a best practice on how to specify the data.

Lets say you have a space cruiser with 5000 His and 4000 shields, 1500000 tons mass, 4000000 kN thrust, Antennas, Turrets with lasers, missiles etc… This data has to be specified and stored somehow. How is it done correctly? I assume that there would be something like a table/list (e.g. excel) providing all the data necessary for generating the object.

Regards, Harry

While I haven’t used ZayES myself, as I recall it has its own methods for persisting the data, should you choose to use them. As far as getting the data into it initially, I’d say that’s up to you. Personally, I’d opt for either a JSON or XML based data file that specifies the entity IDs and the components associated with each entity. I suppose you could also use a CSV or another tabular format, although those seem rather inflexible for dealing with many different component types.

1 Like

This sounds good but is there something like a systematic approach/design pattern I can rely on for specifying offsets/rotations of child objects? I did this with the integrated SceneComposer previously when I was storing all the game data inside the spatials but this will not work any more.

You’d at very least want a component on the child objects specifying the relation to the parent (I.e., parent ID, and the offset transforms). You could also add a “Children” component to the parent with a list of child objects, although this has several drawbacks and I’d advise against it.

This is exactly the solution what I have implemented now :-P. And exactly the reason of the question above. My use case are turrets which I want to control independently from the space cruiser. So the player can switch like Han Solo from the cockpit/bridge which would be the main entity to the turrets to control them (with their very own transformations) And when the turrets are destroyed they are detached by clearing their parent and adding wreckages spatials.

Ok, that makes sense. In that case especially, using a hierarchical data structure like XML or JSON to specify child data will work quite nicely.

1 Like