Giter VIP home page Giter VIP logo

azurite's Introduction

Azurite

Azurite is a 2D Java game engine built by the Games with Gabe Discord/YouTube community.

Explore the docs ·· Watch the introduction video ·· Check the Project Board

Table of Contents

Features

  • Modern OpenGL through the LWJGL 3 library for fast GPU rendering.
  • Entity Component System
Name Support Render Context
Windows Working OpenGL 330
macOS Working OpenGL 3.3 Core
Debian / Ubuntu Working OpenGL 330
Arch / Manjaro Working OpenGL 330
Other Distros Planned OpenGL 330
FreeBSD Planned -
Android Planned OpenGL ES
IOS Not Planned -

Built With

Code Samples

BoilerPlate Code:

public class Main extends Scene {
	public static void main(String[] args) {
		Engine.init(1920, 1080, "Azurite Engine Demo In Comment", 1.0f);
		Engine.scenes().switchScene(new Main());
		Engine.showWindow();
	}

	public void awake() {
		Graphics.setDefaultBackground(Color.BLACK);
		camera = new Camera();
		...
	}

	public void update() {
		...
	}
}

Simple example with sprites:

public class Main extends Scene {
	GameObject player;
	Sprite s;

	public static void main(String[] args) {
		Engine.init(1920, 1080, "Azurite Engine Demo In Comment", 1.0f);
		Engine.scenes().switchScene(new Main());
		Engine.showWindow();
	}

	public void awake() {
		Graphics.setDefaultBackground(Color.BLACK);
		camera = new Camera();

		player = new GameObject();
		s = new Sprite("src/assets/sprite.png");
		player.addComponent(new SpriteRenderer(s, new Vector2f(100)));
	}

	public void update() {
		if (Keyboard.getKeyDown(GLFW.GLFW_KEY_SPACE))
			player.transform.add(new Vector2f(1, 0));
	}
}

Getting Started

Prerequisites

  • OpenGL capable graphics card (minimum core 330)
  • OpenGL capable graphics driver
  • Java 11

Project Setup

To begin contributing, create a fork of this repository. Using intellj, import this project from existing sources as a gradle project. Build gradle, then run the Main scene (located in the scenes package). Follow this link for tutorials on cloning and importing to either Intellj or Eclipse.

Documentation

License

Copyright (c) 2023 MIT License

Contact

Discord Server in the #azurite-development channel

azurite's People

Contributors

aemogie avatar athaun avatar goldspark avatar gvicentin avatar hilbertcurve avatar juyas avatar kaiyaok2 avatar pixelrifts avatar pricter avatar sevanescence avatar stilltree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

azurite's Issues

Issue with character controller

if i am accelerated to a speed in direction left, and i press the right key (a), i am not moving in the right direction i am slowing down and sometimes it is not even slowing down, and sometimes i am accelerated for no reason if i release the right key

Apple Silicon - unit 2 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float)

Warning when running some scenes on mac OS.

2022-02-18 22:22:23.705 java[64638:5363288] [JRSAppKitAWT markAppIsDaemon]: Process manager already initialized: can't fully enable headless mode.
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 1 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

Reason for this is unknown right now, this issue is mostly a reminder for myself to debug it.
Possibly a result of System.setProperty("java.awt.headless", "true"); on L. 139 in graphics.Window

Camera doesn't respond to window resize

image
Probably more than just the camera being problematic here. This should be fixed by 1.0
Expected result: should center camera on player.
Actual result: camera centers on point left and up of player.

Crash Logger not showing sufficient information (feature suggestion)

When the engine crashes, the logger only shows first stack frame of the crash, not any stack frames related to it. The logger also seems to throw an error of its own while printing out the stack frame.

Steps to reproduce

Set logging level to Log.ALL: Log.setLogLevel(Log.ALL);
Put any error-generating function into the update method of the scene. I used this one:

int[] foo = new int[]{1};
int foo2 = foo[1];

Suggested behavior

An error message that shows the full stack frame, or some metric/setting that would enable that behavior

Current behavior

As described above, it only shows the first stack frame, and then some crash message related to the logger failing.

Error logs

[CRASH] {scenes.AudioDemo.main(AudioDemo.java:24) -> scenes.AudioDemo.update(AudioDemo.java:44)} Index 1 out of bounds for length 1
Exception in thread "main" java.lang.NullPointerException
	at util.Log.crash(Log.java:279)
	at util.Engine.showWindow(Engine.java:79)
	at scenes.AudioDemo.main(AudioDemo.java:24)

2D raycast lighting

  • tangent point calculation
  • raycast against polygons
  • raycast against circle
  • light - color support and gradient
  • opacity

Issue with collision system

If, in game you press "W" key, making you go up, you are accelerated to insane speed, and once you reach the top, by spam clicking the "W" key, you can just slip outside the room like structure , allowing you to go out of the world

Issue with tile rendering.

This bug is related to the bug with collision system, the same here, when i am accelerated to insane speeds, Example: There is a block tile above me and i spam the w key, the tile start to jitter and small white lines appear between the tiles, and it happen for all the tiles, even though i am not even touching them

Errors on unidentified key code.

Throws an ArrayIndexOutOfBoundsException when any key that GLFW does not support is pressed.
i.e. when keycode -1 is sent, it's still being used to index into the keystateBitfields array.

Steps to reproduce

  1. Open any scene
  2. On windows, hit a function key without the fn key, so that it does the action, such as increasing/decreasing volume/brightness.

What you expected would happen

For the key to be ignored.

What actually happens

An ArrayIndexOutOfBoundsException is thrown

Error logs

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 400
	at input.Keyboard.resetKeyDownBit(Keyboard.java:64)
	at input.Keyboard.lambda$setupCallbacks$0(Keyboard.java:41)
	at org.lwjgl.glfw.GLFWKeyCallbackI.callback(GLFWKeyCallbackI.java:44)
	at org.lwjgl.system.JNI.invokeV(Native Method)
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3397)
	at graphics.Window.showWindow(Window.java:205)
	at util.Engine.showWindow(Engine.java:55)
	at scenes.AudioDemo.main(AudioDemo.java:21)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.