What I did today

I finally made some progress in debugging problematic models from blender into jME. got animations and bones at the same time now.

Just have to fix the models now.

Started learning JavaFX today, and starting writing a project generator (for desktop and html5) projects with SilenceEngine.

It’s just been two hours, and I have got the UI working. Time to work on the actual generator now.

Thanks to Drenius for unlocking my thread! I have posted a first demo on the thread now… 9 months after starting the thread :slight_smile:

It’s been fun working on the UI for a bit. Its so much easier improving the UI in comparison to getting the AIs to work right (given that they have to balance multiple competing and shifting priorities and requirements). Vangard is almost game-like now, assuming you like games where you collect and sell apples, combined with a little demonic possession of random passers-by :slight_smile:

So after a lot of fiddleing around I got my software raytracer ā€œportedā€ over to OpenGL.

Here is how it looks now (I added some shading depending on the distance the ray traveled, no shadows in the hardware version yet):

While the exact same scene would take around 500 ms to render in my software renderer, it only takes ~2.71 ms on my GPU. (NVidia GeForce GTX 550 Ti).

My shader is not optimized yet obviously. Still got like a LOT of branching going on (6 if’s per ray), but i dont feel like optimizing today, so yeah.

Hardest thing in hindsight was getting all the voxel information accessible in my shader. A simple uniform array of int’s didnt work, since the maximum length of a uniform array is at about 400, but i have 8400 voxels (including ā€œempty/invisibleā€ voxels). The solution was using a texture + texelFetch in the shader. On the internets i read that a Texture Buffer Object is just the right thing to use so I tried that and after lots of fiddleing i got it to work. fyi: the internal format GL_RGBA8 didn’t work for me, I used GL_R8UI and rewrote the index access in my shader. That seemed to work…

Whats next? Probably realize i’m just playing around with stuff instead of writing a game. But I’m sure thats not too bad.

use ssbo

I read about them but quickly decided against them since, they require OpenGL version 4.3, compared to TBO’s only needing 3.0.

Why not just use a 3D texture? It’s a volume after all.

Bought a new smaller laptop to code while driving (train) to and from work - last week was already really productive that way and it works quite well - no internet == no distractions -> just me and my code.

Already implemented the animation editor that I thought would take quite long and tweaked the GUI a lot. Also found some nasty bugs and fixed them - can’t imagine how I could be so stupid to introduce them in the first place ::slight_smile:

(Not really today, but yesterday evening)

I finally finished this player character animation preview for my game :slight_smile:
I personally find the result more than satisfying (never hoped to get it that smooth on my first try), but I’d like to hear what you guys think… Would this kind of animation work in a game?
Also do keep in mind that the images I used are just placeholders I quickly made — using my MOUSE —, I’ll make better ones with a pencil, watercolour paint and a scanner :wink:
All in all, I used 16 png pictures for the bodyparts.

warning: gif might be a little heavy for phone users out there, idk

If you take a look to the right of the gif, you can observe I kinda funbled around to get the result :persecutioncomplex:

J0 :slight_smile:

I would actually recommend you an existing animation program. I made good experience with Spine; But it costs some bucks. It would allow you to easily import what you’ve now hard coded. Before I used Spine I’ve used Unitys animation capability and exported the animations with a custom script so I could load them with Java :stuck_out_tongue:

You made those with a mouse you say? :o

-ClaasJG

+1 for Spine, it’s ace.

Cas :slight_smile:

Thanks ClaasJG! However, the game I’m currently making should not hold too many animations like this one (probably just the eight directions N/NE/E/SE/S/SW/W/NW for the character), so I’m not willing to pour money just for that… Plus, I’m using OpenGL and I see Spine only exports to Libgdx… Would someone know a free alternative? :persecutioncomplex:

I struggled quite a lot with that hahah! I’m taking what you said as a compliment, thanks :wink:

J0 :slight_smile:

Decided that to turn my current prototype into a finished game I need to start writing about it as a WIP-project. That should force me to produce somewhat regular updates instead of occasionally tinkering with non-important details.

Made a short demo of LWJGL 3’s Vulkan documentation:

6Ni6hELM-8I

With a little work you could probably use the libgdx with a custom renderer and use whatever rendering setup you want.
https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-libgdx

Finally finished writing software command buffers for OpenGL. I ended up going with raw memory pointers for writing commands instead of storing commands as objects.

Before you start reading this, keep in mind that I am well aware of how crazy this sounds. xd I realized that I will probably need hundreds of commands to do everything I want in OpenGL, which isn’t exactly fun to maintain if I also have to write and read the data from these commands to a memory pointer manually, so I decided to… write a program which generates the code. >> << For example given this input class:

public class CmdBindFramebuffer {
	public int fbo;
}

it outputs the following class:


package engine.age.objects.cmd.glcmd;

import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;


import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL12.*;
import static org.lwjgl.opengl.GL13.*;
import static org.lwjgl.opengl.GL14.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL21.*;
import static org.lwjgl.opengl.GL30.*;
import static org.lwjgl.opengl.GL31.*;
import static org.lwjgl.opengl.GL32.*;
import static org.lwjgl.opengl.GL33.*;

@SuppressWarnings("unused")
public class CmdBindFramebuffer {

    public static final int COMMAND_ID = 0;

    public static final int SIZE = 8;

    private static final int FBO_OFFSET = 4;


    private CmdBindFramebuffer() {}


    public static long store(long address, int fbo) {
        memPutInt(address, COMMAND_ID);
        memPutInt(address + FBO_OFFSET, fbo);
        return address + SIZE;
    }

    public static long execute(long address) {
        int fbo = memGetInt(address + FBO_OFFSET);

        execute(fbo);

        return address + SIZE;
    }


    public static void execute(int fbo) {
        glBindFramebuffer(GL_FRAMEBUFFER, fbo); //<--- inserted by me manually after generation
    }
}

To store the command in a memory pointer, I just do the following:

		prepareCommand(CmdBindFramebuffer.SIZE);
		currentAddress = CmdBindFramebuffer.store(currentAddress, activeFramebuffer.getFBO(currentSubpass));

Now, the generator also goes through all template classes and regenerates them each time I run the generator (leaving the execute() function intact so that it doesn’t remove the code I’ve written manually) and assign a unique ID to each one. It also outputs to System.out a huge switch() statement for running a command buffer as well. Currently I only have two commands, so it’s not that big yet. =P

long address = pageAddresses[i];
for(int j = 0; j < commandCount; j++){

    int commandID = memGetInt(address);
				
    //This part is generated.
    switch(commandID){
        case CmdBindFramebuffer.COMMAND_ID: address = CmdBindFramebuffer.execute(address); break;
        case CmdClearBuffer.COMMAND_ID: address = CmdClearBuffer.execute(address); break;
        default: throw new RuntimeException("Unknown command: " + commandID);
    }
}

It’s pretty neat. xd I’m now at feature parity with the Vulkan version, where I can start render passes and have them automatically clear the attachments for me (it’s a feature in Vulkan, emulated using glClearBuffer**() in OpenGL the first time a color attachment is used).

EDIT:
More advanced example with static final variables preserved:
Input: http://www.java-gaming.org/?action=pastebin&id=1443
Output: http://www.java-gaming.org/?action=pastebin&id=1444 (execute() method written manually by me of course)

Why have you decided to do this much work to support both OpenGL and Vulkan through an abstract layer?

Because it’s awesome? Jokes aside, I want to support OGL3 hardware as well, and they don’t support Vulkan. Also it’ll be interesting to have a perfect comparison between the two.

Well i finished my math and some prototypes of IK using FABRIK method and tested some constraints. Will be adding to jME next week.

Managed to solve my 4x4 in 11 mins. I don’t really do speed solving. Also this had only one parity error, so almost as fast i probably am right now.

Not sure why generate abstract layer for library - But its cool =)
What java Source analyze methods you use ?)

up:
ou i understand ^^
need overwrite static vars, methods :wink:
[icode]public static final int COMMAND_ID[/icode] and [icode]public static long execute[/icode]
Its’s better in many cases use direct compiled code without generating code
-it looks very cool and flexible, and it really is,
but you receive many trash code that can be optimized by abstract function and interfaces.

Like this:


    private static final int V0_OFFSET = 16;
    private static final int V1_OFFSET = 20;
    private static final int V2_OFFSET = 24;
    private static final int V3_OFFSET = 28;

this Vars are same(generated)
So you can move them into [icode]abstract class CmdClearBuffer_Abs[/icode]
And generate (or extend directly ^^)
[icode] CmdClearBuffer extend CmdClearBuffer_Abs[/icode]

Simple words: take care about overflow of generated code :wink:

up2: ^^


-public static long execute(long address)
-public static void execute(int fbo)
+public static long execute_Address(long address)
+public static void execute_Buf(int fbo)