Textics


Hi guys!

I want to show you a little videogame I wrote, named Textics. It’s a textual game, played directly on the console, without any graphics.

The aim of the game is to reach the exit of each room without being captured by the enemies. Some of them will not move, and you just have to avoid walking in front of them. Instead, other ones will move following pre-determined patterns, so it will be very useful to observe where they go before to move!

The game area is divided in rows and columns, like a chessboard: every cell is univoquely identified by two coordinates, like (A;g).

Following, a screen of the game:

Textics screenshot

Legend:

  • P: player’s position
  • E: enemy’s position
  • +: enemy’s view: if you walk on it, you will be caught!
  • X: exit
  • | or _: these represents an horizontal or vertical wall, which the player cannot walk on and enemies look through (of course!).

Controls

You can use the following commands:

  • goto Xy: go to the (X; y) cell. Attention: the player can only move on a straight line!
  • wait: wait one turn, so you can observe how the enemies move;
  • exit: go through the exit e continue with the next level. It can be used only if the player is on a cell adjacent to the exit.
  • menu: go back to the main menu.
  • quit: close the game.

Levels

Levels are saved in the levels.dat file. It is an XML file, that is read from the executable and used to create levels’ map. The user can freely modify it in order to create new levels or modify existing ones.

Here’s how. First of all, you need to create a <level id=”xx”>…</level> node at the end of the file (inside <levels> root), and update the counter <levels count=”xx”> at the beginning of the file.

Here’s the list of the possible elements you can add into the level. Please note: x and y coordinates of each node must be numeric value between 0 and 19.

Mandatory nodes are:

  • <player x=”xx” y=”yy” />, that represents player’s position;
  • <exit x=”xx” y=”yy” />, that represents exit’s position.

The other, optional nodes are:

  • <hwall x=”xx” y=”yy” />, that represents an horizontal wall, that is identified on the map by ‘_’ character;
  • <vwall x=”xx” y=”yy” />,  that represents an horizontal wall, that is identified on the map by ‘|’ character;
  • <enemy x=”xx” y=”yy” view=”u/r/l/d” />, that represents one enemy. The view parameter, that can be equal to u, r, l, d, tells where he is looking: in order, up, right, left, down.
    • Enemies can move along pre-determined paths. You need to add into the enemy node, a node called <movement>; in it, you need to add as many <point> nodes as the points the enemy will reach (excluding the starting point). The syntax is: <point x=”xx” y=”yy” view=”u/r/l/d” />.
  • <dialogue>, that can be inserted at the beginning of the <level> node: you can insert the text you want to be viewed to the right of the map in it, enclosed by the tag <![CDATA[ … ]]>. It must be no longer than 20 rows, and each of them must contain no more than 30 characters.

Conclusions

Nowadays, the game counts only 10 levels, so it will take no more than a few minutes to be completed. Any progress is saved when you complete a level, and the game can be resumed at any time.

Probably, I will add an inventory system, giving the player the ability to get different items, like keys to open level’s exit, or other gadgets.

You can find the source code in the repository, and the archive with the executable can be download here.

Stay tuned!

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...