Options for Cross-Platform 3D Game Development

IchorDev zxinsworld at gmail.com
Thu Jul 6 04:36:26 UTC 2023


On Wednesday, 5 July 2023 at 22:27:46 UTC, Andrew wrote:
> So, I've gotten the itch to have a go at game development in D, 
> after doing a bit of it in Java last year. I've previously used 
> LWJGL, which is a java wrapper for OpenGL, OpenAL, GLFW, and 
> some other useful libs.
>
> The problem is, apparently OpenGL is deprecated for apple 
> devices, so I don't really want to use that unless there are no 
> decent alternatives.
>
> So far, the most promising I've seen is 
> [bindbc-bgfx](https://code.dlang.org/packages/bindbc-bgfx), but 
> it's been a pain to set up due to having to build the bgfx 
> codebase, which requires a specific version of glibc that my 
> distro (Linux Mint) doesn't offer yet.
>
> Are there any other recommendations for cross-platform 
> rendering libraries? Of course I could use a pre-made game 
> engine like Unity or Godot, but for me, most of the fun is in 
> making the engine.

Lately I've been diligently updating BindBC-bgfx because bgfx is 
seriously really good. About your glibc problem, you can use an 
older version of bgfx (which might mean 1. you have to use the 
old BindBC-bgfx API, or 2. run the *newest* [binding generator 
script](https://github.com/BindBC/bindbc-bgfx/#generating-bindings) on an older version of bgfx; rather than running the old generator script that comes with that older version), or you can build and install a newer version of GDC yourself, which is what I did. It's VERY slow to build, but relatively painless otherwise.

bgfx is a little bit confusing for a first-time user, but if you 
have any trouble setting it up try searching through the bgfx 
Discord server, and if you can't find the answer that way then 
just ask for help there. Its documentation is alright but some of 
the English in it isn't the best.
Once you're familiar with it, it's a really simple and powerful 
API that can do basically anything, but it's all rendering 
backend-agnostic.

On Wednesday, 5 July 2023 at 23:53:41 UTC, ryuukk_ wrote:
>
> If you need something that provides you an API to render things 
> directly without doing raw GPU commands, then RayLib is 
> excellent, you can still build your engine around it, it act 
> like a framework a la libGDX/XNA/MonoGame
>
> - https://github.com/schveiguy/raylib-d
>
>
> If you want to create your own engine from scratch, then Vulkan 
> (works on mobile/linux/windows and macOS via moltenvk)

I wouldn't really recommend Raylib unless you only plan to use 
fairly rudimentary 3D, as I've found its 3D rendering to be very 
limited. Unlike bgfx it can't do compute shaders, read-back from 
the GPU, instancing, 32-bit index buffers, etc.
[Raylib's 
cheatsheet](https://www.raylib.com/cheatsheet/cheatsheet.html) 
should give you an idea of what you CAN do with its API.

On Wednesday, 5 July 2023 at 23:53:41 UTC, ryuukk_ wrote:
>
> If you want to create your own engine from scratch, then Vulkan 
> (works on mobile/linux/windows and macOS via moltenvk)

Vulkan is also a really good option, and probably a bit faster 
than bgfx (or OpenGL obviously), but its API is very complicated. 
My head nearly exploded trying to use Vulkan, and I never got to 
the point of rendering 1 triangle. If you think you're enough of 
a genius then I'd say at least give it a shot. Worst case 
scenario is you give up after spending a day or two trying to 
learn it.

P.S. I'm planning on adding a native-D bgfx backend to 
BindBC-ImGui 1.0 (my WIP bindings to the ImGui C++ API), if 
that's of interest to you. ;)


More information about the Digitalmars-d-learn mailing list