March 16, 2020
On 2020-03-15 18:58, Steven Schveighoffer via Digitalmars-d-learn wrote:
> I'd prefer to do it with D.

How about raylib in conjunction with thin d bindings? I prefer it over sdl, sfml and the like.

https://www.raylib.com/examples.html (make sure to enable js for embedded examples)
https://code.dlang.org/packages/raylib-d
https://github.com/raysan5/raylib/blob/master/BINDINGS.md

> Should I just start with another language and then migrate to D later? 

If you can stomach lua(jit), check out love2d. Docs and provided game tutorials are super easy to follow:

https://love2d.org/
https://love2d.org/wiki/Category:Tutorials

Lastly, if you're more interested in the gamedev aspect, there's also the option to pick your poison from this curated mixed list of slim and fat 2d game engines:

https://thomasgervraud.com/best-2d-game-engine/
March 16, 2020
On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote:

>
> I would recommend using Derelict and SDL with D since it's the most mature.
>

Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore.

March 16, 2020
On Sunday, 15 March 2020 at 21:33:29 UTC, Arine wrote:

>
> I wouldn't use SDL2 for rendering. It is really just there for legacy. The only thing people use SDL2 is for setting up a window and creating a render context for OpenGL/Vulkan/Directx, along with handling input/events.
>

There's no need for someone just learning 2D games to implement their own OGL/Vulkan/DX renderer. The SDL2 rendering API is plenty fine.

And it isn't just for "legacy". It was supposed to be an enhancement over SDL's old SDL_Surface API. When they first implemented it, they restricted it to the features they implemented cross-platform in software. It also didn't do any batching for the hardware rendering. As of SDL 2.10, they have batching for the hardware renderers, which makes it even more usable.

The only time I would recommend against the SDL2 renderer for a 2D game is when you A) already have your own renderer implemented anyway, or B) need some fancy shader effect. I've seen people get some decent F/X with the SDL2 renderer, but it's limited in that regard. Still no need to implement a custom renderer, though, as SDL_gpu opens the doors to shaders.
March 16, 2020
On Monday, 16 March 2020 at 02:52:56 UTC, Mike Parker wrote:
> On Sunday, 15 March 2020 at 18:14:44 UTC, bauss wrote:
>
>>
>> I would recommend using Derelict and SDL with D since it's the most mature.
>>
>
> Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore.

Haven't even heard of that!

Does it work in similar fashion?
March 16, 2020
On Monday, 16 March 2020 at 05:45:52 UTC, bauss wrote:

>>
>> Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore.
>
> Haven't even heard of that!
>
> Does it work in similar fashion?

Yes. The loader is @nog and betterC compatible, and I've taken a different approach to handling multiple library versions. Other than that, basically the same.

https://github.com/BindBC/bindbc-sdl
March 16, 2020
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote:
> I want to try and learn how to write 2d games. I'd prefer to do it with D.
>
> I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start with another language and then migrate to D later? Anyone recommend any specific tutorial/book?

You can have a look at the SpriteKit framework [1]. Although it will only work on Apple’s platforms.

[1] https://developer.apple.com/spritekit/

—
/Jacob Carlborg
March 16, 2020
On Sunday, 15 March 2020 at 17:58:58 UTC, Steven Schveighoffer wrote:
> I want to try and learn how to write 2d games. I'd prefer to do it with D.
>
> I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start with another language and then migrate to D later? Anyone recommend any specific tutorial/book?
>
> -Steve

The problem of developing with D are the Libs.

Someone recommended Derelict but like Mike said:

> Please don't recommend Derelict to anyone :-) bindbc-sdl is what folks should be using now. I'm not maintaining Derelict anymore.

I was using Derelict because back in the day it was recommended here until to find out it was not supported anymore.

As I am game developer hobbyist, who likes to explore and recreate games and implement engines algorithm myself to mimic games like: Mario, F-Zero (Mode-7), Wolf3D (Raycasting), Doom and so on, I would recommend you to look over SDL (OpenGL is a plus), and the rest is just Math.

Sasha.
March 16, 2020
On Monday, 16 March 2020 at 03:03:15 UTC, Mike Parker wrote:
> On Sunday, 15 March 2020 at 21:33:29 UTC, Arine wrote:
>
>>
>> I wouldn't use SDL2 for rendering. It is really just there for legacy. The only thing people use SDL2 is for setting up a window and creating a render context for OpenGL/Vulkan/Directx, along with handling input/events.
>>
>
> There's no need for someone just learning 2D games to implement their own OGL/Vulkan/DX renderer. The SDL2 rendering API is plenty fine.
>
> And it isn't just for "legacy". It was supposed to be an enhancement over SDL's old SDL_Surface API. When they first implemented it, they restricted it to the features they implemented cross-platform in software. It also didn't do any batching for the hardware rendering. As of SDL 2.10, they have batching for the hardware renderers, which makes it even more usable.
>
> The only time I would recommend against the SDL2 renderer for a 2D game is when you A) already have your own renderer implemented anyway, or B) need some fancy shader effect. I've seen people get some decent F/X with the SDL2 renderer, but it's limited in that regard. Still no need to implement a custom renderer, though, as SDL_gpu opens the doors to shaders.

There's no need for someone learning 2D games to even bother with SDL2 to begin with. If you use SDL2 you are going to be using something no one else uses, you'll be wasting your by using something that isn't that good and what you learn from it won't be that useful. I don't know anyone that uses SDL2 actual API for rendering. Using OpenGL and similar API, you'll learn how data actually needs to be processed. If you just want to mess around with making a game, using a game engine like Unity is going to be better for that. No one should waste their time with SDL2's rendering API, it is awful and doesn't actually teach you anything about how rendering actually works.

So in either case, whether it be games you want to make, or game engines. You are better off not learning SDL2 rendering, as it would just be a waste of time.
March 16, 2020
On Monday, 16 March 2020 at 16:19:26 UTC, Arine wrote:

> There's no need for someone learning 2D games to even bother with SDL2 to begin with. If you use SDL2 you are going to be using something no one else uses, you'll be wasting your by using something that isn't that good and what you learn from it won't be that useful. I don't know anyone that uses SDL2 actual API for rendering. Using OpenGL and similar API, you'll learn how data actually needs to be processed. If you just want to mess around with making a game, using a game engine like Unity is going to be better for that. No one should waste their time with SDL2's rendering API, it is awful and doesn't actually teach you anything about how rendering actually works.
>

I just disagree completely. You'll find people in the SDL forums using it. I've used it. I've seen open source games using it. It's simple for someone just beginning to get started with. No need to muck about with the details of OpenGL, or with the complexities of a full-scale game engine. For Steve's purposes, it's just fine.


March 16, 2020
On 3/15/20 1:58 PM, Steven Schveighoffer wrote:
> I want to try and learn how to write 2d games. I'd prefer to do it with D.
> 
> I've found a ton of tutorials on learning 2d gaming with other languages. Is there a place to look that uses D for learning? Should I just start with another language and then migrate to D later? Anyone recommend any specific tutorial/book?

Thanks everyone for all the suggestions.

I'm probably going to start with SDL2 and try and get to the point where I understand and can use the lispysnake stuff. I can probably follow any C++/SDL2 tutorials and just do it in D instead.

Just getting the understanding of the lingo and the standard game design is really what I need to start with.

-Steve