Setting properties while designing
Allor thar. When I'm creating my worlds in blender is there a way to add a property to an object which I can grab in code to handle how that part will act? E.g. a tile being a trigger for something Or, marking a crate as being crushable. Or should all this be added manually by some sort of level script/code/xml file etc. ? Just to be sure.. you can grab part of a model (object) and change how that part is drawn yes? Thanks.
Yes you can but you need to store all the info in the file in an appropriate way, or into a separate file. Then you need to parse the file into your game engine and into struts or variables.
This can get quite complicated and a good structure of the file needs to be created. Also i'm not sure you can actually export properties from bender, so this would have to be done manually.
It may just be better to hard code it e.g. by adding flags to each object to determine it's properties.
Hard coding = easier .'. less bugs.
Parsing is harder, but provides more flexablility and makes things easy to change and adjust.
The choice is yours, but i personally think the hard coding option is better. as it is much quicker and if done well less messy and easiler to debug.
PureBlackSin
This can get quite complicated and a good structure of the file needs to be created. Also i'm not sure you can actually export properties from bender, so this would have to be done manually.
It may just be better to hard code it e.g. by adding flags to each object to determine it's properties.
Hard coding = easier .'. less bugs.
Parsing is harder, but provides more flexablility and makes things easy to change and adjust.
The choice is yours, but i personally think the hard coding option is better. as it is much quicker and if done well less messy and easiler to debug.
PureBlackSin
For Games, Articles and Custom High End Computers, come visit.Myndoko
why not load ingame objects from XMLs? It's a good way of organizing data, it's incredibly simple, there's plenty of free libraries for this, and XMLs are easily written (it's human readable!).
Here's an example.
Here's an example.
<objects> <barrel breakable="true" moveable="false" explodes="true" model="res/barrel.obj" texture="barrel.png"> <bed breakable="false" moveable="false" explodes="false" model="res/bed.obj" texture="bed.png"></objects>
Now rather than loading directly from file, you parse the XML and it tells you not only where the model and texture is (or indeed any other associated resource) and you load from that. Further, you have a clear list of variables associated with that object, and their values. A truly lazy content creator may complain about having to edit an XML, but the effort is minimal (notepad) and loading these is much easier than trying to parse variables from a special file format.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement