7
\$\begingroup\$

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?

\$\endgroup\$
3
  • \$\begingroup\$ 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? \$\endgroup\$
    – jhocking
    Aug 30, 2012 at 16:15
  • \$\begingroup\$ Yes, that is what i meant, sorry \$\endgroup\$
    – Nik
    Aug 30, 2012 at 16:48
  • 1
    \$\begingroup\$ Basically I want to place objects with custom data (position data) and export that into my file format. \$\endgroup\$
    – Nik
    Aug 30, 2012 at 16:49

3 Answers 3

6
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

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: http://www.blender.org/community/chat) 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?

\$\endgroup\$
3
  • \$\begingroup\$ 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? \$\endgroup\$
    – Nik
    Aug 30, 2012 at 16:51
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – snake5
    Aug 30, 2012 at 17:03
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – jhocking
    Aug 30, 2012 at 19:05
3
\$\begingroup\$

By "level", 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 that is "placement editor" (ie. use Blender to place objects around the scene)

I've written a Python script to do just that; it saves custom properties in addition to regular position/rotation/etc, and you can save the data as either XML or JSON.

(and then just for kicks I ported the script to Maya)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .