JVM game engine based on Swing/JavaFX.

Overview

FriceEngine

image

CI status
Travis CI Build Status
AppVeyor Build status
CircleCI CircleCI
CodeShip CodeShip

Download
Awesome Kotlin Badge ktlint

An easy, light, native game engine running on JVM.

  • Why easy?
    A flappy bird game uses just 56 lines of Java code only.
    Written in Kotlin, also work on Java, JRuby, Groovy, Scala and other JVM languages.

  • Why light?
    The release build jar is about 1.6mb (with a 1mb Kotlin runtime) only.

  • Why native?
    This engine is completely platform-independent: no JNI linkage, no native methods.

View Document to learn how to use Frice Engine.

Screenshots

Build

Gradle:

repositories { jcenter() }
dependencies { compile 'org.frice:engine:1.8.5' }

Alternatively, you can follow the instruction from JitPack.
Alternatively, you can download a jar from the release page.

Features

This engine is based on Java's built-in GUI framework, both Swing and JavaFX. "Platform" here refers to Swing/JavaFX.

Platform dependent

These features are differently implemented in Swing/JavaFX.
Since this project is still in progress, the unsupported features will soon be available.

Feature Swing JavaFX
Life cycle
Dialogs
Cursor overriding
Screenshot
Buttons
Full screen
Always on top
Text font/size
Multi-instances ×
Resizability
Key listener
Text measuring

Platform independent

  • Animations (moving, scaling, rotating, accelerating, chasing, approaching, etc.)
  • Audio playing (*.wav, *.mp3) by JavaSound/JavaFX Media
  • Clock system, timers
  • Delayed event manager
  • Automatic garbage collection (optional, objects far from the screen will be removed)
  • Resource manager (caching IO)
  • File/Image/Color/URL utils
  • Game objects
  • Frame animations
  • Key-value database
  • Particle effects
  • Attaching game objects
  • Collision detection with collision box

DSL

See DSL for FriceEngine

Contributions

Feel free to open issue for feature request, bug reports, etc.
This is generally a personal project, so please do give your genuine suggestions.

This project is using Issue-Driven-Development.
Issues are well organized and used to managed tasks.

Demos

See FriceDemo
And see TouhouDemo

