Topic: How to use the Level Editor - Part I

How to use the Level Editor - Part I

Initial release: 2009-02-06
Last update: 2009-09-13



0. Introduction

This tutorial explains how to make a basic level on the Open Sonic Level Editor. At the time of this writing, the latest version of the game is 0.1.0, but the topics covered here can be applied on new versions as well.

This is a quick pratical introduction to the Level Editor (learn-by-doing). You'll be able to make your own level in just a few minutes, but only with basic features like simple platforms, enemies and items. Advanced topics like custom graphical themes, slopes and loops will be covered later.

http://opensnc.sourceforge.net/home/misc/example_scr3.png



1. Getting started

Before we begin, you ***must*** download the Example level located here. We'll use the graphical theme of that level because it's simple and easy to get started. It doesn't come bundled with the game, so you need to download it now if you haven't done it already.

A level is a plain text file with a few instructions written on it. Open a simple text editor. If you're on Windows, the Notepad program will do the trick. Type the following:

# My first level
name Hello
author YOUR_NAME_HERE
version 1.0
requires 0.1.0
act 1
theme themes/example.brk
bgtheme themes/example.bg
spawn_point 64 5068
music musics/example.it

# brick list
brick 26 0 5095

Since this is a pratical tutorial, I'll not get into details now, but you can guess what most of these options do. For simplicity, let's call GAMEDIR the directory where Open Sonic is installed. For example, if the game is located at C:\Users\username\Documents\opensnc-win32bin0.1.0\opensonic.exe, then GAMEDIR means C:\Users\username\Documents\opensnc-win32bin0.1.0\. The procedure is similar on Linux.

If you've installed the Example level correctly, the following files must exist:

  • GAMEDIR/themes/example.brk (brick theme)

  • GAMEDIR/themes/example.bg (background theme)

  • GAMEDIR/musics/example.it (music)

  • GAMEDIR/images/example.png (level graphics)

Save the text you have just typed to GAMEDIR/levels/hello.lev

Tip: if you're using Notepad (Windows), you must double quote the filename, so the program won't save your file as hello.lev.txt . For example, if you're on the GAMEDIR\level folder, you could type "hello.lev" instead of hello.lev

NOTE: Open Sonic is able to play the following music formats: .ogg , .mod , .it , .xm , .s3m

http://opensnc.sourceforge.net/home/misc/leveditp1_0.png

http://opensnc.sourceforge.net/home/misc/leveditp1_1.png



2. The Level Editor

Run the opensonic_launcher program, set the display mode to "Windowed" and check the option "Play a custom level". Choose the hello.lev file you've just created and click on the "Play!" button. After the game starts, press the F12 key to enter the level editor.

If hello.lev doesn't show up in the list, you probably did something wrong. Please go back to the previous section and try again.

http://opensnc.sourceforge.net/home/misc/leveditp1_2.png

Tip: you can edit almost every Open Sonic level by pressing F12 during the game. If you're editing an official level (these levels come with the game), please do *not* save your changes, as this operation is irreversible!

The level editor has three edit modes: brick mode, item mode and enemy mode. Basically a brick is a background object or a platform; an item is something like a ring, a life box or a checkpoint; and it's obvious what an enemy is. On the table below, an 'object' may be a brick, an item or an enemy, depending on the current edit mode.

Key => Function
-----------------
Arrow keys => Move the camera
Ctrl+Arrow keys => Move the camera (faster)
B / N => Select the previous/next object
Ctrl+B / Ctrl+N => Previous/next edit mode
F12 => Quit the editor
Ctrl+F12 => Save & quit
Left mouse button => Put the selected object under the mouse cursor
Middle mouse button => Pick the object that is under the mouse cursor
Right mouse button => Delete the object that is under the mouse cursor
Ctrl + Left mouse button => Change the spawn point

