_images/logo_large.png

v1.5.0

Welcome to the FES retro game framework!

FES is a simple to use game framework implemented as a Unity Asset. It aims to create an ideal, low friction framework for making pixel-perfect retro games from the early 90s era. FES 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. FES also provides simple APIs for handling input and playing sound and music.

Have a look at this basic “hello world” program:

public class HelloWorld : FES.IFESGame
{
    public FES.HardwareSettings QueryHardware()
    {
        var hw = new FES.HardwareSettings();

        hw.DisplaySize = new Size2i(320, 180);
        hw.ColorMode = FES.ColorMode.RGB;

        return hw;
    }

    public bool Initialize()
    {
        return true;
    }

    public void Update()
    {
    }

    public void Render()
    {
        FES.Clear(new ColorRGBA(128, 128, 128));
        FES.Print(new Vector2i(137, 80), new ColorRGBA(255, 255, 255), "Hello World");
    }
}

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

public class HelloWorld : FES.IFESGame

Every FES game implements the IFESGame interface, which contains the methods: QueryHardware, Initialize, Update and Render

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

    hw.DisplaySize = new Size2i(320, 180);
    hw.ColorMode = FES.ColorMode.RGB;

    return hw;
}

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

public bool Initialize()
{
    return true;
}

In the Initialize method the FES game can perform it’s initialization. If it’s successful it should return true. If false is returned FES 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()
{
    FES.Clear(new ColorRGBA(128, 128, 128));
    FES.Print(Vector2i.zero, new ColorRGBA(255, 255, 255), "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 FES system font.

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

using UnityEngine;

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

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

_images/output_helloworld.png

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.

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

More Examples

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

_images/example_reel.png

Feature Demo Reel in Scene Assets/FES/Scenes/DemoReel and source file Assets/FES/Scripts/Demos/DemoReel/DemoReel.cs

_images/example_sfr.png

Super Flag Run in Scene Assets/FES/Scenes/SuperFlagRun and source file Assets/FES/Scripts/Demos/SuperFlagRun/SuperFlagRun.cs

_images/example_bb.png

BrickBust! A Complete bricker-breaker game in Scene Assets/FES/Scenes/BrickBust and source file Assets/FES/Scripts/Demos/BrickBust/BrickBustGame.cs

What’s Next?

Learn more about the FES 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 FES API directly in the FES/Scripts/FES.cs source file.