How to create and play a custom level


Hi, welcome to this tutorial post where I will explain you all you need to now about custom levels for this game.

I split the guide in different chapters:

  1. What is a level?
  2. How to create a level
  3. How to play a custom level
  4. Data commands
  5. Block IDs and colours
  6. Entities' names

I've also published a video which shows the whole level creation process. You can watch it by clicking here.

You can download this guide by downloading "How to create and load a custom level.txt" at the game's page.

With that being said, let's start this guide!

1. What is a level?

A level in this game, is defined by two files: "data.txt" and "map.png" contained in folder which you can name whatever you want.

map.png

This file represents the level's map. It usually a 64x64 pixels image where every pixel represents a block in the game. When drawing your level you can use different blocks by using pixels of different colours (you can find a list of all the blocks with theirrl respective IDs and map colours at the chapter 5 of the guide). Also remember that every block in a 1 pixel border in the map, will be replaced with a super wall block to prevent the player from going out of the map.

data.txt

This is the file containing all the informations for all the customizable blocks of your level. For example, in this file you can specify what and how many items will a specific chest give you when you will open it.


2. How to create a level

In order to create a level, you will need two programs: an image editor that supports pixel by pixel editing and a text editor.

Here is the step-by-step process for creating a level:

  1. Create a new folder to contain the level files;
  2. Draw the map;
  3. Save it as "map.png" inside the folder you have just created;
  4. Write the data (you can find the syntax for each block and entity in the chapter 4 of the guide);
  5. Save the file as "data.txt" inside the same folder as "map.png".

3. How to play a custom level

If you want to play custom level you have to enter into the game and press the "Add level" button. The game will open a file chooser dialogue where you can select the folder containing the two files ("data.txt" and "map.png"). If the level is created correctly the game will load the level and it will let you play it. Otherwise the game could crash or not load the level at all. In that case try reading this guide again, you might have missed something important! ;)

4. Data commands

Here you can find a complete list of all the commands you can use in the data file. Keep in mind that every x and z you see in the commands here, refer to the coordinates of the pixel in the map image, which correspond to the coordinates of the block / entity in the level.

ARE THE COORDINATES OF THE BLOCK IN THE LEVEL

  • "title = TITLE" (sets the title of your level)
  • "author = AUTHOR" (sets the author of your level)
  • "playerRot = ROT" (sets the starting y rotation of the player in degrees, where 0 = south, 90 = west, 180 = north, 270 = east)
  • "chest(x, z, ITEM_NAME, ITEM_COUNT)" (sets the content of the chest at (x, z) to be ITEM_NAME in count ITEM_COUNT)
  • "button(NAME, x, z, WALL, [])" (registers the button at (x, z) as NAME. WALL can be "north", "south", "east", "west" and it indicates the wall the button is on. Inside of the square brackets you can put (xb, zb, blockID) to declare what blockID will be turned in the block at (xb, zb). You can also put more that one block to change by separating them with "; " and doing something like "[(xb0, zb0, blockID); (xb1, zb1, blockID)]")
  • "pressurePlate(NAME, x, z, [])" (registers the pressure plate at (x, z) as NAME. Inside of the square brackets you can put (xb, zb, blockID) to declare what blockID will be turned in the block at (xb, zb). You can also put more that one block to change by separating them with "; " and doing something like "[(xb0, zb0, blockID); (xb1, zb1, blockID)]")
  • "door(x, z, LOCKED, KEYHOLE_X, KEYHOLE_Z, SIDE, OPENED)" (sets the door at (x, z) to be locked if LOCKED  = "true" or not locked if LOCKED = "false". By setting KEYHOLE_X and KEYHOLE_Z to be the coordinates of a keyhole block, activating that keyhole block will unlock the door. If you set KEYHOLE_X and KEYHOLE_Z to be both -1, the door won't unlock with any keyhole block in your level. By setting SIDE to "left", the door will open by moving to the left, if you set SIDE to "right", the door will open by moving to the right. By setting OPENED to "true", the door will initially be opened. If you set OPENED to "false" the door will initially be closed)
  • "bowBlock(x, z, ACTIVATOR_NAME)" (sets the arrow trap block at (x, z) to be activated when the button or the pressure plate with the name ACTIVATOR_NAME is triggered)
  • "switch(x, z, WALL, ON, TYPE, [])" (sets the switch at (x, z) to be initially on if ON = "true" or to be initially off in ON = "false". WALL can be "north", "south", "east", "west" and it indicates the wall the switch is on. TYPE can be either "blocks" or "spikes". If TYPE = "blocks" the switch will change blocks. If TYPE = "spikes" the switch will toggle spikes. To set what blocks or spikes to switch or toggle, you need to declare them as you were declaring blocks to change in the button or pressure plate data syntax. The switch data syntax, however, includes " / " to separate the action of the switch when off, before the slash, and when on after the slash). Here there are some examples:
    • "switch(x, z, WALL, ON, blocks, [(xb0, zb0, blockIDWhenOff); (xb1, zb1, blockIDWhenOff) / (xb0, zb0, blockIDWhenOn); (xb1, zb1, blockIDWhenOn)]"
    • "switch(x, z, WALL, ON, spikes, [(xb0, zb0, spikeStateWhenOff); (xb1, zb1, spikeStateWhenOff) / (xb0, zb0, spikeStateWhenOn); (xb1, zb1, spikeStateWhenOn)]" (if spikeState = 0 the spike will be set to be unactive, if spikeState = 1 the spike will be set to be active)
  • "barsBlock(x, z, AXIS)" (sets the AXIS of the bars block at (x, z) to be AXIS, which can be either "ns" or "ew". Those respectively stand for "NORTH-SOUTH" and "EAST-WEST")

5. Block IDs and colours

IDNAMEMAP COLOUR (HEXADECIMAL)
0
airffffff
1super wall-
2wall000000
3bars block383838
4cracked block820000
5bow block (arrow trap block)00aa59
6keyhole block9e8300
7doora89fcd
8glassc2ffff


6. Entities' names

NAMEMAP COLOUR (HEXADECIMAL)
button808080
chest00ffff
guard004a7f
ogre267f00
player (if it is not included in the map, the game will pick a random point in the map)7f0000
pressure plate404040
spikesce5200
switch38a3b6
trophy (if it is not included in the map, nobody will be able to win your level)ffff00

Get 3D OpenGL Game

Leave a comment

Log in with itch.io to leave a comment.