spck framework(?)

Hi Everyone.

In the last couple of weeks I was working on my game idea which I presented somewhere here as well, but I halted it down for various reason.
Instead of this game I started to work on a framework which I call Spck.

This framework will do somewhat similar as libgdx long term, but short term it will just be a simple tool that I will use for my projects. I created this topic to get some feedback if it will be usable for someone else too and I’d like to gather some ideas as well.

Features (in priority order):

  • cross platform (opengl, vulkan, metal, directx) rendering via bgfx (through lwjgl), currently desktop only - done
  • Java 11 modular structure - done
  • Packaging via jlink
  • Tools for shader loading, parsing
  • ECS via Ashley
  • Obj file importing via Assimp
  • Batch rendering
  • A simple input system
  • A very simple UI framework
  • A very simple sound system
  • Tools for tiled map parsing
  • Android support
  • iOS support
  • ?

This is my honest opinion on your featureset:

  • ECS via Ashley - Disgusting :persecutioncomplex: use Artemis-odb, it’s faster and more mature.
  • Java 11 modular structure - Thumbs up
  • Packaging via jlink - Thumbs up
  • THE REST - LibGDX offers this already

If you make the engine very easy to use and also very very fast at what it can do i would consider trying it out, you know something that can be used to bang together prototypes at a gamejam. LibGDX is somewhat slow and bloated in some areas, it could really use some performance optimizations in the 3D section, it isn’t nowhere near how good it could potentially perform.

Apart from that i can’t see the merit of it compared to LibGDX or other Frameworks. That shouldn’t discourage you though, making an engine is a great programming exercise.

I ment artemis really, I dont know why I wrote ashley :open_mouth:
The goal is not beat or replace libgdx in anyway (I’m not that smart), but have something, not an engine but just a framework which can be used easily to start a java based game project which supports crossplatform rendering in native way with easy packaging. Maybe via jpackage in the future.

I’ve written a simple rendering engine already, and looks like I love to write these kinf of tools rather than writing games… :slight_smile:
Thanks for your feedback!

Hi,

I watch your work with attention, as I am trying to do approximately the same thing, my own game engine in java, with Koin3D project.

I will try to run your game to get ideas :slight_smile:

If you’d like to use AudioCue, please do so.

AudioCue is basically a souped-up Clip, slightly easier to invoke, with real-time volume, panning and pitch controls, as well as allowing concurrent playback. There are also line followers allowing one to trigger events on starts and stops.

As far as multi-platform compatibility: I wrote an Android wrapper for audio output from Java once before. I’ve worked on but not completed a wrapper that would work with lwjgl. But these should be surmountable tasks.

As I “promised” I started to work on it, here is the current status of the project: it’s on Github now! :slight_smile:

Link: https://github.com/mudlee/spck-framework

As I have time, I continue to work on this will see, where it ends up.

Looks interesting with the LWJGL BGFX Direct3D stuff. Does that work yet? Can you paint using Direct3D?
EDIT:

[quote]cross platform (opengl, vulkan, metal, directx) rendering via bgfx (through lwjgl), currently desktop only - done
[/quote]
Ooops, I see that it does! Nice one. For years we’ve lacked D3D via Java, so this is quite remarkable.
What’s the performance of D3D like compared to OpenGL?

Unfortunately (haha) I have no windows to test it, but according to the number of users using bgfx without any problem I suppose there is no performance issue at all. My project is in the very early stage, so everything is possible.

I found this series on YT: https://www.youtube.com/watch?v=JxIZbV_XjAs&list=PLlrATfBNZ98dC-V-N3m0Go4deliWHPFwT

This guy is fckin’ awesome. He works at EA and he’s been creating engines since years. So I got inspired and continued this thing what I started to first refactor that even BGFX is a rendering backend only.

Not yet done, but I see the light in the end of the tunnel now. Also, I’m getting used to bgfx and abstract rendering concepts. First goal is to have this spck framework in a state where anyone can use it for cross-platform rendering via vertex/index buffers and shaders. Then, I’d expand it with other stuff, I think for 2D mainly.

And today the main refactor is done. Now I can create a packagable (jlink) java 11 app, which can render vertex arrays via bgfx. On OSX with metal, on linux with opengl/vulkan, on windows with dx.

Next goal is cameras, then load a cube (easy) and submit a Mesh (with material) to the renderer. I might also write an automation that compiles bgfx’s shaders automatically into glsl and metal.

Currently, the client code is something like this:


...
public void initialized() {
	Shader shader = Shader.create("vs_cubes", "fs_cubes");

	VertexBufferLayout vertexBufferLayout = new VertexBufferLayout(
		new VertexLayoutAttribute(0, 3, Renderer.dataType.FLOAT,false),
		new VertexLayoutAttribute(4, 4, Renderer.dataType.FLOAT,false)
	);

	VertexArray vertexArray = VertexArray.create();
	vertexArray.addVertexBuffer(VertexBuffer.create(triVert, vertexBufferLayout));
	vertexArray.setIndexBuffer(IndexBuffer.create(triInd));

	triangle = SubmitCommand.indexed(vertexArray,shader, "Triangle");

	window.input.onKeyPressed(GLFW_KEY_ESCAPE,event -> stop());
}

public void update(Event event) {
	Renderer.startScene();
	Renderer.setClearColor(Color.RED); // not yet working
	Renderer.clear();
	Renderer.submit(triangle);
	Renderer.endScene();
}
...

In the last couple of days I started to write a more standard shader solution as I really don’t like bgfx’s glsl like approach.

I successfully created a process (not yet commited) where from glsl I can create a spir-v intermediate, which I can use to create hlsl and msl shaders.

QUESTION

I have some problem and went down to debugging and I just found that if I pass a valid program, but the shaders are messed up (syntax error for eg), still I get a triangle (but without colors). Even if I pass a random short to bgfx’s submit, it still renders my triangle. What???
Any idea how this works? Does it just drops all shaders it gets if it’s invalid?


var random_short = 0;
bgfx_submit( 0, random_short, 0, false);

If anyone interested, I got an answer here: https://github.com/bkaradzic/bgfx/issues/2126

I’m not sure if it’s a good cross-platform renderer, where you have to rely on an undocumented shader language like the BGFX’s GLSL like one. :frowning:

In an ideal world… we’d be able to write shaders in Java and transpile the bytecodes to SPIR-V somehow.

Cas :slight_smile:

I even can do that but until I have to convert it to bgfx’s format and it’s like a mess without proper doc. Its good that even minevraft uses it, but the lack of documentation scares me a bit. As I mentioned with SPIRV-Cross it’s enough to write the shader in glsl, and it can transpile it to hlsl/msl/vulkan, but looks like I have to write a converter to bgfx if I want to stick with it.

There’s some documentation on bgfx shaders here:

https://bkaradzic.github.io/bgfx/tools.html#shader-compiler-shaderc

You can download the bgfx tools from the file browser on the LWJGL website. For example:

https://www.lwjgl.org/browse/nightly/windows/x64/bgfx-tools

Yes I know both and I already created two sh/gradle tasks

  • one uses shaderc from bgfx-tools
  • one uses spirv-cross

Obviously I tried the second one integrate into this framework as I think people would like to use more standard GLSL shaders with khronos’s compiler than bgfx’s shaders and its tools.

So I think in the end I can endup with a solution but that will include bgfx toolings and I would rather trust khronos’s compiler than bgfx’s. That’s all :slight_smile:

I might be wrong but I’ll not use bgfx even though it looks really promising.

Reason(s):

  • I did a few hour research yesterday and found out that this project exists for years now and the community is still very small. Basically, there is only one core committer.
  • I found several reddit and gamasutra discussion where they mention that the author of the project constantly rejects standardization (I hope I write it right) they propose like standard shader language (which was my biggest complaint as well) or a proper build system. They also say that its code quality is questionable as well. I don’t want to stay at any side, but I do see that the community isn’t growing, even though there are production projects based on that.
  • Also I read multiple github issues (including mine) where I found that the guy’s attitude is not the one I like to cooperate with. Here I don’t want to be a puppy (or how do you say) but what I expect from such a project something like what the LWJGL guys do. They lead their community/forum/tech the best way I can imagine.

What will happen? I might give an another try to Vulkan, now I have more time than before, but as you see I can be very hectic. My goal is to still have a cross-platform framework/engine I can use for the next LD jam. I’ll get back here if anything changes.