JTwoD - Yet another 2D Java game engine

Last edited on February 01, 2020
java gaming game engines

i know, this is really late

Let me start at the beginning.

Passion & Glide

In early 2013 I had decided I was determined to make a game from scratch, without the use of any sort of engine such as Unity, Unreal or Game Maker.

Already having a lot of experience in Java writing plugins for what was at the time the most popular Minecraft server software available: Bukkit, I decided Java would be a good place for me to start. I began watching youtube videos on how to go about making a game in Java. Not having a lot of experience working with graphics libraries at the time, I landed on using Java’s Canvas libraries which allow you to pretty easily render out objects. And so, I set out to work on what would be my first “From Scratch” game: Glide.

Glide was a fairly simple space shooter with extremely broken functionality. But despite its terrible design and shotty code, I became passionate about adding features to it. It grew to be a pretty fun and challenging game to play, albeit resource intensive.

as you can see, by end game things could get pretty hectic

Moving forward I would pick up and set back down development on Glide, but rarely add any major changes. An audio update here, a performance modification there. But never anything major.

Until now… And by now I mean about a year ago.


yes, that’s the best name i could come up with

After not really touching Glide (or any other game development for that matter) for several years, my passion for creating 2D java games was rekindled when I stumbled upon some old snippets from Glide lying around on an old hard drive.

Hey, why not take the work I was doing on Glide years ago and apply all of the experience I’ve gained since then and make something even better, hell, why not go all out and make a game engine.

– Me, (i didn’t really say this ever)

So I started working on a new Game engine using the same basic Canvas platform Glide was built on. The difference here being that the entire system was built much more generically.

With things such as Entities, Drawables, Scenes, SpriteSheets, and built in simplified drawable shapes that could be added to groups to create more complex shapes, JTwoD was a large step up from what it once was as Glide.

In Action

Here are some snippets from the engine so that you can see a bit of how it works.

Adding a drawable to a scene.

// Create a new logo Text object to add to the
// drawables for this scene.
Text<PongEngine> logoText = new Text<PongEngine>(
    "Dropshot Pong",
    new Font("System", Font.BOLD, 48),

. . .


Modifying the Velocity of an Entity

// Handle the ball colliding with another entity
// The only other entities on the screen will be the two paddles
// so we can simply reverse the horizontal velocity of the ball
// The vertical velocity for the ball is controlled using the
// onConstrained event handler for the ball.
public final void onCollide(Entity<PongEngine> entity)
    if (this.started) {
        if (entity instanceof Paddle) {
            Vector currentVelocity = this.getVelocity();

            this.worth += 1;

The Future

I’ve mostly stepped away from development of JTwoD over the last year or so due to how many other things I’ve been doing, however after sitting down to write this post I feel like I may step back into it again.

We’ll see what happens.

At the very least, I’ll probably get the documentation finished for it.

Until then, feel free to check out these examples on how to implement Glide into your own 2D Java game.

View JTwoD on Github

Nathan Fiscaletti
Nathan Fiscaletti
Software Engineer