Comments
  • 运行出错了

    运行出错了

    不懂Kotlin,跑test的时候出现了2个问题:一个是AudioManager.kt的13行和16行编译出错,提示说要在async后加(),加上后编译OK,是Kotlin版本问题???二是运行后抛出空指针异常,原因是Game.kt的404行中的panel为空,看panel是在172行初始化的,debug发现压根就没执行这句话,啥情况???

    bug 
    opened by dongkuo 7
  • Stupid mistake

    Stupid mistake

    Stupid mistake in AttachedObjects.

    fun addObject(vararg objects: T) = objects.forEach { objs.remove(it) }
    fun removeObject(vararg objects: T) = objects.forEach { objs.remove(it) }
    
    bug 
    opened by KirCute 4
  • Rendering bug

    Rendering bug

    package com.github.kircute_ect.ectrpg.gui;
    
    import com.github.kircute_ect.ectrpg.resources.Resources;
    import org.frice.game.Game;
    import org.frice.game.obj.sub.ImageObject;
    import org.frice.game.utils.time.FTimer;
    
    import java.awt.*;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    
    public final class Gameframe extends Game {
        private FTimer timer;
        @Override
        public void onInit() {
            super.onInit();
            Resources.getAllConfigs().readConfig();
            Resources.replenishConfig();
            switch (Resources.getAllConfigs().getConfig("GameOptions", "screen")) {
                case 0:
                    this.setSize(new Dimension(608, 480));break;
                case 1:
                    this.setSize(new Dimension(928, 736));break;
                case 2:
                    this.setSize(new Dimension(1248, 928));break;
                case 3:
                    //TODO full screen
                    break;
                default:
                    this.setSize(new Dimension(608, 480));
            }
        }
        @Override
        public void onExit() {
            super.onExit();
        }
        @Override
        public void onRefresh() {
            super.onRefresh();
            if(timer.ended()) {
                if(Resources.getPlayer().getDoor() != 0) {
                    if(Resources.getPlayer().getDoor() < 0) {
                        if(Resources.getPlayer().getDoor() == -20) {
                            Resources.getPlayer().inedDoor();
                        } else {
                            Resources.getPlayer().nextDoor();
                        }
                    } else if(Resources.getPlayer().getDoor() > 0) {
                        Resources.getPlayer().nextDoor();
                    }
                }
                if(Resources.getPlayer().getDoor() == -20) {
                    Resources.getPlayer().teleported();
                    Resources.getPlayer().setTeleport(null);
                }
                //TODO Game Refresh
                int startpoint[] = {0,0};
                float upBorderDistance = Resources.getPlayer().getLocation()[1];
                float downBorderDistance = Resources.getPlayerMap().getMapHeight() - Resources.getPlayer().getLocation()[1];
                float leftBorderDistance = Resources.getPlayer().getLocation()[2];
                float rightBorderDistance = Resources.getPlayerMap().getMapWidth() - Resources.getPlayer().getLocation()[2];
                int cameraMovingMinHeight = this.getHeight() / 32;
                int cameraMovingMinWidth = this.getWidth() / 32;
                boolean dontMovingUp = ( upBorderDistance <= cameraMovingMinHeight );
                boolean dontMovingDown = ( downBorderDistance <= cameraMovingMinHeight );
                boolean dontMovingLeft = ( leftBorderDistance <= cameraMovingMinWidth );
                boolean dontMovingRight = ( rightBorderDistance <= cameraMovingMinWidth );
                boolean lockUpDown = ( dontMovingUp && dontMovingDown );
                boolean lockLeftRight = ( dontMovingLeft && dontMovingRight );
                boolean miniMap = ( lockUpDown && lockLeftRight );
                if(miniMap) {
                    startpoint[0] = (this.getHeight() - Resources.getPlayerMap().getMapHeight() * 32) / 2;
                    startpoint[1] = (this.getWidth() - Resources.getPlayerMap().getMapWidth() * 32) / 2;
                    for(int width = 0; width < Resources.getPlayerMap().getMapWidth(); width++) {
                        for(int height = 0; height < Resources.getPlayerMap().getMapHeight(); height++) {
                            this.addObject(new ImageObject(Resources.getPlayerMap().getMapView()[height][width],(double)width * 32, (double)height * 32));
                        }
                    }
                }
            }
        }
    
    bug help wanted question 
    opened by KirCute 4
  • QuadTree split creates subtree at wrong coordinate

    QuadTree split creates subtree at wrong coordinate

    https://github.com/icela/FriceEngine/blob/cd9ed30d6fd9471d44021ff73818ab2dd4dd4ff6/src/org/frice/util/QuadTree.kt#L47

    Should probably be: nodes[2] = QuadTree(level + 1, FQuad(x, y + subHeight, subWidth, subHeight))

    bug 
    opened by hesslink111 3
  • More handy API for collision box

    More handy API for collision box

    Should be like this:

    • obj.useCollisionOffset(top, bottom, left, right)
    • obj.useCollisionOffset(topBottom, leftRight)
    • obj.useCollisionOffset(allDirection)

    Do you like what you see? :trollface:

    new feature 
    opened by ice1000 2
Releases(v1.8.5)
Owner
Frice Group
Developers of The Frice Engine
Frice Group
This provides the javafx runtimes for windows, linux, and mac os x86 platforms for Ignition

ignition JavaFX Provider This provides the javafx runtimes for windows, linux, and mac os x86 platforms for Ignition Steps to use run gradlew build st

Jonathan Coffman 2 Oct 17, 2022
Solves the audit needs for any JVM based application

Auditor-v1 Solves the audit needs for any JVM based application.

Lowe's 12 Dec 15, 2022
fusion4j - declarative rendering language for the JVM based on Neos.Fusion

fusion4j - declarative rendering language for the JVM based on Neos.Fusion Supports the Neos Fusion syntax/semantic as described in the official Neos

sandstorm 2 May 3, 2022
A minecraft modification based on Fabric with Yarn Mappings, developed for the newest version of the sandbox game Minecraft.

JupiterClient A minecraft modification based on Fabric with Yarn Mappings, developed for the newest version of the sandbox game Minecraft. Building th

Cedric H. 1 Jun 27, 2022
🔴 A non-deterministic finite-state machine for Android & JVM that won't let you down

HAL is a non-deterministic finite-state machine for Android & JVM built with Coroutines StateFlow and LiveData. Why non-deterministic? Because in a no

Adriel Café 73 Nov 28, 2022
:blowfish: An Android & JVM key-value storage powered by Protobuf and Coroutines

PufferDB PufferDB is a ⚡ key-value storage powered by Protocol Buffers (aka Protobuf) and Coroutines. The purpose of this library is to provide an eff

Adriel Café 94 Dec 7, 2022
🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)

