Skip to content

How to create your own levels

Tudor Roman edited this page Sep 7, 2015 · 8 revisions

Summary

It's very simple to make a level for nSnake:

  1. Create a file ending with .nsnake
  2. Describe the map with ASCII characters
  3. Add some metadata (map name, author, date made)
  4. Place it on ~/.local/share/nsnake/levels

The first and last steps are important; the game will not recognize the file unless it has the proper file extension and is at the right place.

Example

Let's see an example of a level file:

; This is a level file for the nSnake game

name    = Arena 01
author  = Alexandre Dantas
date    = Jul 22, 2014
comment = The very first level made for nSnake!

start
################################################################################
#                                                                              #
#                                                                              #
#                                                                              #
#                                                                              #
#          ########################           ######################           #
#          #                                                       #           #
#          #                                                       #           #
#          #                          #                            #           #
#                                     #                                        #
#@                                    #####                                    #
#                                         #                                    #
#          #                              #                        #           #
#          #                                                       #           #
#          #                                                       #           #
#          ########################           ######################           #
#                                                                              #
#                                                                              #
#                                                                              #
#                                                                              #
################################################################################
end

As you can see it's pretty intuitive; anything between start and end is a level, everything else is metadata. See sections below for detailed description.

General rules

  • All lines starting with ; or # are comments and will be ignored
  • Blank lines are also ignored
  • Metadata is placed in a key=value fashion; blank spaces are ignored on both sides
  • The level definition must be within start and end lines.

Also, make sure the file name ends with .nsnake, otherwise it won't get recognized by the game.

The level definition

"Draw" the map with ASCII characters. Here's what each one do:

character effect
# A wall the player hits and dies
@ Player's starting point. It will always start running to the right
anything else Blank space, where the player can walk

On future versions it might use other characters. To keep backwards compatibility, if it's an unknown character it's considered blank.

Instead of placing each character one at a time, you could use an ASCII art editor.

Unfortunately I couldn't find a good one for Linux. If someone has an idea, please edit here.

For Windows there's ASCII Art Studio (click on "Download" on the left bar).

Alternatively, there is JavE for Windows, Linux and Mac.

The metadata

Anything that's not between start and end is interpreted as metadata.

They are pairs of key and value

Any metadata is optional. But some are recommended, since they might be shown in-game on future versions. If you make a map, consider including those:

key description
name Name of the level. While the file name is something short and without spaces, here you can elaborate more.
author Name of who made this level. You can place you whole name, a nickname or anything. To include more info about you, see the other metadata keys below.
date Date when the level was made. It's recommended to be on the format MMM DD, YYYY (like Jul 21, 2014)
comment Pretty much anything you want (a message to the player, random song lyrics, etc). It goes to the end of line and it's recommended to not extend that much. Keeping less than 80 characters should be safe.

Besides the ones above, there are plenty of alternative metadata keys you may use. Don't worry about them, though:

key description
website Link to a website. It can be the author's homepage, the place where one can download other maps, and so on.
thanks Anything or anyone you might want to give credits to. If you make a map based on another it's a nice idea to thank the previous author here.