RetroBlit
v3.4.0


Welcome to the RetroBlit game framework!

RetroBlit is a simple to use game framework implemented as a Unity Asset. It aims to create an ideal, low friction environment for making pixel-perfect retro games from the early 90s era. RetroBlit takes advantage of the portability, and the ease of deployment that Unity provides, but does away with the Unity Editor interface in favour of a traditional game loop, and code-only development. There are no scene graphs, no GameObjects, no MonoBehaviour, there is only a simple low level API for rendering sprites, fonts, primitives, and tilemaps. RetroBlit also provides a simple API for handling input and playing sound and music.

Have a look at this basic "hello world" program:

public class HelloWorld : RB.IRetroBlitGame
{
    public RB.HardwareSettings QueryHardware()
    {
        var hw = new RB.HardwareSettings();

        hw.DisplaySize = new Size2i(320180);

        return hw;
    }

    public bool Initialize()
    {
        return true;
    }

    public void Update()
    {
    }

    public void Render()
    {
        RB.Clear(Color.gray);
        RB.Print(new Vector2i(13780), Color.white, "Hello World");
    }
}

Let's have a closer look at what is happening here.

public class HelloWorld : RB.IRetroBlitGame

Every RetroBlit game implements the IRetroBlitGame interface, which contains the methods: QueryHardware, Initialize, Update and Render

public RB.HardwareSettings QueryHardware()
{
    var hw = new RB.HardwareSettings();

    hw.DisplaySize = new Size2i(320180);

    return hw;
}

The QueryHardware implementation simply populates the HardwareSettings structure and returns it back to RetroBlit. In this case we are specifying that our retro display should have the resolution 320 x 180.

public bool Initialize()
{
    return true;
}

In the Initialize method the RetroBlit game can perform its initialization. If it's successful it should return true. If false is returned RetroBlit will stop.

public void Update()
{
}

Game logic goes into the Update method which is called at a configurable fixed frame rate. However, in this simple program we don't have any logic to run.

public void Render()
{
    RB.Clear(Color.gray);
    RB.Print(new Vector2i(13780), Color.white, "Hello World");
}

Render is where all drawing happens. Here we simply clear the screen to gray, and print the string "Hello World" in the center of the display, using the default RetroBlit system font.

There is only one thing left, and that is to tell RetroBlit about our game. To do that we simply need to call RB.Initialize from a MonoBehaviour GameObject (the only MonoBeahviour object you'll need with RetroBlit!). Simply use this code:

using UnityEngine;

public class HelloWorldEntry : MonoBehaviour
{
    private void Awake()
    {
        RB.Initialize(new HelloWorld());
    }
}

That's it! Press Play in the Unity Editor, and you should see this output:

Hello World

You just made a pixel perfect Hello World game in Unity, without fiddling with camera settings, messing around with texture filters, or dealing with an overwhelming interface that was never designed for creation of retro style pixel perfect games.

RetroBlit comes with a bare-bones game that you can use as a starting template. Please see Assets/MyGame/Scenes/MyGame Scene and the Asssets/MyGame/Scripts/MyGame.cs source file.

More Examples

Hello World examples are great, but they're not very impressive are they? RetroBlit comes with some more entertaining example projects. Each demo project has its own Scene, have a look at Demos in Assets/Demos. Here is a quick preview:

Example Demo Reel

Feature Demo Reel in Assets/Demos/DemoReel

Example Super Flag Run

Super Flag Run in Assets/Demos/SuperFlagRun

Example Brick-Bust

BrickBust! A Complete bricker-breaker game in Assets/Demos/BrickBust

Example Retro Dungeoneer

Retro Dungeoneer, a complete roguelike game, find it in Assets/Demos/RetroDungeoneer

Example Custom Render

RetroBlit allows you to get a hold of it's rendering texture, and render it yourself in a Unity Scene, find an example of that in Assets/Demos/OldDays

What's Next?

Learn more about the RetroBlit feature set by exploring the Features section.

If you've never used Unity before don't worry! You only need a very basic knowledge of the Unity IDE which you can learn in the Unity Crash Course section.

If you need API details check out the API Reference. You can also have a look at the RetroBlit API directly in the Assets/RetroBlit/Scripts/RetroBlit.cs source file.