Sign in to follow this  
alexgeek

Setting properties while designing

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.
<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.

Share this post


Link to post
Share on other sites
Yeah, I was planning on some form of xml accomponiment to each level anyway, may aswell pop it all in there.
Now that I've thought it through this is much simpler anyway.
Just need to figure out how to patch all my levels together and work out a coordinate system, hmm.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this