3D World Editor - Suggestions and Ideas

Started by
10 comments, last by Jman2 7 years, 6 months ago

About uodo/redo I've implemented something reticently and I'm still not sure about my own implementation...

At work I write a lot of code for 3ds Max/Maya. In those softwares(especially Maya) Every data is stored in some sort of "nodes" as something called as an attribute(or parameter). That is it. The type of attributes in Maya are: floats, int(and booleans and enums masked as ints), reference to other nodes/attributes. An "Attribute" is really just a class that wraps all geters/seters for every type (and stores the animated data for every attribute, if you are interested in animated attributes I could give you more details here).

So using those unified getters setters we can easily record evey change (or if needed create a snapshot of the whole scene/level/..).

So knowing that every data for a node is stored as an attribute, each node gets a callback whenever an attribute is changed. So every node can take those changes in account whenever needed.

Another plus is that you can auto-generate UI for those attributes.

The problem is that that data doesn't directly translates to your "game object", but knowing that usually the data for the editor is usually different from the one used during game.

However a disclaimer - Maya is not a game engine and my experience with this is not professional.

Advertisement
I know its quite late but with saving it depends on how you have implemented your entity system. Most engines have a pallet or blue print of objects (prefabs in unity) that are stored in a dictionary with a look up ID. Your scene entities then store a reference to ID which returns the paths for loading from your asset manager such as model path, texture path so on. This means your scene entities only stores a transform and a reference to descriptor and your pallet of objects only store paths. You save you pallets out useing XML sterilisation or binary and load it in when the game or editor loads up. And equally you save out your entity list which you load when levels load.

Here a more Codey layout:

Dictionary containing pallets:
Pallet ID valut_door:
Model path
Texture path
Material type

Entity:
Editor name: vault_door
Reference ID:valut_door
Transform
Model <- null / not saved only there at runtime usually shared pointer
Material <- some default untill loaded

It couldld be noted that each entity could be stored in a dictionary as well so you have unique IDs or you can just have an ID variable. You see if you have multiple of the same object you'd like to have a unique reference to it .

Hopefully this helps someone that comes across this, the approach is similar to that of fallout.

This topic is closed to new replies.

Advertisement