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 theory is the same in any language ex. if you can write a 2d game in C++ chances are you can do it in D as well but you could probably apply the same theory to C, Java, Python etc.

So for D what you really need to be familiar with, is just the library you're using.

The theory for a 2d game is rather simple though.

You have a loop on the main thread (or ui thread) and within that you handle events, clear the screen, draw the graphics and repeat pretty much.

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

There's DSFML but it's dead and doesn't support the latest version of SFML.

You could also try SFML through Derelict but SDL just seems more stable tbh.

TBH. if you have any experience with GUI engines then applying that to writing a game is pretty much the same.

A player, monster, NPC etc. is just a sprite (which is pretty much just an image.) it has a size, position etc. and you just manipulate that based on the events you receive in your main loop etc.

I don't think there's currently any good or complete tutorials on game development in D, much less 2d game development. There's a lot of "dead" libraries etc.

If you can get a SDL application running and at the very least showing a window then I won't mind helping you in the right direction.

It should be trivial using the guides available at the derelict docs.


Reply via email to