Skip to content

ZSolarDev/Axiom

Repository files navigation

Warning

This engine is still in it's infancy, the first build hasn't even released yet.

A lightweight 2D/3D game engine for people who prefer coding.

WelcomeWhat it can doCredits


Welcome to Axiom

Axiom is a LibGDX-based lightweight 2D/3D game engine built around the idea that the editor doesn’t need to do everything.
The editor stays simple and straightforward, mainly for organizing your project and files, while the actual game logic and behavior are handled through LuaSharp: an extended version of Lua designed to support larger projects.

(screenshot here)

The engine provides rendering, state handling, UI tools, and Java integration, but the heavy lifting is meant to happen in your code. Axiom’s design focuses on keeping the editor clear and functional, while giving you a programming-first workflow for building your game.



What it can do

LuaSharp

Standard Lua, extended with:

  • Classes & Inheritance: real OOP, including extending Java classes from Lua
  • Enums: simple constants or constructor-style tagged unions
  • String Interpolation: "Player ${name} scored ${score} points"
  • Reflection: inspect Lua classes, modify objects at runtime
  • Java Interop: import Java classes, call methods, access static fields, pass Lua objects to Java expecting the parent type
-- player.luas
package game

import com.zsd.axiom.display.screen.drawables2d.DrawableSprite

class Player extends DrawableSprite
    public speed = 200
    
    public function Player(x, y) -- constructor
        super:DrawableSprite(instance)
        setPosition(x, y)
    end
    
    public function move(dx, dy, delta)
        x = getX() + (dx * speed * delta)
        setPosition(x, y)
    end
end
-- game.luas
import game.Player

player = Player.new(100, 100)
player:move(1, 0, delta)

LuaSharp works directly with Java. The bridge is wide enough that you can pass almost anything back and forth seamlessly.


Engine Features

Axiom isn’t just a language binder, it’s a complete toolkit for 2D and 3D games.

  • State Management: stackable states & substates (SubStates overlay without disposing the underlying one)
  • Rendering: sprite batching with support for nested renderers for layered visuals
  • Display Wrappers: unified API for sprites, text (LibGDX Bitmap or TrueType), and UI
  • Error Handling: visual error popups with categorized types and filtered stack traces
  • Extensibility: load any Java library at runtime, compile Java classes on the fly

Runtime Java Compilation

When LuaSharp isn’t enough, Axiom gives you a runtime Java compiler.

You can:

  • compile a Java class from a string
  • register it globally for all scripts
  • or keep it local for temporary use
  • use it once it's loaded
import java.compiler.LocalRuntimeCompiler
import java.compiler.GlobalRuntimeCompiler

-- Local runtime class compilation
local tempBehavior = LocalRuntimeCompiler.compile('TempBehavior', [[ // returns the class of the code and returns a local version with LocalRuntimeCompiler
  public class TempBehavior {
    public void run() {
        System.out.println("Hello world!");
    }
}
]])
tempBehavior.new():run() -- prints "Hello world!"

-- Global runtime class compilation
if not GlobalRuntimeCompiler.classExists('wow.guys.LuaMath') then -- to check if it's already there
  local math = GlobalRuntimeCompiler.compile('wow.guys.LuaMath', [[ // returns the class of the code and registers it globally with the GlobalRuntimeCompiler
  package wow.guys;
  public class LuaMath {
      public LuaMath() {}
      public int add(int a, int b) {
          return a + b;
      }

      public int multiply(int a, int b) {
          return a * b;
      }

      public String tag(String input) {
          return "[GLOBAL] " + input;
      }
  }
  ]]) -- after this runs it can be accessed in other scripts via:
  local mathDuplicate = GlobalRuntimeCompiler.getClass('wow.guys.LuaMath').new() -- make a new instance
  print(mathDuplicate:multiply(2, 2)) -- prints 4
  print(math.new():add(9, 9)) -- prints 18
end

It's pretty easy to use.



Credits

  • Loaf - He made the circle part of the Axiom logo, the "O" in the full text logo.
  • LibGDX - Axiom is based off of the 2D/3D java library, LibGDX.
  • LuaJ - This project wouldn't have happened without it.

About

A lightweight 2D/3D game engine for people who prefer coding.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •