/lionengine

Java 2D Game Engine

Primary LanguageJavaGNU General Public License v2.0GPL-2.0

LionEngine

Build Status Coverage Lines of code Maven Central License

Summary

Presentation

The LionEngine is a game engine especially developed during the project [Lionheart Remake] (http://www.b3dgs.com/v7/page.php?lang=en&section=lionheart_remake) for an easy Java use. The engine is as a library, in Jar format (including its javadoc), which can be included in any project; for utility class uses, or to directly implement and inherit a game skeleton (including management of frame rate, extrapolation, input output...).

Using Java 6 internal libraries, it is specifically designed for 2D games (no support for 3D at the moment), and proposes a set of functions for 2D resources management (images, sprites, animations, tiles...). Inputs and outputs are also available, with an easy keys retrieval, mouse movement... Management of music file are also available (Wav, Midi, and more using plug-ins, such as Sc68). Windowed, full-screen and applet formats are fully supported, with a complete frame rate control.

In its current version, the engine greatly simplifies the development of Platform, Strategy and Shoot'em Up games, and also Network layer.

Since the version 6, it supports Android 1.5 (API 3). The only change to perform is the gameplay part, as the 'mouse' and 'keyboard' concepts are different on Android. Everything else is fully compatible and does not require any changes.

Since the version 7, it includes an abstract editor that should allow to write easily a dedicated levels editor for your game. It can also be used as default editor without any add-on, just run and import a project from your game compiled sources !

General Features

  • lionengine-core

  • Simple initialization, with version control, screen configuration and resource directory
  • Extrapolation control (machine speed independent)
  • Advanced filtering capability (Bilinear, HQ2X, HQ3X)
  • Sequence control (intro, menu, game part, credits...)
  • Easy resource management (relative to resource directory)
  • Advanced image usage (sprite, animation, tile, font, parallax)
  • File I/O (binary & XML reader & writer)
  • Utility classes (Random, Conversions, Maths, File...)
  • Verbosity control
  • lionengine-core-awt

  • Engine implementation using AWT from JDK 6
  • lionengine-core-swt

  • Engine implementation by using SWT 3.5.1
  • lionengine-core-android

  • Engine implementation using Android 1.5 (API 3)
  • lionengine-game

  • Camera management (view and movement)
  • Cursor (synced or not to system pointer)
  • Background package (for an easy background composition)
  • Tile based map package (with minimap support, native save & load function)
    • Ray cast collision system
    • Compatibility with raster bar effect
    • A Star pathfinding implementation
    • Tile extractor (generate tilesheet from a level rip image)
    • Level rip converter (generate a level data file from a tile sheet and a level rip image)
  • Object base (support external XML configuration, trait system)
  • General object factory system (create instance of object)
  • Objects handling system (updating them, rendering, and retrieving)
  • Extensible Trait system to compose object characteristics without code complexity
    • Transformable (size and translation)
    • Body (gravity handling)
    • Launchable (launcher and projectile system)
    • Rasterable (object raster bar effect)
    • Producible (ability to produce other objects)
    • Collidable (collision handling)
    • ...
  • lionengine-network

  • Server & Client system
  • Customizable network message
  • Integrated chat system
  • lionengine-audio-wav

  • Support for Wav sound
  • lionengine-audio-midi

  • Support for Midi music
  • lionengine-audio-sc68

  • Support for Sc68 Atari music
  • lionengine-editor

  • Complete standalone editor which can be used in any project for general level edition
  • Can be extended to perform more specific things

Download

Installation

Steps to include the LionEngine in your project:

  1. Install at least the [Java JDK 6] (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
  2. Install the [Android SDK 1.5] (http://developer.android.com/sdk/index.html) (only if you use lionengine-core-android)
  3. Choose your favourite IDE ([Eclipse] (http://www.eclipse.org/downloads/), [Netbeans] (https://netbeans.org/downloads/)...)
  4. Download the latest [LionEngine] (http://lionengine.b3dgs.com/page.php?lang=en&section=downloads)
  5. Include all LionEngine libraries you need for your project, following the tree dependency:
  • lionengine-core (minimum requirement)
    • lionengine-core-awt (uses AWT as graphic renderer, target for computer)
    • lionengine-core-swt (uses SWT as graphic renderer, target for computer)
    • lionengine-core-android (uses Android 1.5, target for phones)
    • lionengine-game (base for game development)
    • lionengine-network (support for network)
    • lionengine-audio-wav (support for Wav sound)
    • lionengine-audio-midi (support for Midi music)
    • lionengine-audio-sc68 (support for Sc68 Atari music)
  1. Join (if you want) the javadoc for each library
  2. You are now ready to use the LionEngine in your project

Getting Started

Once you installed the LionEngine in your project, you may would like to know how to prepare a quick sample as a first try.

Main class

  • Using lionengine-core-awt or lionengine-core-swt
public final class AppJava
{
    public static void main(String[] args)
    {
        EngineAwt.start("AppJava", Version.create(1, 0, 0), "resources");
        final Resolution output = new Resolution(640, 480, 60);
        final Config config = new Config(output, 16, true);
        final Loader loader = new Loader();
        loader.start(config, Scene.class);
    }
}
  • Using lionengine-core-android
public final class AppAndroid extends Activity
{
    @Override
    protected void onPostCreate(Bundle savedInstanceState)
    {
        super.onPostCreate(savedInstanceState);

        EngineAndroid.start("AppAndroid", Version.create(1, 0, 0), this);
        final Resolution output = new Resolution(240, 320, 60);
        final Config config = new Config(output, 32, false);
        final Loader loader = new Loader();
        loader.start(config, Scene.class);
    }

    @Override
    public void finish()
    {
        super.finish();
        Engine.terminate();
    }
}

Minimal sequence

public class Scene extends Sequence
{
    public static final Resolution RESOLUTION = new Resolution(320, 240, 60);

    public Scene(Context context)
    {
        super(context, RESOLUTION);
    }

    @Override
    public void load()
    {
        // Load resources
    }

    @Override
    public void update(double extrp)
    {
        // Update game
    }

    @Override
    public void render(Graphic g)
    {
        // Render game
    }
}

Tutorials