SFML Game Engine Part 1 – State Machine



Like our content and want to support us more directly? Help Us, Help You!

If you like this stuff, as always, show the love through comments, likes, favorites, subscriptions, etc.

Thousands of free videos at
www.sonarlearning.co.uk

If you have any questions feel free to post them at

Our Website

Facebook –
Twitter –
Google+ –
Donate –

Our games made using Cocos2d-x
——————————————————
iOS:

Google Play:

Check out our Cocos2d-x book to learn how to make games

Udemy Coupons
Here are coupons for all of my courses:
-Flappy Bird SFML Clone [50% OFF] –
-HTML [50% OFF] –
-CSS [50% OFF] –
-Three.js [50% OFF] –
-Tic-Tac-Toe Cocos2d-x [50% OFF] –
-Tic-Tac-Toe SFML [50% OFF] –
-Cocos2d-x Game Development [90% OFF] –
-A-Frame WebVR (Virtual Reality) [75% OFF] –

For all new courses feel free to ask for a coupon, enjoy.

Nguồn: https://dealerout.com/

Xem thêm bài viết khác: https://dealerout.com/game/

  • Welcome to this SFML tutorial.

    If you have any questions feel free to post them on our free education platform sonarlearning.co.uk

    Sonar Systems July 7, 2020 7:00 pm Reply
  • Hey Sonar… Why use Virtual

    Tladi Lebohang July 7, 2020 7:00 pm Reply
  • why you always use this in the state machine.cpp

    you don t need it in this case right?
    just acces to your private attribute

    bertrand le puissant July 7, 2020 7:00 pm Reply
  • I noticed that the 2nd parameter in the AddState function is called bool isReplace in the header file but then changed to bool isReplacing in the cpp file. Mistake?

    Bank21khz July 7, 2020 7:00 pm Reply
  • I don't understand how to use this state machine. Can anybody help me? I've tried looking up how std::stack works and so far I'm just confused.

    eons1993 July 7, 2020 7:00 pm Reply
  • Hey, could you explain, why did you pass delta time to "draw" method? I mean:

    void draw(float dt);

    Why does this function need to know time? I was thinking dt is required only for update() function, cause we want (as you said) frame independent, but when you just draw something you don't need to know any time.

    Latajacaryba July 7, 2020 7:00 pm Reply
  • Your coding style sucks, especially when you add extra spaces.

    Youcef Kouchkar July 7, 2020 7:00 pm Reply
  • Assertion fails at the last line of the StateMachine.cpp:

    StateRef &StateMachine::GetActiveState()

    {

    return this->_states.top();

    }

    what should I do ?

    P.S. I wrote the whole code and the game should run completely now but I get this box saying Debug Assertion Failed, Expression: cannot deference out of range deque iterator

    Maya Ghoneim July 7, 2020 7:00 pm Reply
  • StateRef &GetActiveState( );
    i don't understand this syntax and how it work;
    can someone explain for me, please. thanks.

    Duc Khai Tong July 7, 2020 7:00 pm Reply
  • Does this work the same for Windows?

    DP2G July 7, 2020 7:00 pm Reply
  • Is there any good reason you're using "#define SCREEN_WIDTH 1024" instead of "constexpr int 1024" ?

    Marcel Iwanicki July 7, 2020 7:00 pm Reply
  • The only part I dont really understand from this tutorial (and its purely just C++) is the "std::move()" function we are using when we are pushing the newState onto the Stack

    Can anyone please Explain?

    Other than that, amazing series!

    Marb July 7, 2020 7:00 pm Reply
  • This is no State machine, this is a State stack…

    Loïc BOUTTER July 7, 2020 7:00 pm Reply
  • Hello, Sonar Systems! I watched this and I learned a lot, but I am still confused about certain things.

    Why did you write inside(StateMachine.hpp):
    &GetActiveState();
    instead of just:
    GetActiveState();

    And what is the reason you chose unique_ptr for:
    unique_ptr<State> StateRef

    Reinards Saulītis July 7, 2020 7:00 pm Reply
  • All your videos are great and insightful! Plus, I realized my coding style is terrible compared to yours

    Unumandakh Bayandelger July 7, 2020 7:00 pm Reply
  • Hi, can this Game Engine that you have builded be useful for any kind of games? Thank you.

    Zenon Games July 7, 2020 7:00 pm Reply
  • Btw for you coders out there who aren't so familiar with C++, at 2:33 when he declared the function to zero he is simply stating that the function is a pure virtual function, which has no implementation in the parent class and needs to be implemented in an inherited class. This is C++'s special way of doing this, and it is quite weird so I thought I'd be helpful and point that out.

    Alex Ni July 7, 2020 7:00 pm Reply
  • Had issues getting the GetActiveStates definition to work with it in the .cpp file so moved it into the header file and used inline StateRef &GetActiveState(){ return this->_states.top(); } not sure if it will work yet but it seemed to be the only way to get it to work as Visual studio flagged it as an error.

    Eighties Gamer July 7, 2020 7:00 pm Reply
  • I think it is not good implementation of stack-based state machine. Everything can be done without any _isAdding/_isRemoving/_isReplacing

    NukeBird July 7, 2020 7:00 pm Reply
  • Hi,
    After I watched the video and wrote whole code from it, I'm getting a bunch of errors. Would you kindly help?
    Thanks in advance

    Rey The Pirate July 7, 2020 7:00 pm Reply
  • The menu can be considered a gameState or i should created in the main loop with a switch ?(i'm still learning)

    Víctor Jamet July 7, 2020 7:00 pm Reply
  • Awesome can't wait to see more!

    Matthew July 7, 2020 7:00 pm Reply
  • cool, new game engine series )

    Абылай Асан July 7, 2020 7:00 pm Reply
  • Be honest, which do u like more xcode or visual studio? btw educational vid 👍🏻

    Team Witcher July 7, 2020 7:00 pm Reply

Leave a Reply

Your email address will not be published. Required fields are marked *