Replies: 28 comments
-
Hi, yes I would like to support 2D gamedev. We can use this issue for feature requests/discussion. Regarding physics, I think we could use Jolt also for 2D. I will investigate this and ask the author of the lib about perf implications. |
Beta Was this translation helpful? Give feedback.
-
Great to hear that! Here's my wishlist:
Might be too much, feel free to take your pick 😊😁. |
Beta Was this translation helpful? Give feedback.
-
Regarding font system and UI - for my game, I plan to use font and UI system from dear imgui (zgui). |
Beta Was this translation helpful? Give feedback.
-
Hmm, never thought of this. I only use imgui to make tools. For a game, I might choose |
Beta Was this translation helpful? Give feedback.
-
I think it can with some code tweaks. I will be trying to do it for my games because I don't want to have another UI/font system. Will see how it goes. |
Beta Was this translation helpful? Give feedback.
-
I know this isn't exactly what you want, but there is now a 2D sample https://github.com/michal-z/zig-gamedev/tree/main/samples/instanced_pills_wgpu What might be of interest to you is the sample does an object space to clip space transform with correct aspect ratio. https://github.com/michal-z/zig-gamedev/blob/main/samples/instanced_pills_wgpu/src/InstancedPillsWgpu.zig#L629 I'm only interested in 2D as well and will simply use WebGPU with z == 0. |
Beta Was this translation helpful? Give feedback.
-
I create another 2D sample showing how to organize passes into layers https://github.com/Pyrolistical/zig-gamedev/tree/layers/samples/layers_wgpu @michal-z I didn't submit this as a PR as I don't know if it makes sense to be a sample for zig-gamedev. Essentially there is a mini half baked graphics framework in the sample itself. What do you think? |
Beta Was this translation helpful? Give feedback.
-
@Pyrolistical Looks nice. I think we can make a sample from it and then tweak/improve and potentially make a lib from this. |
Beta Was this translation helpful? Give feedback.
-
@michal-z the font system in imgui seems pretty limited. ootb it doesn't support rotatation/translation/scale of text |
Beta Was this translation helpful? Give feedback.
-
Do you mean our |
Beta Was this translation helpful? Give feedback.
-
Both? Unless you've added this functionality to zgui? I don't understanding your question. |
Beta Was this translation helpful? Give feedback.
-
Nvm, I thought you mean that this functionality is present in |
Beta Was this translation helpful? Give feedback.
-
We could render imgui text to a texture and then apply a transformation when drawing this texture to the back buffer (can be cumbersome, though). What do you think? |
Beta Was this translation helpful? Give feedback.
-
Yeah, that was my first thought as well, but the texture would need to be oversized in order to compensate for the rotation blur. Doable but cumbersome. The ideal solution would transformed the text in the shader and render out pixel perfect. Let me implement the render to texture and rotate as a sample. We'll see just how annoying that would be. |
Beta Was this translation helpful? Give feedback.
-
Yes, trying it out is a good idea, thanks! |
Beta Was this translation helpful? Give feedback.
-
Jolt Physics should get 2D support soon. |
Beta Was this translation helpful? Give feedback.
-
How's things going with 2d support of zphysics? No rush, just checking... |
Beta Was this translation helpful? Give feedback.
-
C++ version already supports 2D. Should be pretty easy to have it in zphysics. Will research and get back to you next week. |
Beta Was this translation helpful? Give feedback.
-
Jolt supports 2D by using constraints and locking one axis. There is a 2D example in the C++ repo added in this commit: To get this functionality we need to add "constraints" to our bindings. I will start working on it on Friday I think. |
Beta Was this translation helpful? Give feedback.
-
Actually it seems that there is a 2D branch: |
Beta Was this translation helpful? Give feedback.
-
I'm considering creating bindings for this lib as a 2D solution for zig-gamedev: https://github.com/grimfang4/sdl-gpu What do you think about this? |
Beta Was this translation helpful? Give feedback.
-
Frankly, with SDL3's gpu api being actively worked, I wouldn't be very interested in sdl_gpu. Keep improving zsdl is enough to my opinion. |
Beta Was this translation helpful? Give feedback.
-
Is SDL3 gpu API work done in public? I've only seen a very rough header file. My concern is that it may take years to come (making a shader language is a huge rabbit hole). Also, I have a feeling that official SDL3 GPU API will be a lower level HW abstraction. But yeah, I get your point. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Here is a link to SDL3 GPU API PR: libsdl-org/SDL#7067 |
Beta Was this translation helpful? Give feedback.
-
Looks like a minimal HW abstraction layer (no batching, etc.) Looks nice but I think that something like sdl_gpu will still be needed for 2D games. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
If there exists a webgpu backend for sdl-gpu, then yeah, I might give it a go. Otherwise, I prefer to SDL2 instead. |
Beta Was this translation helpful? Give feedback.
-
Note that sdl_gpu builds on top of SDL2. It basically provides batching and better sprite support to SDL2. |
Beta Was this translation helpful? Give feedback.
-
Sorry, didn't realize that. In that case, more ziggy API for sdl-gpu does sound tempting indeed. |
Beta Was this translation helpful? Give feedback.
-
Hi @michal-z , I've being following your work closely, nice work!
A quick question, will you consider add libs for 2d games? e.g. box2d/vector graphics/spine animation etc.
I'm asking because I think most indie developers choose 2d over 3d game (at least initially), since a decent 3d game requires way more expertise and amount of work.
Beta Was this translation helpful? Give feedback.
All reactions