# libGDX — Cross-Platform Java Game Development Framework > A mature, battle-tested Java framework for building 2D and 3D games that deploy to desktop, Android, iOS, and the web from a single codebase. ## Install Save as a script file and run: # libGDX — Cross-Platform Java Game Development Framework ## Quick Use ```bash # Install via the official setup tool curl -L https://libgdx.com/assets/downloads/legacy_setup/gdx-setup_latest.jar -o gdx-setup.jar java -jar gdx-setup.jar # Or use the new gdx-liftoff project generator git clone https://github.com/libgdx/gdx-liftoff.git cd gdx-liftoff && ./gradlew run ``` ## Introduction libGDX is a free, open-source Java game development framework that lets you write your game once and ship it to Windows, macOS, Linux, Android, iOS, and HTML5. It provides a unified API across platforms so you focus on game logic rather than platform quirks. ## What libGDX Does - Renders 2D sprites, tilemaps, and particle effects via OpenGL ES - Supports 3D rendering with model loading, skeletal animation, and PBR shaders - Provides cross-platform audio, input handling, and file I/O abstractions - Includes a 2D physics wrapper around Box2D and 3D physics via Bullet - Offers UI toolkit (Scene2D) for menus, HUDs, and in-game interfaces ## Architecture Overview libGDX uses a backend-agnostic core module where all game logic resides. Platform-specific backends (LWJGL for desktop, Android SDK, RoboVM/MOE for iOS, GWT for web) implement the same interfaces, enabling a single codebase to target multiple platforms. The framework follows an immediate-mode rendering approach using OpenGL ES 2.0/3.0. ## Self-Hosting & Configuration - Requires JDK 11+ and Gradle for building projects - Use gdx-liftoff to scaffold projects with chosen backends and extensions - Configure platform targets in gradle.properties and settings.gradle - Add extensions (Box2D, FreeType, Controllers) via Gradle dependencies - Android builds need Android SDK; iOS builds need Xcode on macOS ## Key Features - Single codebase deploys to 6+ platforms including mobile and web - Extensive extension ecosystem: AI, physics, networking, UI - Mature and stable with over a decade of production use - No runtime fees or royalties under the Apache 2.0 license - Active community with tutorials, wikis, and third-party tools ## Comparison with Similar Tools - **Godot** — Full editor with GDScript; libGDX is code-only and Java-native - **Unity** — Proprietary with C#; libGDX is fully open source and free - **MonoGame** — C#/.NET based; libGDX targets Java/Kotlin developers - **Bevy** — Rust ECS engine, newer; libGDX has a larger ecosystem and longer track record - **Phaser** — JavaScript and web-only; libGDX targets native desktop and mobile too ## FAQ **Q: Can I use Kotlin instead of Java?** A: Yes. libGDX works with Kotlin out of the box since it runs on the JVM. Many developers prefer Kotlin for its concise syntax. **Q: Is libGDX suitable for 3D games?** A: It supports 3D rendering, model loading, and physics via Bullet. However, it lacks a built-in 3D editor, so teams needing visual scene editing may prefer Godot or Unity. **Q: How does HTML5 export work?** A: libGDX uses GWT (Google Web Toolkit) to compile Java to JavaScript, producing a browser-playable build with WebGL rendering. **Q: What games have been made with libGDX?** A: Notable titles include Slay the Spire (original version), Mindustry, Shattered Pixel Dungeon, and Unciv. ## Sources - https://github.com/libgdx/libgdx - https://libgdx.com/ --- Source: https://tokrepo.com/en/workflows/asset-fe2b0119 Author: Script Depot