Pages

Sunday, 7 November 2021

LP's 12 Months of Games // Timber!! [C++ & SFML]

Completed via Tutorial

I started a book called "Beginning C++ Games Programming" by John Horton. It's aimed at those who've never used C++ before and teaches you how to make 5 games using SFML. I thought this would be the perfect introduction to SFML as I could ignore the bits about C++ and focus on the library. I was right.

I've just completed the first game; Timber!! I've used sfml once, many years ago to try and make pong. At the time I had been learning cpp for about 6 months and found it utterly confusing. This time, thanks to experience with FLTK and DirectX it was more "ah so this is how I get a sprite, this is how I draw it, this is how you poll events" etc.

I'd say this project would take a while for a complete C++ beginner but it was perfect to showcase on how to get to grips with sfml. I'm looking forward to the other 4 games and learning other sfml features.

As for the tutorial itself; I don't like the amount of hardcoded numbers and the fullscreen game (I prefer windowed when debugging). All the textures rely on the screen being a certain size as well but I can remedy that in my own projects. Also, the author is extremely bias to arrays and OOP with the code being very java-ry. I wouldn't recommend the book for first time C++ programmers as I feel it would teach some bad habits; make sure you use Principles & Practice for cpp.

Finished Result:

LP's 12 Months of Games // Timber!! [C++ & SFML]

The assets were all provided by the book and I made a few adjustments to the code but other than that it's pretty much what the book gives.

I will say I'm extremely surprised by just how easy SFML actually is to use. I'm already formulating how to get a tetris game working or match 3 from just doing this simple game. So I guess it was a good tutorial overall.

Code:
A code drop will not be provided for this one as it's mainly from the book.

No comments:

Post a Comment