Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

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.

You must be logged in to vote

Replies: 28 comments

Comment options

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.

You must be logged in to vote
0 replies
Comment options

Great to hear that! Here's my wishlist:

  • Sprites batching support (with optional shader effect)
  • Tiled editor support
  • 2D Physics
  • Vector graphics
  • Font system
  • Animation system (3d also)
  • Particle system (3d also)

Might be too much, feel free to take your pick 😊😁.

You must be logged in to vote
0 replies
Comment options

Regarding font system and UI - for my game, I plan to use font and UI system from dear imgui (zgui).

You must be logged in to vote
0 replies
Comment options

Hmm, never thought of this. I only use imgui to make tools. For a game, I might choose
a more stylish one (with some animation behavior and colorful skins). Not sure if imgui can
deliver that.

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

@Pyrolistical Looks nice. I think we can make a sample from it and then tweak/improve and potentially make a lib from this.

You must be logged in to vote
0 replies
Comment options

@michal-z the font system in imgui seems pretty limited. ootb it doesn't support rotatation/translation/scale of text

You must be logged in to vote
0 replies
Comment options

Do you mean our zgui wrapper or the dear imgui lib?

You must be logged in to vote
0 replies
Comment options

Both? Unless you've added this functionality to zgui? I don't understanding your question.

You must be logged in to vote
0 replies
Comment options

Nvm, I thought you mean that this functionality is present in dear imgui but that we just don't expose it yet.

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

Yes, trying it out is a good idea, thanks!

You must be logged in to vote
0 replies
Comment options

Jolt Physics should get 2D support soon.

You must be logged in to vote
0 replies
Comment options

Jolt Physics should get 2D support soon.

How's things going with 2d support of zphysics? No rush, just checking...

You must be logged in to vote
0 replies
Comment options

C++ version already supports 2D. Should be pretty easy to have it in zphysics. Will research and get back to you next week.

You must be logged in to vote
0 replies
Comment options

Jolt supports 2D by using constraints and locking one axis. There is a 2D example in the C++ repo added in this commit:
jrouwe/JoltPhysics@4f97968

To get this functionality we need to add "constraints" to our bindings. I will start working on it on Friday I think.

You must be logged in to vote
0 replies
Comment options

Actually it seems that there is a 2D branch:
https://github.com/jrouwe/JoltPhysics/tree/feature/2d_sim

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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.

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!

You must be logged in to vote
0 replies
Comment options

Here is a link to SDL3 GPU API PR: libsdl-org/SDL#7067

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

If there exists a webgpu backend for sdl-gpu, then yeah, I might give it a go. Otherwise, I prefer to SDL2 instead.

You must be logged in to vote
0 replies
Comment options

Note that sdl_gpu builds on top of SDL2. It basically provides batching and better sprite support to SDL2.

You must be logged in to vote
0 replies
Comment options

Sorry, didn't realize that. In that case, more ziggy API for sdl-gpu does sound tempting indeed.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
3 participants
Converted from issue

This discussion was converted from issue #95 on March 31, 2024 18:04.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.