UX2Engine - 2D Game Engine

Hello everyone, I just thought I’d post here to showcase a project I’ve been working on for quite some time.

Ux2Engine is a framework for developing 2D games that I’ve built from the ground up to be pluggable into different types of APIs and frameworks, designed with speed and simplicity in mind.

The flagship game behind the engine is Renoria, a 2D MMORPG currently in development by my company Uxsoft:

For more info on Renoria please check out my other topic: http://www.java-gaming.org/topics/renoria-java-mmorpg/30991/view.html

Current features of the engine:

  • Pluggability - Plug any renderer, physics engine or audio renderer you want! Java2D/AWT, LWJGL and JOGL/NEWT currently supported. Audio currently only supports JavaSound and Physics engine currently only supports Box2D, but support for any framework can be added.
  • Need to load encrypted resources? Just add a filter driver into the AssetManager and away you go!
  • Need to load a custom format into the game? Just plug in your custom loader into AssetManager and all the details are hidden from you :wink:
  • Built in networking module running on Java NIO, all you need to implement is the protocol encoder & decoder!
  • Fine tune any part of the engine without changing the engine itself, just extend any classes derived from the engine!
  • LWJGL module has a TextureLoader which uses dynamic texturepacking to improve performance by decreasing amount of bindTexture calls. Also has young/old generation textures to better manage VRAM.
  • Prefer immediate mode? Just plug in an immediate mode renderer, or prefer VBO graphics? Just plug in the LWJGLVBORenderSpace :slight_smile:
  • Input details are also transparent, all you need to provide is an InputHandler and the actual details of whether its using LWJGL, Swing or NEWT is completely hidden

Example code from Renoria that shows the engine in action (runtime choice between Java2D or LWJGL):


UxEngineOptions options = new UxEngineOptions();
options.fullscreen = useFullScreen;
UxAssetProvider renoriaEncryptedProvider = new RenoriaEncryptedAssetProvider();
options.displayMode = new UxDisplayMode(requestedWidth, requestedHeight, 32, UxDisplayMode.REFRESH_RATE_UNKNOWN);
options.setComponent(UxComponent.RENDERER, useJava2D ? new Java2DRenderer() : new LWJGLVAORenderer());
options.setComponent(UxComponent.ASSET_MANAGER, new UxAssetManager(useJava2D ? new Java2DBufferedImageAssetProvider(renoriaEncryptedProvider) : new GLTextureAtlasBuilderAssetProvider(renoriaEncryptedProvider, runOptions.getOptionalInt("textureCacheSize", 10))));
options.setComponent(UxComponent.PHYSICS_ENGINE, new RenoriaPhysicsEngine());
options.setComponent(UxComponent.INPUT, new RenoriaInputHandler());
options.setComponent(UxComponent.NETWORK, new RenoriaPacketCrypto());

Ux2Engine engine = new Ux2Engine(options);

UxEngineWindow wnd = useJava2D ? (new SwingDoubleBufferedEngineWindow(engine) : new LWJGLEngineWindow(engine) );

wnd.loop(new RenoriaGameLoop());

Example screenshots of my stress testing for it:

Java2D renderer (80 FPS, 2000 sprites)

LWJGL renderer (with index buffer, vbo and texture packer) (200 FPS, 5000 sprites)

LWJGL renderer (with immediate mode and textureRect) (120 FPS, 5000 sprites)

I’m thinking about opensourcing parts of the engine later on, so other people can put it to use (once the main game using the engine is complete!)