Haru ?? Lightweight, and simple scheduling library made for Kotlin (JVM) Why did you build this? I built this library as a personal usage library to h

Noel 13 Dec 16, 2022
A injection minecraft cheat using jvm attach api

Luminous A injection minecraft cheat using jvm attach api Website: https://lumi.getfdp.today Build We used a thing called Wrapper to make development

null 24 Dec 21, 2022
Yet Another Native Loader for the JVM.

yanl - yet another native loader Yet another Native library extractor/loader for the JVM, written in Kotlin. why other libraries simply don't fit my n

Stardust Enterprises 5 Dec 23, 2022
A Template for a Github Actions Pipeline for building and publishing Gradle-JVM Applications

github-actions-cd-template-jvm A Template for a Github Actions Pipeline for building and publishing Gradle-JVM Applications It build a executable shad

Raphael Panic 0 Dec 5, 2021
Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs

Zipline This library streamlines using Kotlin/JS libraries from Kotlin/JVM and Kotlin/Native programs. It makes it possible to do continuous deploymen

Cash App 1.5k Dec 30, 2022
Yaspeller-kt - Asynchronous Yandex.Speller API wrapper for Kotlin/JVM.

yaspeller-kt Asynchronous Yandex.Speller API wrapper for Kotlin/JVM. Installation repositories { maven { url 'https://jitpack.io' }

Mikhail Koshkin 6 Jun 27, 2022
Port immer for kotlin/jvm

1. kimmer Port https://github.com/immerjs/immer for kotlin/jvm (requires kotlin 1.5+). Immer is the winner of the "Breakthrough of the year" React ope

null 37 Dec 9, 2022
Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)

storyblok-mp-SDK-blog ... a showcase of using the Storyblok Kotlin Multiplatform Client to build a blog application (Android, JVM) What's included ??

Mike Penz 5 Sep 28, 2022
A property/method accessor library for the JVM, written in Kotlin

unlok - unlock your JVM a property/method accessor library for the JVM, written in Kotlin. how to import you can import unlok from maven central just

xtrm 2 Oct 27, 2022
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Target 5 Dec 8, 2022
🎑 Up to date IANA timezone database library for Kotlin (JVM, JS, Native)

?? IANA Timezone Library for Kotlin Multiplatform Up to date IANA timezone database library for Kotlin (JVM, JS, Native) Usage import org.noelware.ian

Noelware 3 Jun 18, 2022
A simplified interface for interacting with in-memory cache implementations on the JVM

This library provides a simplified interface for interacting with in-memory cache implementations on the JVM. Think: "SLF4J but for caching"

null 5 Nov 29, 2022
Kotlin/JVM compensated summation of Double sequences to calculate sum, mean, standard deviation

precise Implements compensated summation for sequences of Double. Reduces rounding errors associated with limited precision of floating-point numbers.

Artёm IG 0 Apr 20, 2022