spooky intro

an intro to my spooky game thing

2 min 392 words
Jason Short it's me!

Intro

I'm a DevOps engineer professionally, but I love game development as a hobby. For years, I played around with various game engines, even starting (and stopping) my own little hobby game engine projects.

A few years ago, I began a project inspired by Sierra adventure games developed in Sierra's proprietary AGI/SCI engines, particularly "The Colonel's Bequest" by Roberta Williams. The project is currently titled "Spooky," because I'm basic.

You can find the (huge mess) of code here. It won't do much because I maintain all assets privately, but you can peek at the code if you like.

Code

I enjoy coding (as a hobby) in C. Professionally I write mostly in JavaScript/TypeScript and C#, but I'm fluent in many others. I find C fun to work with, though I'm certainly no expert.

You may find while looking through the source code that I write C in a somewhat loose interpretation of object oriented programming. It's... certainly a choice! I tried a few iterations of C++, but kept falling back to C for raw simplicity. I'm in no way critical of C++, I simply prefer C.

Here's an example:

/* header sp_font.h */
struct sp_font_data;
typedef struct sp_font sp_font;

typedef struct sp_font {
    const sp_font * (*ctor)(
        const sp_font * self,
        SDL_Renderer * renderer
        /* ... addt'l parameters */
        );
    const sp_font * (*dtor)(const sp_font * self);
    void (*free)(const sp_font * self);
    void (*release)(const sp_font * self);
    /* addt'l instance methods removed for simplicity */

    struct sp_font_data * data;
}

/* Allocate (malloc) interface */
const sp_font * sp_font_alloc();
/* Initialize interface methods */
const sp_font * sp_font_init(sp_font * self);
/* Allocate and initialize interface methods */
const sp_font * sp_font_acquire();
/* Construct data */
const sp_font * sp_font_ctor(const sp_font * self,
    SDL_Renderer * renderer
    /* ... addt'l parameters */
    );
/* Destruct data */
const sp_font * sp_font_dtor(const sp_font * self);
/* Free interface */
void sp_font_free(const sp_font * self);
/* Destruct and free interface */
void sp_font_release(const sp_font * self);
/* Addt'l functions... */

Implementation details are hidden in the source file, something like:

/* compilation unit sp_font.c */
typedef struct sp_font_data {
    SDL_Renderer * renderer;
    TTF_Font * font;
    SDL_RWops * stream;
    /* addt'l properties... */
} sp_font_data;

/* Simplified: */
const sp_font * sp_font_alloc(void) {
  sp_font * self = calloc(1, sizeof * self);
  if(!self) { abort(); }
  return self;
}

Admittedly, it's not very pretty. But I like it ¯\_(ツ)_/¯

Screenshots

Spooky Screenshot

CC-BY-SA

spooky code is made available under the Creative Commons CC-BY-SA license.