Saturday, March 31, 2018

Milestone reached

There I sat today, in one of my favorite cafes in Chiang Mai called Ombra. It is decorated with American and European antiques. Organized, to avoid seeming gaudy or noisy. It feels like visiting someone's home. Alternative rock plays in the background, from a hidden speaker near the unplugged record player. A typewriter sits on a display desk, near books and records of classic rock bands. The hot cafe lattes contrast with the cold air-conditioning. I realize hours have passed, when my laptop alerts me that its battery is running low.

Other days I may visit the London Tea Room, which is like sitting in the lobby of Fawlty Towers.

The spacious cafe called CAMP is open 24/7 on the top floor of the nearby mall. The usual selection of Thai food vendors are just one convenient escalator ride down.

But back on track, I deployed a build of my game to my Android phone and then left Ombra. It looks and sounds great, thanks to my shopping sprees in the Unity asset store and sonniss.com. This game has a lot of potential if I keep at it. Here I am holding it up in my apartment, before going out for dinner around the corner:



Unlike my previous titles, I plan to go for an early release, but continue to nurture it full-time. It will get the attention it deserves through additional characters, items, features, and things requested by the community. The first version probably will only contain 50% of the anticipated total content to allow for flexibility.

Monday, March 19, 2018

A mini debug tool in Unity

There are many ways of creating a tool to debug a game. Console commands on run-time is a common one. In-game rendered menus is another. In Unity I have been using a simple game object that has a script that exposes check-boxes which act as either toggles or buttons (they automatically get unchecked). It's sufficient for my needs. It's like having a handy dandy remote control with a bunch of options to speed up testing.

The inspector of the single debug game object in the Unity scene will look something like this:


And the script is as simple as this:

 using System.Collections;  
 using System.Collections.Generic;  
 using UnityEngine;  
 public class EPDebug : MonoBehaviour {  
      public bool toggle1;  
      public bool toggle2;  
      public bool option1;  
      public bool option2;  
      public bool option3;  
      [HideInInspector] public static EPDebug instance;  
      public void Awake() {  
           instance = this;  
      }  
      public void Start () {  
      }  
      public void Update () {  
           base.Update();  
           if (toggle1) {  
                // do stuff each frame  
                // other game objects can check this variable too  
           }  
           if (toggle2) {  
                // do stuff each frame  
                // other game objects can check this variable too  
           }  
           if (option1) {  
                // do something once  
                option1 = false;  
           }  
           if (option2) {  
                // do something once  
                option2 = false;  
           }  
           if (option3) {  
                // do something once  
                option3 = false;  
           }  
      }  
 }  

I have a toggle that has the game print out verbose information regarding game states and whatever information suits me. I use the button options for creating spontaneous game objects and invoking commands like giving some in-game currency. This debug menu can be extended with number fields to change global variables too.