Archive from December, 2011
Ludum Dare was really an eye opening experience for me. I had a ton of fun and I’m getting an amazing amount of feedback from the indie gamedev community, which is fantastic! I think as a result of the experience, I’m going to continue developing “The Wizard Apprentice” prototype into a more feature-full game. I love doing the level and puzzle design, and dropping the assets in and playing with them is really a blast! I’m not going to abandon HexDev, but it’s currently sitting on my back burner.
I decided to run with the concept, and fix a lot of things, keeping some of the puzzles the same, rewriting some, and adding a lot more content. I’m probably going to rename the game, because the name is too generic and I literally decided on the name in the last 10 minutes of the competition while I was submitting my entry.
I’ve done a couple of things so far, worth mentioning, so here’s a glimpse:
- I’m revamping the way my modelling in Blender was done, so I have cleaner transitions and better control over connections like the stairwell.
- Opened up the room depth, taking full advantage of the “octagonal space” on each floor.
- Stairwells no longer require a turn halfway through (I’m not sure if this will make it harder or easier, but so far I like the new style better)
- Adding Toon-Style shading where appropriate
- Fixed some camera angle issues to give better depth perspective. (may tweak this some more)

Lots more to come! Stay tuned!
So this weekend, starting Saturday evening, I decided I was going to enter Ludum Dare 22 and try to hammer out a game in less than 48 hours! Being a husband and father, I found it very difficult to actually get a lot of time spent on this, so I would say in total I had about 16 hours of committed time on this project, so all things considered, I think it was a pretty good run for it’s worth. And it was fun!
Play: The Wizard Apprentice

Things I would have liked to do if I had the full 48 hours of dedication:
- Sound!
- Textured walls
- Animated Avatar
- Cleaner controls
- Better GUI
- More Magic (but he’s only an apprentice).
But hey, with such strict time limitations, not a whole lot you can do, so without further ado, go enjoy The Wizard Apprentice!

Oh, and I posted a new
HexDev Alpha Build tonight as well, because it’s been a while since I’ve updated it.
Quick feature list off the top of my head:
- Ice
- Penguins
- Alligators
- Bow & Arrow
- Pickaxe
- Mineable Copper Ore
- Ash
- Caves
- Skeletons
- Edit: Treasure Chests (with nothing in them and very cool audio)
Coming soon: Banjos and Penguin mounts?
I found an interesting discussion on Eric Heimburg’s G+ page about “floaty numbers” in Unity, and offered to share my solution to this problem as seen in HexDev, so here it is! Maybe someone will come looking for Scrolling Combat Text in Unity and this code will help!
So to get things started, here’s a quick screenshot of the implementation in HexDev:

Concept
The basic concept is to display numbers above a unit whenever they take damage. The number should rise for a certain height at a given speed and then poof away! Nice and simple right?
So, to do this using my approach, we need a couple things:
- A Prefab with a TextMesh component attached.
- A Unit object with a MonoBehaviour attached that calls: SendMessage(“DamageTaken”, x); where x is the number to be displayed.
- The ScrollingCombatText behaviour below attached to the GameObject that you want to display SCT numbers.
So, Step 1) In my projects, I have created a prefab called SCTText which looks like this:

Nothing fancy, again just a GameObject that has a TextMesh object on it. The beauty of it is that you can change this prefab to have a mesh or particles or whatever you want on it. The number will be updated by the ScrollingCombatText script below.
For step 2, all of my units have a special behaviour attached to them that manages their health. Whenever they take damage, they simply use the Unity SendMessage API to notify other MonoBehaviour’s attached to the game object that the unit has taken damage. This will probably need to be tailored to your project.
And for step 3, I just attach the script below to my GameObject, give it the Prefab we defined in step 1, configure some parameters and whenever the unit takes damge, voila! Scrolling combat text! Here’s what the configuration of the script looks like on my units (each unit can have their own values or we can use the default values):

Code – ScrollingCombatText
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ScrollingCombatText : MonoBehaviour
{
// How fast will the spawned text object rise
public float RiseRate = 4.0f;
// How high should the spawned text object rise
public float RiseHeight = 10.0f;
// Prefab with an attached TextMesh component that will be spawned when damage is taken
public GameObject TextPrefab = null;
private List floatingTextObjects = new List();
// This will be the starting height of the floating numbers
private float initialHeight = 0.0f;
// Use this for initialization
void Start ()
{
// If this component is attached to a CharacterController, use the CharacterController's height attribute to set the initial height
CharacterController charController = gameObject.GetComponent();
if (charController != null)
initialHeight = charController.height;
}
// Requires the GameObject to have a method call to: SendMessage("DamageTaken", int)
void DamageTaken(int damageAmount)
{
// Create a new text object and set the starting height and text
GameObject textInstance = (GameObject)Instantiate(TextPrefab);
textInstance.transform.parent = gameObject.transform;
textInstance.transform.localPosition = new Vector3(0, initialHeight, 0);
TextMesh mesh = textInstance.GetComponent<TextMesh>();
mesh.text = damageAmount.ToString();
// Add to the list of floating text objects to update every frame
floatingTextObjects.Add(textInstance);
}
// Update is called once per frame
void Update()
{
// Cache all text meshes to be deleted and later delete them
List objectsToDelete = new List();
foreach (GameObject floatingTextObject in floatingTextObjects)
{
float riseDelta = Time.deltaTime * RiseRate;
Vector3 newPosition = new Vector3(floatingTextObject.transform.localPosition.x, floatingTextObject.transform.localPosition.y + riseDelta, floatingTextObject.transform.localPosition.z);
floatingTextObject.transform.localPosition = newPosition;
floatingTextObject.transform.LookAt(floatingTextObject.transform.position + Camera.mainCamera.transform.forward);
// Delete this floating text object if it exceeds our RiseHeight property
if (floatingTextObject.transform.localPosition.y >= initialHeight + RiseHeight)
{
objectsToDelete.Add(floatingTextObject);
}
}
foreach (GameObject objectToDelete in objectsToDelete)
{
floatingTextObjects.Remove(objectToDelete);
Destroy(objectToDelete);
}
}
}