Skip to content

Level Editing Tutorial 1: Getting Started

nikki93 edited this page Sep 13, 2010 · 16 revisions

How does GraLL 2 level editing work?

GraLL 2 levels are made with Blender, a 3D modeler that GraLL 2 uses also as a level editor. In Blender, you can have extra ‘properties’ for each object. The GraLL 2 exporter reads these properties, and the position and orientation of the object, and writes them to a ‘.ngf’ file which contains the layout (position, orientation) and properties (like ‘health’, ‘speed’ maybe) of each object. The game then reads this file and loads up the objects. So, the game uses Blender properties to make a level editor out of a 3D modeler. Some objects, ‘brushes’, have different shapes for every instance (like walls (StaticBrush), moving platforms (MovingBrush, SlidingBrush) etc.). You can edit the shape right in Blender, when you make the object. GraLL 2 needs a way to know the shape of each instance of these. The ‘.mesh’ files (one for each ‘brush’ instance) contain a description of the shape of the object. The ‘.mesh’ files also contain the material (usually a texture, with some shaders) references.

What is a GraLL 2 level made of?

A GraLL 2 level needs the following 2 types of files:-

  • a .ngf file – The .ngf file is a script (not a Python script though) that describes the layout of the GameObjects in each level, and contains the Python scripts for each instance embedded within. .ngf files can actually describe the layout of more than one level, but it is best to stick to one .ngf per level to keep things neat.
  • .mesh files – One for each brush in the level. The .mesh files describe the shape of ‘brushes’. The .mesh files are named as ‘_b.mesh’ to keep them unique.

The name of the level is decided by the name of the script for that level script inside the .ngf file. The names of the .ngf files themselves don’t matter, but it is advisable to name them by the name of your level. The names of the ‘.mesh’ files are automatically set, don’t worry about that.

GraLL 2 searches for these files in the ‘Content’ folder under the user directory. You can organise your content folder any way you want, the game will find them anyway. GraLL 2 will also search in ‘.zip’ files, so you can zip up all your files and send it to a friend, and he won’t have to unzip them (remember to keep your .zips without subdirectories within them though, all files should be in ‘root’).

What tools make these files?

The ‘.ngf’ scripts are created by the GraLL 2 NGF Exporter, which is a modifed version of the NGF exporter for GraLL 2. The ‘.mesh’ files are created by the OGRE Meshes exporter. The GraLL 2 NGF Exporter automatically selects the Brushes after exporting, so that you’re ready to export the OGRE Meshes. The OGRE Meshes exporter also needs another tool, the ‘OgreXMLConverter’. Luckily, all this stuff is in the GraLL 2 tools package so you don’t have to fish around yourself.

What does the GraLL 2 tools package contain?

It contains the following:-

  • The Blender export scripts (OGRE Meshes exporter, GraLL 2 NGF Exporter).
  • OgreXMLConverter.
  • A ‘LevelTemplate.blend’ file which is a ‘template’ for GraLL 2 levels that sets up stuff so you don’t have to.
  • ‘Objects.blend’ and ‘Prefabs.blend’, which contain the Blender objects with default properties so you can just append (import) from them to make your level.
  • A pack of brush textures to tell Blender what the names of the brush materials are, and what they look like.
  • A pack of object textures, for the objects (visible in-game) in the ‘Objects.blend’ file.
  • A pack of icon textures for objects (invisible in-game) in the ‘Objects.blend’ file. Icons are just visual placeholders in Blender for ‘invisble’ objects like CameraHandler.

Don’t worry about the last two, there’s nothing you have to do with them. ;-)

Download

Get the GraLL 2 tools package from the GraLL 2 page (and also the game binaries if you haven’t already). Then, get Blender.

Install

Extract the game and tools archives into any folder where you can find them easily (like ~/games/grall2 or C:\Games\GraLL2). Then, install Blender. While installing Blender, make sure to note where you make it install the ‘user data files’. Now, copy the files from the ‘blend/scripts’ directory in the tools package the Blender scripts directory in the ‘user data files’ directory mentioned earlier (usually ~/.blender/scripts or C:\Program Files\Blender Foundation\Blender\.blender\scripts). These files are the Blender scripts for the GraLL 2 NGF Exporter and the OGRE Meshes exporter, which tell Blender how to export your GraLL 2 levels.

Edit settings

You have to tell the OGRE Meshes exporter where ‘OgreXMLConverter’ is. Luckily, you have to only do this once. Open the ‘blend/LevelTemplate.blend’ file from the tools package. Select ‘File→Export→OGRE Meshes’, then click ‘Preferences’. Beside the ‘Converter:’ field, click ‘Select’. Then, navigate to your tools package directory and select ‘OgreXMLConverter.exe’. Click ‘Quit’, save the file, and exit Blender.

(to be continued)