Fork me on GitHub

2018 Shakedown

written on December 31, 2018

Another glorious year is behind us and I'm here typing up a short summary of what I've been hacking on during the year.

All that being said, let me start by sharing the mandatory "last year in commits" chart generated by GitHub.

Sakura

I've been a long time terminator user, but as the years went by it got slower and slower, and buggier. Because of this, I ended up forking sakura and adding a couple of missing features like borderless window, etc.

Parsello

Parsello is a portable single file parser/lexer/tokenizer written in ANSI C (89).

Facts

#define PRS_IMPLEMENTATION
#include "prs.h"

const char *s = "...";

...

prs_context_t ctx;
prs_token_t token;

prs_init(&ctx, s);

while(prs_parse(&ctx, &token))
  printf("'%.*s' of type %s on line %d\n",
         token->len, token->s, prs_token_type_to_str(token), token->line);

...

You can check it out over here.

O2D3M

This project started as a plugin for Tiled, but then I turned it into its own standalone command line utility and made it work with a Wavefront OBJ file, rather than a Tiled map.

What it does? Well, it takes a Wavefront OBJ file, parses out all the meshes and turns them into brushes and entities thus producing a DOOM3 map, which then can be compiled via dmap.

You can learn more about it over here.

Testa

Made some improvements to Testa, my portable single file "(unit) test framework" for C/C++.

#include "testa.h"

int sample_magic_numbers(void)
{
    int a = 42;

    TESTA_ASSERT_EQUAL(a, 13);

    return 0;
}

int sample_more_magic_numbers(void)
{
    int b = 42;

    TESTA_ASSERT_EQUAL(b, 42);

    return 0;
}

int sample_that_will_be_skipped(void)
{
    TESTA_SKIP();

    TESTA_ASSERT_NOT_EQUAL(13, 13);

    return 0;
}

int sample_is_not_null(void)
{
    int *p = NULL;

    TESTA_ASSERT(p != NULL);

    return 0;
}

int sample_pointer_equality(void)
{
    int *p = NULL;

    TESTA_ASSERT_EQUAL(p, NULL);

    return 0;
}

int sample_swap_numbers(void)
{
    int a = 13, b = 14, tmp;

    tmp = a;
    a = b;
    b = a;

    TESTA_ASSERT_EQUAL(tmp, 13);
    TESTA_ASSERT_EQUAL(a, 14);
    TESTA_ASSERT_EQUAL(b, 13);

    return 0;
}

TESTA_SUITE_BEGIN
    TESTA_GROUP_BEGIN("sample test group")
        TESTA_TEST(sample_magic_numbers)
        TESTA_TEST(sample_more_magic_numbers)
        TESTA_TEST(sample_that_will_be_skipped)
        TESTA_TEST(sample_is_not_null)
        TESTA_GROUP_BEGIN("sample sub test group")
            TESTA_TEST(sample_pointer_equality)
            TESTA_TEST(sample_swap_numbers)
        TESTA_GROUP_END
    TESTA_GROUP_END
TESTA_SUITE_END

And the results can be seen on the screenshot below.

You can check it out over here.

LSL

While LSL (Lua Shading Language) is not something I ended up releasing just yet, it was a fun little experiment composed of devising a pure Lua based DSL to output GLSL 1.2.

The idea would be that one has "different" backends that can output HLSL, GLSL, MLSL, etc from a common source language, without abusing a preprocessor or writing an actual parser.

This is very much inspired by some of the work of Petri Hakkinen.

Sobinka

Sobinka is a portable 2D game engine and framework written in C and it started as a small experimental sandbox that I've started building to test out a couple of the game ideas that I've been toying around with the past 2 years.

It's made of a thin shell written in C that exposes relatively low level functionality via an immediate mode Lua API, which then can be used to build a game or even a regular desktop app.

Version 1.0.0 will support Linux, Windows, macOS (OSX) and HTML5 (web) via emscripten.

local tiled = import 'com.tiled'

local state = state or {}

function soa_on_init()
    soa_window_set_title('Binding')

    state.texture_id = soa_renderer_texture_load('textures/jerom')
    soa_renderer_set_texture(state.texture_id)

    state.map = tiled.find('maps/e1m1')
end

function soa_on_frame(dt)
    soa_renderer_clear(SOA_RENDERER_CLEAR_COLOR)

    tiled.draw(state.map)

    soa_renderer_draw(0, 0, 64, 64, 128, 128, 64, 64)

    soa_renderer_flush()

    if soa_input_mouse_clicked(SOA_MOUSE_BUTTON_LEFT) then
        soa_message_send('mouse_clicked', 'message mouse')
    end
end

function soa_on_message(id, message)
    print('on message', id, message)
end

function soa_on_quit()
    print('on quit')
end

I intend to post some more in-depth information about some of the technical aspects and decisions, in 2019; most likely after the first public release.

End

Until next time, as server said, END OF LINE.