FXGL

AlmasBMIT活跃维护

基于 JavaFX 的 Java/Kotlin 游戏引擎,内置实体组件系统、物理与 UI,让开发者用熟悉的 JVM 技术栈快速做出 2D/3D 游戏。

Java / JavaFX / Kotlin Game Library (Engine)

25发布于 2026-02-05 23:17 UTC4,875star +2 / 7 天712fork同步于 2026-11-10 11:37 UTC

怎么上手

由 README 提炼,执行前请确认
Maven: <dependency><groupId>com.github.almasb</groupId><artifactId>fxgl</artifactId><version>25</version></dependency>
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求;仅说明支持 Win/Mac/Linux/Android 8+/iOS 11.0+/Web 平台,并基于 JavaFX 运行。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 JavaFX 的 Java/Kotlin 2D 游戏框架,无需安装配置即可开箱写游戏

基于 JavaFX 的 Java/Kotlin 游戏引擎,内置实体组件系统、物理与 UI,让开发者用熟悉的 JVM 技术栈快速做出 2D/3D 游戏。

核心能力

  • 继承 GameApplication 即可启动游戏,API 简洁
  • 内置实体-组件、插值动画、粒子等游戏开发技术
  • JavaFX 超集,复用现有 UI API 无需另学
  • 支持打包为单个可执行 jar 或原生镜像
  • 覆盖 Java 8-25 与桌面、移动、Web 多平台

容易踩的坑

