Skip to main content
  1. Posts/

Day 3 - Some Abysmal Visuals

OldDays ste-reez-muvi Unity csharp

So I gave in to nostalgia and made more of the textures green-text-on-black:

Old school terminal aesthetic
Old school terminal aesthetic

I think I’ll leave the base layer like that until I can take the time to make something nice. In the game, each cell is supposed to be 10 feet by 10 feet, but the Z values in the map are in single feet instead of tens of feet. So let’s fix the position and scale of the blocks:

Vector3 position = new Vector3((-1f) * 
                               cells[v].X, (-1f) * 
                               cells[v].Y, 0.1f * 

Make the cell prefab only one foot thick
Make the cell prefab only one foot thick

So now the cells are one foot thick and positioned appropriately to the map scale. But that makes it really difficult to see into the dungeon:

Extreme angle to try to see dungeon under surface layer
Extreme angle to try to see dungeon under surface layer

What we need is some sort of Z-filter so we can choose what is the highest layer we want to see. Let’s keep track of the Z planes in the MapManager:

public int[] zPlanes; // Array of elevations of Z planes, as copied from Map
public int currentZTopIdx; // Index into zPlanes for highest elevation currently visible
zPlanes = ourMap.ZPlanes.ToArray();
currentZTopIdx = zPlanes.Length - 1;

Then add a method to cycle up or down through the layers, turning off the renderers on any block above the current layer.

public void CycleZ(bool up) {
  currentZTopIdx += (up ? 1 : -1);
  if (currentZTopIdx < 0) currentZTopIdx = 0;
  if (currentZTopIdx >= zPlanes.Length) currentZTopIdx = zPlanes.Length - 1;
  Renderer currBlockRend;
  foreach (Vector3 v in cell_transforms.Keys) {
    currBlockRend = cell_transforms[v].GetComponent<Renderer>();
    if (v.z > zPlanes[currentZTopIdx]) {
      currBlockRend.enabled = false;
    } else {
      currBlockRend.enabled = true;

Then over in the GUIManager let’s let the A and Z keys cycle the layer up and down, and display the current top layer:

void Update () {
  if (Input.GetKeyDown (KeyCode.Z)) {
  if (Input.GetKeyDown (KeyCode.A)) {
GUI.Box (new Rect (0,Screen.height - 50,100,50), "Z top\n" + map_manager.zPlanes[map_manager.currentZTopIdx]);

Despite the fact that we’re touching the renderer on every block, it works pretty fast:

Peeling back the layers
Peeling back the layers

Now we’re ready to try watching a live game world.

Day 3 code

Useful tool: ScreenToGif