Singapore-MIT GAMBIT Game Lab spacer
spacer New Entries Archives Links subheader placeholder
left edge
Tile time

Just got over one of the big hurdles: Unity now loads levels from a text file!

To make the code easier to test along the way, I actually wrote the series of functions used by level loading backwards. I started with the code to create a tile, given the locations of the walls... then the function that finds the locations of the walls, given an integer tile code and a char to indicate direction... then the code to parse an input string into an integer and a char... and finally, I adapted Caryn's text file reading function to create a 2D array of input strings. Despite all the testing, no is more surprised than I am that it worked in the end. In the process, I learned a lot of new and annoying things about Unity. Such as that it apparently has its own set of capitalization conventions for C#, which differ from the usual C# syntax.

Here's a simple level I created to test the tiling functions:


Here's a picture of the Abandon level Waterfalls, the first level I tried reading from a text file, loaded into Unity.


After getting to the point where the program could read in a text file, I found out that the code that decided where to put the walls was buggy, so I fixed it and made some other adjustments. Here's the level in Unity after the changes:


And finally, for comparison, here's a partial view of the same level in Abandon:


right edge
bottom curves