Getting Rusty

For those using a RSS reader, subscribe here: rss.xml

A new project I am picking up is re-visiting old game-engine projects, and rewriting them with better suited libraries and structure.

Java game-engine framework from highschool

This one used JFrame, and was already decent. It had code that belonged together, but was not enforced to stay grouped. Extracting these related bits of code does wonders for readability. This also fixed the lengthy-ness, and allowed names to make more sense in their context.

The last phase is what I absolutely love about refactoring; re-ordering and making it read like a newspaper, being able to understand the entire code by reading only the top sub-routine calls.

It gives me joy to be able to read code like this (translated to English, from the original java game-engine framework)

public BasicGame(int screenWidth, int schermHeight){
    this.width  = screenWidth;
    this.height = screenHeight;

    initWindow();
    initCompositor();
    initGameState();
    initIO();

    attachToWindow();

    gameLoop();
}