Best way to learn 2d games with D?

Jordan Wilson wilsonjord at gmail.com
Sun Mar 15 20:12:16 UTC 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

I'm on a similar journey myself, I'll list my findings, maybe it 
could be useful for you.

I decided on a game programming library. I mostly looked at SFML 
and Allegro, and found both to have good bindings available in D, 
and good documentation, and got minimal examples working with 
both. I went with SFML, simply because there was a book written 
specifically about writing a game in SFML. I didn't see any such 
books for Allegro (although there are plenty of 
tutorials/articles).

I learnt about the "game loop". Bauss touched on it in his post, 
and I'm sure there are a lot of tutorials on it. I specifically 
learnt about it from the first few chapters of the SFML Game 
Development book.

I learnt about game design. In doing so, I came across 
Entity-Component-System design pattern. I decided to use this 
pattern, for no other reason than to try something other than OOP.
I found these links useful:
https://medium.com/ingeniouslysimple/entities-components-and-systems-89c31464240d
https://gameprogrammingpatterns.com/component.html
https://www.richardlord.net/blog/ecs/what-is-an-entity-framework.html

I started writing a game, using the derelict-sfml2 as my game 
library (again, I found the allegro library to be good too), and 
entitysysd to provide the ECS framework (there are a few ECS 
written in D available). Are they the best choices? Is SFML 
technically limited? Will I cope with ECS beyound the toy game 
example? No idea. But I'm having a lot of fun, which I think for 
a hobby project, is a fairly good measure of success ;-)

Jordan



More information about the Digitalmars-d-learn mailing list