Can someone please explain in simple words why i need Serializable object

148 views
Skip to first unread message

Meir Yanovich

unread,
Jan 9, 2014, 9:12:21 AM1/9/14
to urh...@googlegroups.com
Hey 
i keep learning the framework , i saw some examples like:VehicleDemo and CharacterDemo 
using Serializable class + that inherited from component class , and then using ATTRIBUTE macro .
i didn't understand why i need to define the ATTRIBUTE macros and have to convert my model to Serializable Object 
can you explain in simple words what is the logic behind this ? 
i did read 
http://urho3d.github.io/documentation/a00034.html

i missing here some info about the architecture behind this .
thanks 

Chris Friesen

unread,
Jan 9, 2014, 10:21:31 AM1/9/14
to urh...@googlegroups.com
I didn't write the code but I can guess some things.  Urho uses factories to construct objects.  To make it parameterless and it hydrates objects after instantiation in a data driven style.  There are other means of doing it but it works and works consistently for any object type.  Dump/restore state easily which powers the scenes/prefabs.  Attributes are easily exposed to the script api.  Attributes are exposed to the editor.  Attributes are syncronized for networking/multiplayer stuff.  Urho uses an 'entity component system'; I havn't done much reading on it but it is well proven at this point to provide flexibility, and performance.  I am not a battled hardened game dev but an open source web programmer trying to make a game with my wife.  I would defer to what anyone else says over me.

Lasse Öörni

unread,
Jan 9, 2014, 11:08:39 AM1/9/14
to urh...@googlegroups.com
Yes, that's pretty much it. The recommended and supported way to add your C++ stuff to the scene is create new components, then add as attributes the things you need to be saved. If you are not saving or network-serializing anything, then there's no need to define attributes either.

Note btw. that when you create new C++ components and want to load, save and edit them in the editor, you need to basically create a custom version of Urho3DPlayer that registers also your components to the factory system, then use that executable to run the editor script. Otherwise you'll get error messages of unknown components.

Meir Yanovich

unread,
Jan 9, 2014, 12:15:46 PM1/9/14
to urh...@googlegroups.com
Thanks for the info 
so if i don't what any attributes to be exposed to script , i can not define the attributes  ? 
in what exception i can NOT inherit from component , or its not good idea and by default it is better to always inherit from component 
when i create new c++ class 
Chris Friesen i know i was reading some stuff from your blog is there any progress with your game ? 

is there Future plan or is there already any documents about the engine architecture design stuff ? 
it will be time saver 

Meir Yanovich

unread,
Jan 9, 2014, 12:17:21 PM1/9/14
to urh...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages