A Java game development framework that deploys to JVM, HTML5, Android and iOS.

Overview

PlayN

PlayN is a cross-platform Java game development library written in Java that targets HTML5 browsers (via GWT), desktop JVMs, Android and iOS devices.

Information on PlayN can be found in this README and on the PlayN project website.

PlayN developers, contributors, and users regularly communicate on the PlayN Google Group.

Building and Running

It is not necessary to build PlayN to use it. PlayN is shipped to Maven Central from where it will be automatically downloaded by projects that use it. However, you still may find it useful to build a local copy of PlayN in case you need to modify it when debugging your own game, to add new features, or to fix bugs you find in the PlayN code.

Building PlayN locally is very easy using Maven:

cd playn
mvn clean install

This will install the latest snapshot version of PlayN into your local Maven repository. You can then modify the playn.version property of your game to reference that snapshot version and your game will use your local copy of PlayN instead of a version downloaded from Maven Central.

Instructions for building and running the PlayN sample games can be found in the Documentation.

Licensing

Unless otherwise stated, all source files are licensed under the Apache License, Version 2.0:

Copyright 2011-2015 The PlayN Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
Comments
  • JVM game crashes on start with java.lang.NoSuchMethodError: java.nio.IntBuffer.position(I)Ljava/nio/IntBuffer

    JVM game crashes on start with java.lang.NoSuchMethodError: java.nio.IntBuffer.position(I)Ljava/nio/IntBuffer

         [java] viewPortChanged 1280x960 / 2.0 -> 640.0x480.0
         [java] Exception in thread "main" java.lang.NoSuchMethodError: java.nio.IntBuffer.position(I)Ljava/nio/IntBuffer;
         [java] 	at playn.core.GL20$Buffers.resizeIntBuffer(GL20.java:397)
         [java] 	at playn.core.GL20.glGetShaderiv(GL20.java:631)
         [java] 	at playn.core.GLProgram.compileShader(GLProgram.java:112)
         [java] 	at playn.core.GLProgram.<init>(GLProgram.java:45)
         [java] 	at playn.core.TriangleBatch.<init>(TriangleBatch.java:122)
         [java] 	at playn.core.TriangleBatch.<init>(TriangleBatch.java:114)
         [java] 	at playn.scene.SceneGame.createDefaultBatch(SceneGame.java:95)
         [java] 	at playn.scene.SceneGame.<init>(SceneGame.java:38)
         [java] 	at rook.core.MainGame.<init>(MainGame.java:25)
         [java] 	at rook.java.JavaMain.main(JavaMain.java:13)
         [java] Java Result: 1
    

    This seems to be an issue with lwjgl which is fixed since 3.1.5. I locally updated lwjgl in playn to 3.1.6 and the error disappears.

    UPDATE just recompiling playn locally also makes the error disappear, so it seems to have nothing to do with lwjgl. But rather with playn being built with java 9 (as far as I can tell from the MANIFEST) and me using java 8 locally.

    opened by cdietze 14
  • HTML hidpi mouse scaling issue (with fix)

    HTML hidpi mouse scaling issue (with fix)

    When manually setting scaleFactor to 1 on a hidpi device (MacBook Pro Retina 2015), mouse input coordinates become broken. I found the reason for this in HtmlGraphics:

    mouseScale = config.scaleFactor / HtmlPlatform.devicePixelRatio();

    disabling this workaround (and setting mouseScale to 1) actually fixes my issue. However my game is using a custom scaling method to always fully occupy the available window/space so I'm not sure if that intereferes with this workaround.

    If I don't change scaleFactor and leave it on its local default value of 2, then I have no problem with mouse coordinates.

    Based on this it seems to me that this mouseScale workaround is unnecessary.

    Tested on Google Chrome and Safari.

    opened by kalimaul 8
  • Regenerate region tiles from disposed textures

    Regenerate region tiles from disposed textures

    Regions were caching tile instances which may refer to textures that may already have been disposed. Now this is detected when tile() is called and a new tile is created from the new texture.

    opened by guillerodriguez 5
  • Can not compile android build in gradle cause 'com.google.android » apk-expansion' was removed from maven central

    Can not compile android build in gradle cause 'com.google.android » apk-expansion' was removed from maven central

    Hi, I'm tying to configure gradle for playn project, instead of maven. I found that gradle can't resolve "apk-extention" dependency:

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring project ':android'.
    > Could not resolve all dependencies for configuration ':android:_debugApkCopy'.
       > Could not find com.google.android:apk-expansion:r3.
         Required by:
             project :android > io.playn:playn-android:2.0-rc3
    
    

    If checkmaven central for this package I see 404: [404] Not Found: /artifact/com.google.android/apk-expansion

    Workaround for gradle based android builds is to exclude this dependency. It works fine. But maven users must see an error.

    opened by kles4enko 5
  • Allow specifying fps on HTML platform

    Allow specifying fps on HTML platform

    While letting the browser control frame render times is a nicer solution, setting a lower fps manually results in your CPU not overheating if rendering is slower than 60 fps, which is ultimately pretty useful.

    • some cleanup of dead code
    opened by kalimaul 4
  • enable passing labels for

    enable passing labels for "ok" and "cancel" labels in getText

    I noticed that getText had hardcoded "Ok" and "Cancel" as labels for the buttons (like sysDialog does). This PR fixes it, while being backwards compatible with those labels as defaults

    opened by tulsidas 3
  • Provide 64-bit version of libplayn-android-nativelib.so

    Provide 64-bit version of libplayn-android-nativelib.so

    Google recently announced that future updates of the applications must include 64-bit version of native libraries. To be honest, I don't know what libplayn-android-nativelib.so does, maybe it's something very old, but it still part of the PlayN android module.

    opened by kles4enko 3
  • Graphic problem after showing a video ad

    Graphic problem after showing a video ad

    I am using StartApp ads with my game. After showing a rewarded video some parts of game textures become black. I think it might be opengl context problem. how to solve it? here is my game : https://github.com/beshkoon/beshkoon/raw/master/beshkoon.github.io/amintest-release.apk

    opened by beshkoon 3
  • Input.mouseEnabled / touchEnabled / keyboardEnabled ignored

    Input.mouseEnabled / touchEnabled / keyboardEnabled ignored

    playn.core.Input has a set of boolean flags (mouseEnabled, touchEnabled, keyboardEnabled) which are supposed to enable or disable dispatching of the corresponding types of events. tripleplay.game.ScreenStack actually uses this to disable dispatching of input events during transitions.

    However this does not seem to work; nobody seems to be checking the state of these variables before dispatching events.

    Indeed, while testing on the Java and Android backends, I see that events are dispatched during screen transitions, even though they should not be.

    opened by guillerodriguez 3
  • Mouse click events not working for Microsoft touch screen laptops (HTML backend)

    Mouse click events not working for Microsoft touch screen laptops (HTML backend)

    Using any browser on a touch screen Microsoft laptop, mouse events are not sent to PlayN when the input device is the trackpad or a mouse. When the input device is the touchscreen, however, events are sent and received as expected.

    I have observed this issue on a few different Lenovo Yoga models and believe it extends to all PCs with touch screens based on our customer bug reports.

    opened by IgorBelyayev 3
  • Error Maven

    Error Maven

    Hi, All. I'm new using PlayN. 1 - I have generated a sample project with the following command (mvn archetype:generate -DarchetypeGroupId=io.playn -DarchetypeArtifactId=playn-archetype -DarchetypeVersion=2.0) The problem is that when I try to compile the project from console (mvn test -e -X) I get the following error:

    error-maven-android.txt

    Do you have any idea how I can solve it?

    2 - I've also tried compiling the playn-samples in eclipse (Neon) but it also generates an error

    Plugin execution not covered by lifecycle configuration: com.simpligility.maven.plugins:android-maven-plugin:4.2.1:emma (execution: default-emma, phase: process-classes) pom.xml /playn-hello-android

    Versions: maven-3.5.0 Java version: 1.8 (Oracle)

    [Edit update error]

    opened by avazquezdev 3
  • Sound clip plays only once in Java backend

    Sound clip plays only once in Java backend

    In some configurations, sound clips can only be played once.

    • My environment: OpenJDK 1.8.0_141 on Ubuntu 14.04.5.
    • IcedTea/PulseAudio sound provider (default for OpenJDK in Ubuntu)
    • PlayN 2.1-SNAPSHOT

    Sample code:

    public class SoundTest extends SceneGame {
      boolean playAgain = true;
      playn.core.Sound sound;
    
      public SoundTest (final Platform plat) {
        super(plat, 33); // update our "simulation" 33ms (30 times per second)
    
        // create and add background image layer
        Image bgImage = plat.assets().getImage("images/bg.png");
        ImageLayer bgLayer = new ImageLayer(bgImage);
        // scale the background to fill the screen
        bgLayer.setSize(plat.graphics().viewSize);
        rootLayer.add(bgLayer);
        
        sound = plat.assets().getSound("sounds/drop");
        sound.play();
      }
      
      public void update(Clock t) {
        if (playAgain && plat.tick() > 5000) {
          sound.play();
          playAgain = false;
        }
      }
    }
    

    This may be related to the following:

    • https://bugs.openjdk.java.net/browse/JDK-8077019
    • https://ubuntuforums.org/showthread.php?t=1903727
    opened by guillerodriguez 0
  • Add distributionManagement via bintray.

    Add distributionManagement via bintray.

    Added profile -Pall for all artifacts (except the test-bugvm that might work only from osx). Added -DskipExec to be able to deploy without executing any test main apps.

    opened by raisercostin 0
  • Error compiling in SuperDevMode

    Error compiling in SuperDevMode

    Note sure what is causing this issue, but thought I'd share that the SDM compiles aren't working. But a regular compile I believe works fine.

    Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
             Tracing compile failure path for type 'pythagoras.util.Platform'
                [ERROR] Errors in 'jar:file:/C:/Users/Ben/.m2/repository/com/samskivert/pythagoras/1.4.2/pythagoras-1.4.2-sources.jar!/pythagoras/util/Platform.java'
                   [ERROR] Line 52: Cannot invoke clone() on the array type double[]
                   [ERROR] Line 31: Cannot invoke clone() on the array type byte[]
                   [ERROR] Line 45: Cannot invoke clone() on the array type float[]
                   [ERROR] Line 38: Cannot invoke clone() on the array type int[]
             [ERROR] Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible
    
    opened by BenDol 2
  • JavaScript Support

    JavaScript Support

    Wait! Wtf?

    Well, some javascript capability can help dev teams to accelerate dev of a complex game:

    1. Give some power to artistis (animations)
    2. Put logic on scripts can help non-developers to help.

    Currently, java, android, html, and iOS have javascript engines (a bridge between "native" and js code).

    The idea is not create a powerfull script engine on PlayN, but just support the use of javascript on all platforms.

    What do you think?

    opened by dyorgio 2
Cross-platform Java game development framework.

Features Kronos is a open source, cross-platform game development library with a robust ecosystem. Listed below are current and planned (*) features:

Temps 0 Dec 19, 2022
A complete 3D game development suite written purely in Java.

jMonkeyEngine jMonkeyEngine is a 3-D game engine for adventurous Java developers. It’s open-source, cross-platform, and cutting-edge. 3.2.4 is the lat

jMonkeyEngine 3.3k Dec 31, 2022
A high-level cross-platform 2D game development API

mini2Dx A high-level game development API for LibGDX inspired by Slick Website Wiki Community Javadoc Downloads Goals The main objective of mini2Dx is

null 492 Dec 24, 2022
Othello PvP (2-Player) Game Application created in Java using Swing and AWT, for playing the Othello game

Othello PvP (2-Player) Game Application created in Java using Swing and AWT, for playing the Othello game, a simple game that played on an 8 by 8 checkered board with 64 double-sided black and white discs. The game is easy to learn, but it takes time to master and develop winning strategies.

Soumyadeep Pal 1 Feb 28, 2022
BattleShip-Game - This repository contains the code of the BattleShip (Bataille Navale) game programmed in Java.

Bataille Navale Auteur : SABIL Mohamed Amine Comment générer la documentation ? Placez vous dans le sous-dossier src : pour générer la documentation d

Mohamed Amine SABIL 1 Jan 4, 2022
Snake-Game - A simple snake game written in java.

What's this? A simple snake game written in java. How to play Download the latest release. Ensure that a compatible java runtime is installed (optimal

Patrick260 4 Oct 31, 2022
My Game Engine tested via my Cubecraft Game

My Game Engine tested via my Cubecraft Game Install: mvn -P {your OS name} clean install mvn -P mac clean install mvn -P linux clean install mvn -P wi

null 30 Oct 3, 2022
The game is a 2D side scrolling system, where a player moves left, right, vertically or diagonally to traverse the game.

The game is a 2D side scrolling system, where a player moves left, right, vertically or diagonally to traverse the game.

Ravi Mandal 7 Sep 11, 2022
A simple puzzle game made with Unity to practice the game engine

A simple puzzle game made with Unity to practice the game engine.

Eyüb Salih Özdemir 1 Mar 30, 2022
A basic representation of the 0-player game, "Game-of-Life", a simple example of basic cellular automata

Game-Of-Life-Basic A basic representation of the 0-player game, "Game-of-Life", a simple example of basic cellular automata. A cellular automaton is a

Nikhil Narayanan 5 Oct 27, 2022
Java game framework

Ethereal Game Framework Welcome to Ethereal game framework ! A java game framework that uses Swift as it's graphic renderer. ❗ It's the third version

null 3 Sep 13, 2022
An application which emulates the android chain reaction game on PC

chain_reaction_desktop An application which emulates the android chain reaction game on PC. Built using JAVA, GUI built with SWING. Download the CHAIN

Nikhil Narayanan 4 Sep 10, 2022
RockPaperScissor Android Game

RockPaperScissor Android Game Intro: Rock paper scissors is a hand game, usually played between two people, in which each player simultaneously forms

Siddhartha Bhattacharjee 1 May 9, 2022
LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR) applications.

LWJGL - Lightweight Java Game Library 3 LWJGL (https://www.lwjgl.org) is a Java library that enables cross-platform access to popular native APIs usef

Lightweight Java Game Library 4k Dec 29, 2022
Jetserver is a high speed nio socket based multiplayer java game server written using Netty and Mike Rettig's Jetlang.It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.

Note New version of Jetserver is called Nadron and is in a new netty 4 branch of this same repo. JetServer is a java nio based server specifically des

Abraham Menacherry 1.2k Dec 14, 2022
Mesh is a cross-version minecraft mod development platform for Forge and Fabric.

Mesh is a cross-version minecraft mod development platform for Forge and Fabric. Supported Versions Mesh will eventually be able to run on most f

null 12 Dec 13, 2022
A fairly Simple Game made in Java,You can adopt Pets, name them, and take care of them for XpPoints and level up!

Introducing PetGame! A simple console based game made by @denzven in Java ☕ About the Game PetGame is my first big project in Java, the rules are simp

Denzven 11 Jun 7, 2022
Golden Axe (1989) game implemented in java using only standard libraries (Java 2D, Swing, AWT & Java Sound API)

Golden Axe (1989) game implemented in java using only standard libraries (Java 2D, Swing, AWT & Java Sound API), so no external libraries required. Video: https://youtu.be/uevIVLNhQqs

Leo 101 Jul 21, 2022
Mod development kit for the Tecknix Client Modding API

Tecknix Mod Loader API THIS API IS NOT COMPLETE AND WILL NOT YET ALLOW YOU TO MOD THE CLIENT What is this? This is our modding MDK for Tecknix Client.

Tecknix Client 6 Sep 12, 2022