Now you should choose the brick mode. When you do, you will see something like "Current category: brick". Press the N key to select the next brick. Now you should see "Current brick: 001 (ang:0,prp:0,bh:0)". But what does it mean?

  • '001' is the ID of the brick: it's an internal number.

  • ang:0 tells us that the angle of this brick is 0 degrees (useful for slopes & loops - this will be explained later)

  • prp:0 is the property of this brick. At the time of this writing, a brick can be either PASSABLE (prp:0) or an OBSTACLE (prp:1). Bricks that are passable are just decorative; bricks that are obstacles can be considered as platforms for now.

  • bh:0 is the brick behavior. This will be covered later.

http://opensnc.sourceforge.net/home/misc/leveditp1_3.png



3. Make your level

This is where creativity comes in. Now you should make your level by placing objects on the screen. A good guide to follow is:

  1. add the bricks

  2. insert the items

  3. finally, add the enemies

When adding bricks to the level, make sure to see if the brick you're considering is displayed as prp:0 (PASSABLE) or prp:1 (OBSTACLE).

Do *not* try to insert the "LOOP" items at this time. If you do, "strange" things may happen on your level, like your character being able to get inside the walls and so. Loops and slopes will be explained later, as they require a little more theory to be understood.

When you're done, press Ctrl+F12 to save your level.

http://opensnc.sourceforge.net/home/misc/leveditp1_4.png



Congratulations! big_smile
You have made your first Open Sonic level! If you have any questions, please let me know. Thank you very much for reading.

Last edited by Alexandre (2009-09-13 14:09:32)

Re: How to use the Level Editor - Part I

Okay, nice tutorial.
Maybe it would be a good idea to have a boolean var in order to enable or not stage editing.

f.e:
bool      enable_level_edit;

If the stage is "official" then enable_level_edit = false;

Or something like that

Re: How to use the Level Editor - Part I

Neoblast wrote:

Okay, nice tutorial.
Maybe it would be a good idea to have a boolean var in order to enable or not stage editing.

f.e
bool      enable_level_edit;

If the stage is "official" then enable_level_edit = false;

Or something like that

This feature is already available. smile You can't edit the Master Quest levels.

All you have to do is to add a line with the word "readonly" (no quotes) in the .lev file. If you press the F12 key when playing on a "readonly" level, the game won't let you access the level editor. Try that on the Master Quest (main menu -> custom quests).

Of course someone could edit a .lev file manually and remove the "readonly" flag. But then the user would be trying to deliberately modify the level, so I won't forbid that.

Re: How to use the Level Editor - Part I

Ahh it's true I did not see it at first.
There are some stuff about the physics that need a little fixing, I could give assistance if you want.

Re: How to use the Level Editor - Part I

Thank you. smile Some people already complained about the friction because the characters take too long to brake (on version 0.1.0). This will be fixed for the next version. The modification is simple: all one must do is to change a number in the source code.

Re: How to use the Level Editor - Part I

I bet it is friction var in player.c
Reducing it a little would do it.
But how much exactly?

Re: How to use the Level Editor - Part I

You're right, it's in player.c

I'm also changing some other stuff like the gravity and the teleporters, see here

Re: How to use the Level Editor - Part I

Thankyou i'm trying my first level...:lol: is realy awesome! i always wanted to make a level cool

Re: How to use the Level Editor - Part I

Oww.. Start game and press F2 to get level editor? Not working to me....

Last edited by SuperTails (2009-07-21 15:10:45)

Re: How to use the Level Editor - Part I

I'm Have Version 0.1.1
But i'm not have level editor how to get them?

Re: How to use the Level Editor - Part I

press F12

Re: How to use the Level Editor - Part I

Been messing around with Open sonic since the Dreamcast release and i would like to thank you for making dreams come true and something truly "way past cool" big_smile having a blast with the level editor,living my child hood dreams,cant wait to try make some sprites and go nuts once i get used to it.

I cant thank you guys enough*thumbs up*

Last edited by mdlmemorybank (2009-07-29 03:16:56)