Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am creating a game and I have a custom level format for levels in my game. I wanted to know if it is possible to create levels for that kinda format in Blender. My format is XML based and just declares the positions of certain objects. Online I have seen many people use Blender to create levels in their own custom format that blender can understand.

How do i get blender to understand my format and use blender to create levels for my game?

share|improve this question
The notion of "level" is somewhat unclear here. It sounds like you mean you don't want the geometry in your "level" file, only where objects in the scene are located; is that what you mean? – jhocking Aug 30 '12 at 16:15
Yes, that is what i meant, sorry – notro Aug 30 '12 at 16:48
Basically I want to place objects with custom data (position data) and export that into my file format. – notro Aug 30 '12 at 16:49
up vote 6 down vote accepted

You have two ways:

  • use the Python API
  • since Blender is free and open-source you can re-factor all the pieces of code that you want to but this is a crazy idea even if you think about the fact that Blender has a relatively clean and modular design.

By the way Collada is just XML, I would just remind you that, the default .blend format file is probably not so standard, but there are prepacked alternatives.

share|improve this answer

From my experience with using Blender as a level editor, here's some tips:

  • None of the existing exporters will currently export custom properties of various objects. They are vital in supplying metadata so if you want that, you will have to make your own exporter.
  • #blenderpython IRC channel (which can be found in the same server as other channels: should be able to help you with most of your problems (please do consult the documentation first though, it will help you find most variable names).
  • If you want to export more than position data (meshes, for example), Blender's data requires lots of preprocessing so I highly recommend using at least one intermediate output stage.
  • You can use F8 to reload scripts instantly. You can enable the console to find out why your script isn't registering the necessary menu items.

On second thought, if all you need is positions, why Blender? Is there anything bad about just making a "position viewer" app based on your game code (you could even load the level and instantly see it) and writing the level files yourself?

share|improve this answer
A visual way would be much easier to work with, changes can be applied quicker and defining each position individually seems tedious. Yeah I could write a level editor, but it would be easier to use blender, right? – notro Aug 30 '12 at 16:51
You haven't said anything about your in-game data yet. If you're going to align meshes with that position data, Blender simply cannot help at all because the meshes in it don't represent what you're going to see in the game. If you have too many positions to manage, you could simply generate them procedurally. A visual way is only easier when it's not visual just for the sake of being text-less. – snake5 Aug 30 '12 at 17:03
I've used Blender as a placement editor many times, and it has the big advantage of there's less work for me to do. Even if I would want a custom editor later, when I just start banging out levels for a new game I don't know if it'll be worth all the effort of making a custom level editor. – jhocking Aug 30 '12 at 19:05

The notion of "level" is somewhat unclear here. It sounds like you mean you don't want the geometry in your "level" file, only where objects are located. A more clear term for what I'm talking about is "placement editor" (ie. use Blender to place objects around the scene)

I've written a script to do that using Python, it was pretty easy:


by Joseph Hocking 5/1/2010
Name: 'Dropper'
Blender: 2.49
Group: 'Export'
Tooltip: 'Saves object info to text file'

import Blender
import bpy

def write(filename):
    out = file(filename,"w")

    for obj in
        if obj.sel:
            out.write("<ENTITY ")

            out.write("PX=\"" + str(round(obj.LocX,4)) + "\" ")
            out.write("PY=\"" + str(round(obj.LocY,4)) + "\" ")
            out.write("PZ=\"" + str(round(obj.LocZ,4)) + "\" ")

            out.write("RX=\"" + str(round(obj.RotX,4)) + "\" ")
            out.write("RY=\"" + str(round(obj.RotY,4)) + "\" ")
            out.write("RZ=\"" + str(round(obj.RotZ,4)) + "\">")


            #optionally assign string property "tag" under "Logic" panel
                prop = obj.getProperty("tag")
                if prop.getType() == "STRING":
                    out.write("<TAG>" + prop.getData() + "</TAG>")
            except: pass




(I'm not sure this works in the latest version of Blender. You can see in the comments that I wrote this script a couple years ago, and I haven't upgraded Blender recently.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.