teaching machines

HNRS 304.503 Lab 4 – Tiled platformer

Game design is not for coders alone. In this three-week lab, you and your chosen partner (not the same as you partnered with for lab 3), will create a tile-based platformer whose levels can be designed in a plain old text editor.

For example, I might have a level comprised of blue spheres and orange cubes. Instead of laying the scene out in Unity’s scene view, I compose the following text file:

B B B B B B
 O O O O O 
B B B B B B
 O O O O O 
B B B B B B

Easy!

I read that file in a Unity script, parse its contents, and instantiate prefabs to fill the scene. The result is nice:

A scene in Unity whose game objects are generated from a text file.

This kind of system lets coders code and designers design. (Even if you fill both roles, game tools like level editors are invaluable!) Your task is to create a game that uses a level loader in this fashion.

Requirements

Consider the following as you create a game:

  • Write a platformer with a third-person camera. 2-D is recommended. Consider collisions and gravity.
  • Your team should agree on what types of tiles you want to support. Come up with a simple one-letter code to represent each type.
  • To keep things simple, game worlds must be treated as a rectangular grid of tiles. Each cell has the same width and height. A game world described otherwise can’t be mapped out with a grid in a text file.
  • Text files should be dropped in a directory named Resources in the project assets. Make sure you have a *.txt extension on their file name before importing.┬áLevels can be read by calling Resources.Load(“filename-without-extension”). You’ll get back a TextAsset. Consult its documentation for how to extract the text. It can be parsed with C#’s StringReader. Please don’t use external files. They complicate targeting the web platform.
  • Don’t forget that you are creative people.
  • Publish your games in a post mortem on this blog before November 12.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *