Re: Options for Cross-Platform 3D Game Development

2023-07-05 Thread IchorDev via Digitalmars-d-learn

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. ;)


Re: Options for Cross-Platform 3D Game Development

2023-07-05 Thread ryuukk_ via Digitalmars-d-learn
Oh, and i forgot to mention Sokol, great C library, i couldn't 
find D bindings, so you'll have to create your own (it's trivial)


https://github.com/floooh/sokol


Re: Options for Cross-Platform 3D Game Development

2023-07-05 Thread ryuukk_ via Digitalmars-d-learn

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.


Depends what you really want to do


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)


Or you can use WebGPU, despite its name it's crossplatform, 
targets Web via wasm (with LDC, requires some extra work tho), 
Windows, Linux, macOS, mobiles


- https://github.com/gecko0307/bindbc-wgpu





Options for Cross-Platform 3D Game Development

2023-07-05 Thread Andrew via Digitalmars-d-learn
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.


Re: Strange behaviour of __traits(allMembers)

2023-07-05 Thread IchorDev via Digitalmars-d-learn

On Wednesday, 28 June 2023 at 10:20:44 UTC, Dennis wrote:


It's now fixed: https://github.com/dlang/dmd/pull/15335


Yesss! You're a hero indeed!


Compiling to RiscV32

2023-07-05 Thread HuskyNator via Digitalmars-d-learn
Recently found out LDC supports cross-compiling to riscv, but 
while trying it out I can't seem to make it work. I am very 
likely missing something simple, as I haven't done something like 
this before. I've already been told it's likely something with 
linking, though I'm not sure how to set this up. (Nor even 
without imports & confined to 1 file)


Using a simple single '.d' file with no imports: `Error: cannot 
find program 'cc'`

With imports it's a longer issue:
```
E:\Code\D\Overig>ldc2 --mtriple=riscv32 --mcpu=generic-rv32 -c 
source/app.d
C:\Program Files\LDC 1.32\bin\..\import\std\stdio.d(49): Error: 
module `core.stdc.stddef` import `wchar_t` not found
C:\Program Files\LDC 1.32\bin\..\import\core\stdc\time.d(34): 
Error: undefined identifier `time_t`, did you mean function 
`time`?

... (many similar errors here)
C:\Program Files\LDC 1.32\bin\..\import\core\stdc\wchar_.d(175): 
Error: undefined identifier `wchar_t`, did you mean `dchar`?

```

Note, the command I'm using is: `ldc2 --mtriple=riscv32 
--mcpu=generic-rv32 -c source/app.d`


I've also wanted to look into dub's `--arch=riscv32` command, 
which should function given what I've read, though this just 
states it's not supported. (Even though I believe it should be 
using ldc for this?)


Apologies for naïvity here, I cant really find any examples or 
guidance.