Jump to content

  • Log In with Google      Sign In   
  • Create Account


SuperV1234

Member Since 26 Jun 2011
Offline Last Active Apr 17 2014 05:13 AM
-----

Posts I've Made

In Topic: [Video Tutorial] Arkanoid in 160 lines - C++11 + SFML2

03 January 2014 - 07:40 PM

Hello everyone!
 
I've uploaded the fourth episode of "Dive into C++11" on my YouTube channel.
 
 
After looking at C and C++'s memory and lifetime management in part 3, we'll take a brief look at C++11 smart pointers. We will learn what they are, what problem they solve, their advantages and their uses.
 
The intended audience for this tutorial/screencast are people who have some experience with C++ in general, and who watched the previous episodes. 
This episode may be very interesting for pre-C++11 users who want to learn modern C++11 memory management, but it is also suitable for beginners.
 
I greatly appreciate comments and criticism, and ideas for future videos/tutorials.
 
Feel free to fork/analyze the source code at: https://github.com/SuperV1234/Tutorials

In Topic: [Video Tutorial] Arkanoid in 160 lines - C++11 + SFML2

29 December 2013 - 11:08 AM

Update: I've finished writing the source code for part 4 of the tutorial. 
Since I'll be busy this week it will take a while before I start recording.
 
The source code is available here. If anyone is not currently busy, I'd really like to hear some feedback on the code before I start recording, so that the quality of the final video could improve. Thanks!

In Topic: [Video Tutorial] Arkanoid in 160 lines - C++11 + SFML2

15 December 2013 - 02:13 PM

I've uploaded the third episode of "Dive into C++11" on my YouTube channel.



Video || Playlist

In this episode we'll take a break from game development to delve into C and C++'s memory and lifetime management. We'll talk about automatic variable lifetime, pointers in general and dynamic memory allocation.

The intended audience for this tutorial/screencast are people who have some experience with C++ in general, and who watched the previous episodes. This episode may be very interesting for those with experience with C++ who want to learn more about variable lifetime and memory management.

I greatly appreciate comments and criticism, and ideas for future videos/tutorials.

Feel free to fork/analyze the source code at: https://github.com/SuperV1234/Tutorials


In Topic: [Video Tutorial] Arkanoid in 160 lines - C++11 + SFML2

01 December 2013 - 05:02 AM

Thank you Goran for the interesting feedback. I'll reply to every single point.



"testCollision" is a very poor name for a function that does much more: You're not just testing if a collision occurred; You're modifying game state, and this should be reflected in the function name.


You're right - `testCollision` is a misleading name. I'll address this in a future video.



The erase + remove_if + lambda combo used to remove destroyed bricks is a good showcase of new C++ 11 features, but I think you overstate the performance aspect: At most, you can remove 3 bricks at the same time (and that would be an extremely rare event), so the "block remove" optimization features offered by erase are basically irrelevant here.


True, the performance aspect may be irrelevant in a game like this one, but it's still the way to go, in my opinion. It's a scalable approach that works with any type of game: what if an user tries to make a shoot'em'up game after watching the tutorial? Erase-remove_if will work great.



The whole "frame time" segment should have been left out, in my opinion, because, as you yourself explained, it leads to a pretty absurd situation, where a slower machine has to do more work, so ... Is that really a solution?


If you are referring to the part before the "time slices": I included that part to show the train of thought that brought me to using slices.
If you are referring to "time slices" themselves: it's not "a solution", but it's the "best solution", in my opinion. It has been used a lot in the past, and even if there are some drawbacks it's a lot better than scaling movements/actions with frametime.
Take a look at these links for more information:
http://fabiensanglard.net/timer_and_framerate/
http://www.koonsolo.com/news/dewitters-gameloop/



I don't see the point of replacing the content of main with Game::run. That seems like needless indirection.
 
It's good to have a Game structure that encapsulates your gamestate, but there's no reason why your high-level flow can't stay in main.


As I said in the video, it's not a global solution, but it's what works for me. I like my code to be as structured and abstracted as possible.
While having a `Game::run` may be totally unnecessary for an Arkanoid clone, I was going for a more scalable approach: the `Game` class design works well in larger games (especially when dividing the `Game` class itself in `GameWindow` and `GameState`).



Thanks again for the criticism. I really enjoy reading other people's opinions and improving my videos/knowledge.
Also, your YouTube videos are really interesting! smile.png

In Topic: [Video Tutorial] Arkanoid in 160 lines - C++11 + SFML2

29 November 2013 - 03:54 PM

I've uploaded the second episode of "Dive into C++11" on my YouTube channel.
 

 
Playlist: http://www.youtube.com/playlist?list=PLTEcWGdSiQenl4YRPvSqW7UPC6SiGNN7e
 
The video is quite long - if you want to skip to the parts you may find most interesting, here's a schedule:
 

 

0:00 - constexpr addendum
3:20 - uniform intialization syntax addendum
10:10 - 1st segment (const-correctness, noexcept, event polling)
19:40 - 2nd segment (FPS and Frametime management)
34:15 - 4th segment ("time-slicing" for consistent logic with any FPS)
45:10 - 5th segment (refactoring)


 
 
In this episode we will learn more about two previously mentioned new awesome C++11 features: "constexpr" and "uniform initialization syntax".
 
Most importantly, we will also deal with a very big issue that every game developer must face: FPS/frametime, and how to avoid the game from behaving differently on slower/faster machines. 
 
In addition, we'll also briefly learn about "const-correctness" and using the "noexcept" keyword.
 
We will analyze the "time-slice" method to allow the game to run smoothly and consistently on every machine.
 
In the last code segment, we will also "refactor" our code by creating a `Game` class, making our source much easier to read and maintain.
 
I greatly appreciate comments and criticism, and ideas for future videos/tutorials.
 
Feel free to fork the game's source code at: https://github.com/SuperV1234/Tutorials

PARTNERS