Project Longsword Dev Log #1 (Originally published on Wordpress)


I’ve decided to make my own custom BlackLetter font as I couldn’t find a satisfactory one for free. So far I’ve gotten lower case and upper case letters done. I’ve yet to add punctuation and extra symbols. Here are a couple of screenshots showing off the font:

I’m quite content with how it turned out, although I’ve been occasionally going back to tweak some of the letters every now and then.

In order to create the font and import it into Unity I used the following tools:

  • Photoshop + ShoeBox: ShoeBox is an addon for Photoshop that lets you convert an image into a font.
  • BitmapFontImporter: Generates .fontsettings files from the imported files which let you use the font in Unity text fields.

After drawing the font in Photoshop, I adjusted the letters to fit side by side as tightly as possible with the intended line-height as the canvas height:

Black background added for clarity. Transparent background preferred for actual conversion.

Then I dragged the saved file onto the ‘Bitmap Font’ button in ShoeBox:

This brings up a preview of your font. Clicking ‘settings’ opens up a window with additional options to modify your font. The ShoeBox website has helpful documentation to guide you through the process. Here are my settings below:

After clicking ‘Apply’ and ‘Save Font’, I imported the resulting files into Unity, where the BitmapFontConverter automatically generated a *.fontsettings file that can be used with Text fields.

Improvements to the Event System

I’ve reworked a part of the event system in order to reduce redundant checks among listeners. Previously I had a ScriptableObject event that would be referenced in an EventListener component. I have EventVariables that invoke the respective event when their value is changed. Having a ScriptableObject represent events meant that using events for UI stuff such as status bars for individual enemies would result in having to make multiple redundant calls that would be ignored after checking if the sender matches the target. Instead I added event listeners on a ‘local’ level, LocalEventListeners, that disperse events within a single prefab of a game object. Basically I took out the ScriptableObject ‘middle-man’, initialising the EventVariables in script with the referenced LocalEventListener. I still have ScriptableObject events, but they are used for more global operations.

Here’s what a generic EventVariable class looks like:

public class LocalEventVariable<T> : IEventVariable<T>
{    
    [SerializeField]
    private GameEventArgs event_config;
    [SerializeField]
    protected T _value;
    public T value
    {
        get
        {
            return _value;
        }
        set
        {
            _value = value;
            if (response)
            {
                response.Invoke(_value, event_config);
            }
        }
    }
    protected LocalGameEventListener<T> response;
    public LocalEventVariable(T value,
                               GameEventArgs event_config,
                               LocalGameEventListener<T> response)
    {
        this.response = response;
        this.event_config = event_config;
        this.value = value;
    }
    
    public void Invoke()
    {
        response.Invoke(value, event_config);
    }
}

Note how the variable automatically invokes the attached response whenever the value is changed. This takes away the need to invoke the response manually reducing chance of error.

Actual Menus

Finally, as you might have already noticed, I’ve added menus to the game. I’m still very new to implementing UI elements in Unity but I’m slowly getting used to them. Nothing much to say about menus other than that.

If you’d like to follow the game’s progress, I post almost weekly videos to my progress log on youtube. I also share my updates on twitter @B_Bugeja.

Get Revenge At Last

Leave a comment

Log in with itch.io to leave a comment.