Why Use Slick?

Slick logoI talk about the Slick 2D game library a lot because I use it a lot, and with good reason. I thought I’d take a minute to go over some of that reason and give a little overview of what Slick is.

Slick is, like I said, a 2D game library written in Java. A game library is essentially a framework which provides a big chunk of functionality that is useful or necessary for creating a game. This primarily involves rendering the visual aspect of the game, but also includes some conveniences such as implementing the game loop and providing simple methods of changing the game parameters (such as the window resolution and FPS limit).

Slick is written in Java, is open source, and uses the Lightweight Java Game Library (LWJGL) for rendering. Many (if not all) of the ‘serious’ commercial game libraries and engines are written in C++, mainly for performance reasons, but Java has its advantages:

  • All the code runs in the Java Virtual Machine (JVM) which is implemented on most operating systems, meaning a game written in Java will be playable on Windows, Mac, Linux and other systems, with no extra effort from the developer.
  • There are a couple of low-effort, high-convenience deployment methods for Java programs. They can be automatically downloaded and run locally using the Java network language protocol (JNLP), or run in a browser applet embedded in a Web page. Both methods ensure the end user always has the latest version.
  • Java is a much more developer-friendly language than C++, which counts for a lot on a project as large and diverse as a game.
  • The performance typically isn’t quite as good as C++, but it’s more than good enough more often than not, especially for 2D games.

It should also be noted that there are an increasing number of handy C# game libraries, comparable to Java but with DirectX support at the cost of being cross-platform (or at least cross-non-Microsoft-platform).

But how does Slick compare to other Java game libraries? The most comparable alternatives in the 2D arena include GTGE (last updated in 2005), JGame (still active, and ported to Flash), and PulpCore (primarily for applets and animation). There are some 3D options too, such as libgdx and the Java Monkey Engine (JME), which can of course render 2D graphics, with a little more arm-twisting. The main advantage of Slick however is that it’s very easy to use, and remains consistently so thanks to its exclusive focus on 2D graphics.

It also provides a lot of practical features out of the box, best expressed in bullet point form:

  • Graphical flexibility for drawing images, primitives, and fonts using OpenGL.
  • Integrated sound and music playback with OpenAL.
  • Integrated and very easy input handling for keyboard, mouse and controllers.
  • Handy functionality built into the library, such as game states and path finding support.
  • Additional libraries to provide further features, such as powerful tilemap support and particle editing.
  • Helpful community, continued development and extension, and plenty of documentation and tutorials.
  • Total library download size of under 2MB, including LWJGL.
  • Open source and totally free (BSD license)!
  • A build in development for Android support, further extending the reach of your code.

Although it may not offer some of the more advanced features such as 3D graphics and physics, it’s a good (perhaps the best) choice for those games that don’t need them. Honestly, the main reason I started using Slick was because it was prescribed in one of my university subjects, but there was good reason for that too. I’ve yet to find a more suitable framework for painless development of 2D Java games.

As an added bonus, it’s the target library of the Artemis framework which I’ve fallen in love with recently, and which I will write more about very soon.

2 thoughts on “Why Use Slick?

    • Ah yes, right you are. My apologies. I tend to use the terms library and engine interchangeably out of laziness. Perhaps also because I’ve not worked seriously with something powerful enough to be called an engine before. I’ll fix that up.

      I’d not heard of libGDX before, and it does look very interesting, though significantly more complex than Slick. I draw a solid line between a 2D library and a 3D library that can appear 2D with an orthographic camera. When the first couple of tutorials have you drawing flat meshes from vertices, that raises a flag.

      That said, the native Android and 3D support and obvious focus on performance (reminiscent of Haaf’s (2D) Game engine (which is also really a library)) is very nice, and could be a good step up from Slick once one is comfortable with one’s game development chops and looking for more of a challenge. Thanks for pointing it out!

Leave a Reply