Gradle 示例仍用 jcenter() 和已废弃的 compile 配置,建议参考官方模板项目改写;模块化项目需在 module-info.java 中 requires com.almasb.fxgl.all;README 提示遇到报错请以 FXGL-MavenGradle 模板项目为准。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本25
  1. 25最新正式版2026-02-05 · 2026-02-05 23:17 UTC

    Auto-generated changelog

    build

    • Bump Kotlin 2.0 -> 2.3, JDK to 23 -> 25, JavaFX to 21.0.1 -> 25.0.1, Jackson 2.18.2 -> 2.19.4, JaCoCo 0.8.12 -> 0.8.14, attach 4.0.17 -> 4.0.24 (#1455) commit
    • deploy via central commit
    • deploy via central commit
    • jackson 2.14.2 -> 2.18.2 commit
    • kotlin 1.8.10 -> 2.0.0 commit
    • jacoco 0.8.11 -> 0.8.12 commit
    • use JDK 23 to build FXGL 25 snapshot commit
    • switch to 25+dev-SNAPSHOT commit
    • base Java 23 to prep for FXGL 25, mvn compiler 3.11.0 -> 3.13.0, related to #1391 commit
    • pmd 3.20.0 -> 3.26.0 commit

    docs

    • German translation improved commit
    • Updated minimum required JDK to 23 commit

    feat

    • added initial implementation of RobotKeyboard commit
    • added API that allows arbitrary selection of cell neighbors in a grid commit
    • added PhysicsWorld.addConstantVolumeJoint commit
    • added face detection API commit
    • added hand tracking extraction from image commit
    • added Image.toByteArray() and toBase64() commit
    • Allow sending spawnData when spawning entities using the MultiplayerService commit
    • added EntitySelectionRectangle, closes #720 commit
    • HandTrackingService now allows selecting any suitable video input device commit
    • JS console.log() messages are now rerouted to FXGL logging at debug level commit
    • upgrade MediaPipe integration to latest, added HandLandmarksView commit
    • added startProcessTask() which can execute any OS command as a separate process commit
    • added a convenience function addWorldPropertiesHandler() which automatically saves and loads the vars in world properties commit
    • added onExit() and convenient access to world properties via SceneService commit
    • nodes that support View interface onUpdate() will now be updated by GameScene, even when added as a UI node commit
    • initial impl of FFC wrapper around FFM/FFI, allowing convenient calls to native libs commit
    • provide API for deriving colors based on an existing Texture, closes #1378 commit
    • added a conversion to fx image from awt image commit
    • added initial impl of OSService, allowing access to OS level functionality commit
    • ReflectionFunctionCaller can now invoke functions with any argument type, closes #1389 commit
    • restored GOAP functionality, related to #680 commit
    • two images can be com
  2. 21.12024-03-26 · 2024-03-26 17:42 UTC
    查看更新说明

    Auto-generated changelog

    docs

    • added a directory for 3rd party licenses commit
    • added README_RU.md commit

    feat

    • added ResourceExtractor that extracts resource files from deployed jar to local FS commit
    • added software cursor, closes #1090 commit
    • the initial framework for PropertyMapView is implemented, closes #704 commit
    • added MazeGrid as a traversable grid commit
    • added Dungeon Generator, closes #1130 commit
    • completed implementation of QuestService, closes #848 commit
    • added EngineService onVarsInitialized() to notify services when game vars are ready to use commit
    • added EngineService onGameReset() to allow services to clean up and get ready for a new game commit
    • web api service can now use both Chrome and Firefox based on availability commit
    • Support 8 directions AStar pathfinding, closes #1213 commit
    • Add SerializableType to PropertyMap, closes #1250 commit
    • added WebAPI and RPC services commit
    • AsyncService for parallel EngineService processing commit
    • Support 8 directional Grids commit
    • added initial impl of tts service commit
    • added HttpClientService that allows sending http requests commit
    • added intial impl hand tracking service commit
    • added initial impl of speech recognition API commit
    • added a new module fxgl-intelligence commit
    • added support for loading source images from relative paths in .tmx, closes #1302 commit
    • SceneService now provides direct access to intro, loading, game, main menu, game menu scenes, closes #1315 commit
    • updated russian.lang commit

    fix

    • emit particles at initial Entity zIndex instead of zIndex 0, closes #1318 commit
    • TriggerSequence Minigame check if trigger is between two lines, closes #796 commit
    • modifier keys shift, ctrl, alt are not released when a different key is released, related to #1313 commit
    • UI loaded from fxml file now correctly loads Image tags, closes #1343 commit

    refactor

    • load fxgl-intelligence locally, keep consistent package structure commit
    • removed deprecated fireEvent() commit
    • replace bit flag with a boolean commit
    • encapsulate islang flag in Body commit
    • extracted reflection based function calling to be reusable commit
    • replace deprecated URL() call with URI.toURL() [commit](https://github.com/Alm
  3. 212023-12-28 · 2023-12-28 14:35 UTC
    查看更新说明

    Auto-generated changelog

    build

    • javafx 20 -> 21.0.1 commit
    • mvn compiler 3.8.0 -> 3.11.0' commit
    • jacoco 0.8.8 -> 0.8.11 commit
    • base Java 21, switch to 21+dev-SNAPSHOT commit
    • maven PMD 3.15.0 -> 3.20.0 commit

    docs

    • updated to match JDK 21 baseline, simplify wording commit

    feat

    • added a particle callback function that will be executed when the particle is removed commit
    • added asset loader loadCutscene shortcut commit
    • Dialogue Editor can now exit the dialogue from any node, related to #1322 commit
    • added a property view for String properties commit
    • DialogueGraph Function node now supports add sub mul div commit
    • added PropertyMap divide Double and Int commit
    • added PropertyMap multiply Double and Int commit
    • dialogue editor will now highlight the selected node view commit
    • dialogue editor now supports node duplication, shortcut CTRL+D, related to #1322 commit
    • dialogue nodes can now be copied commit
    • DialogueScene is no longer limited to showing 5 choices and uses a scroll bar when needed to show more choices, related to #1322 commit
    • added video cutscenes, closes #1120 commit
    • added loadVideo() to asset loader, related to #1120 #406 commit
    • MultiplayerService now provides ping (round-trip time) information for a given connection, closes #877 commit
    • added MovingAverageQueue commit
    • RechargeableComponents now maintain the value is not greater than max value relationship, added valuePercent, closes #833 commit
    • added choice dialog box API for List and Enum options commit
    • added convenience methods onBtn* for Primary and Secondary mouse buttons commit
    • added interpolateIntermediateImages() commit
    • new API for extracting Image from a channel given the frame index commit
    • added AnimatedImage which animates between corresponding pixels to produce a new image commit
    • basic hex support for Tiled .tmx, closes #702 commit
    • added Image.getPixel(x, y) API commit
    • javafx sliders are now replaced with FXGLSlider type commit

    fix

    • MDIWindow controls now function correctly commit
    • viewport now correctly unbinds itself from an entity commit
    • blending operations now always produce valid pixel colors through limiting values to [0..1], closes #712 commit
    • adding a message handler
  4. 17.32023-03-30 · 2023-03-30 12:04 UTC
    查看更新说明

    Auto-generated changelog

    build

    • jfx 19.0.2.1 -> 20, kotlin 1.8 -> 1.8.10, attach 4.0.16 -> 4.0.17, jackson 2.14.1 -> 2.14.2 commit
    • JavaFX 19 -> 19.0.2.1 (#1223) commit
    • Kotlin 1.7.10 -> 1.8.0, Jackson 2.13.4 -> 2.14.1, Attach 4.0.15 -> 4.0.16 commit
    • jfx 19-ea+11 -> 19, jackson 2.13.3 -> 2.13.4 (#1207) commit
    • use java 19-ea for tests commit

    docs

    feat

    • completed basic isometric support for .tmx, closes #1151 commit
    • AnimationTexture can start from a given frame, part of #1244, co-author: @chengenzhao commit
    • Added Inventory::transferAllFrom(), getItemQuantity() returns 0 if no item, closes #1131 commit
    • added setDirectionVector3D, closes #924 commit
    • ViewComponent.getChild() allows retrieving a specific child that is directly cast to given type commit
    • added bindToLookAt3D() which makes a transform look at another transform commit
    • added PropertyMap::addAll(), updated forEach impl and doc, closes #1199 commit
    • audio object is now in public API, closes #1187 commit

    fix

    • if title is empty, set to Untitled, closes #1225 (#1257) commit
    • 3D models in .obj format without normals are now loaded correctly, related to #1245 commit
    • PropertyMap remove() correctly removes internal listeners, closes #1229 commit
    • original asset objects are now cast during first load to avoid leaking originals where we shouldnt, #977 commit
    • updating rotationX and rotationY now correctly updates direction3D #924 commit

    perf

    • optimise A* pathfinding performance commit

    refactor

    test

    • added matrix 3x3 test (#1258) commit
    • added missing Mat22 tests commit
    • added initial SweepTest commit
    • added initial DistanceTest commit
    • added initial DistanceProxyTest commit

    Contributors

    Full Changelog: https://github.com/AlmasB/FXGL/compare/17.2...17.3

  5. 17.22022-08-20 · 2022-08-20 17:02 UTC
    查看更新说明

    Auto-generated changelog

    build

    • kotlin 1.5.32 -> 1.6.0 commit

    docs

    • Add Chinese README file (#1186) commit

    feat

    • the languages menu now displays the name in the target language, related to #1170 and #1172 commit
    • NotificationService now also accepts Node icon, closes #1149 commit
    • added WaypointMoveComponent which moves the entity based on Point2D, related to #980 commit
    • Input UserAction now provides API for double key/button presses commit
    • trigger listener now supports direct onKey and onButton callbacks which are triggered before the generic onAction callbacks, closes #1070 commit
    • Viewport::bindToFit for entities is now restored, closes #1036 commit
    • FrameData now supports offsets, closes #1181 commit
    • allow access to viewport camera entity via public API, closes #1168 commit
    • added support for Tiled 1.9.0 class property, #1182 commit
    • RechargeableDoubleComponent also has the value in percentage format as a binding commit
    • added KeepInBoundsComponent, fixed KeepOnScreenComponent, closes #842 commit
    • translate animation builder will use current position if from is not set commit
    • added EventBus.removeAllEventHandlers, #1160 commit

    fix

    • FPS camera now works even when mouse buttons are pressed, closes #1189 commit

    refactor

    • removed redundant onClick() since kotlin now properly reads Consumer<>, closes #1188 commit
    • use joints array size to track joint count commit

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    promo

    Languages

      English

      简体中文

      Русский

    About

    JavaFX Game Development Framework

    Maven Central Build Status codecov sponsor JFXCentral

    Why FXGL?

    • No installation or setup is required
    • "Out of the box": Java 8-25, Win/Mac/Linux/Android 8+/iOS 11.0+/Web
    • Simple and clean API, higher level than other engines
    • Superset of JavaFX: no need to learn new UI API
    • Real-world game development techniques: Entity-Component, interpolated animations, particles, and many more
    • Games are easily packaged into a single executable .jar, or native images

    Good for:

    • Any 2D game (side-scroller / platformer / arcade / RPG)
    • Any business application with complex UI controls / animations
    • Experimental 3D
    • Hobby / academic / commercial projects
    • Teaching / learning / improving game development skills
    • Fast prototyping of app ideas

    Minimal Example

    public class BasicGameApp extends GameApplication {
    
        @Override
        protected void initSettings(GameSettings settings) {
            settings.setWidth(800);
            settings.setHeight(600);
            settings.setTitle("Basic Game App");
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }
    

    Getting Started

    For a quick dive into code, see standalone basic examples.

    Otherwise, see:

    Maven

    • Maven template project if you use Java and/or Kotlin
    <dependency>
        <groupId>com.github.almasb</groupId>
        <artifactId>fxgl</artifactId>
        <version>25</version>
    </dependency>
    

    Gradle

    • Gradle template project if you use Java and/or Kotlin

    Please refer to the template if there are any errors.

    repositories {
        jcenter()
    }
    
    dependencies {
        compile 'com.github.almasb:fxgl:25'
    }
    

    Modularity

    If you wish to develop a modular application, here's a complete example of your module-info.java:

    open module app.name {
        requires com.almasb.fxgl.all;
    }
    

    Uber jar

    Download the latest uber jar from Releases

    Community

    • University of Brighton, UK
    • University of Nottingham, UK
    • Georgia Institute of Technology, USA
    • kidOYO, USA
    • Walton High School, USA
    • Conant High School, USA
    • Zealand Institute of Business and Technology, Denmark
    • Federal Institute of Education, Science and Technology of Rio Grande do Sul, Brazil
    • FHNW School of Engineering / Computer Science, Switzerland
    • Johann-Andreas-Schmeller-Gymnasium Nabburg, Germany

    If your institution wants to use or is using FXGL, add a note via GitHub Discussions to be added to the list.

    Community tutorials:

    Community projects (identified using fxgl topic):

    If you'd like your project featured here, just add a note via GitHub Discussions.

    Development Team

    A description of roles is given in the Contribution Guide.

    Maintainers (Collaborators):

    Coordinators:

    Testers:

    Contribution & Support

    If you want to build FXGL from the source code or want to contribute, please see the Contribution Guide (including non-code). FXGL is fully modular, so new contributors do not need to understand the entire codebase, only the module to which the contribution is made. Contributions will be reviewed in accordance with the Code of Conduct.

    You can support the FXGL development or show interest by simply starring the repo or becoming a sponsor.

    Sponsors

    Users:

    • @Marsl10
    • @SergeMerzliakov
    • @mbains
    • @sabit86
    • @hendrikebbers
    • @ImperaEtConquer
    • @thejeed
    • @chikega

    Companies:

    • @karakun

    Contact