I watched this video one day when I was making my first 2D game in C++. Now I'm making a 3D game engine and couldn't get collision to work. Reminded myself of this video and it helped, eventhough it's shows 2D collision =) Thanks a lot man!
Thank you, I am just getting started on an SFML game, but I'm using the C bindings, making following along with most tutorials tough, because they're all in C++. However, it was much easier to adapt your lessons than anyone else's c++ lessons because yours are so clear and concise. Great stuff! I hope you make more eventually!
man i wanted to enter in gui, but i didnt really know anything apart from opengl and opengl has a huge learning curve, awsome tutorials, you earned a sub
These tutorials have been tremendously helpful! I watched every one, some multiple times. You have improved my c++ and SFML greatly and I really hope you're doing well and one day, if you're not too busy, will once again make a tutorial :) thank you!
I think the reason for falling through the floor when moving the window is because it pauses deltaTime. When the window is released, deltaTime will be however long it was held. In the statement that applies gravity, velocity.y += 981.0f * deltaTime, if deltaTime is large enough, say 1 second, out velocity.y is equal to 981.0f. On the next frame, we move exactly that much, completely skipping through the floor before we can detect collision. It has nothing to do with how close you are to the edge. I think I solved this (At least partially) by adding a isTouchingGround boolean to player. It is initialized to false and becomes false whenever jumping. It becomes true when jumping or whenever y velocity is not 0.0f. It becomes true when colliding with the ground. Gravity is only applied if !isTouchingGround. To ensure that you can't walk off the edge and float due to isTouchingGround being set to false, you have to set velocity.y to true if isTouching ground is true. This is fine most of the time because you collide with the ground constantly, but when you walk off the edge, you'll still fall. The only issue that I couldn't fix is that if you Move with screen while in midair, the problem persist because you can build up deltaTime, so it needs some work. Your way is better right now, I just wanted to give perhaps a lead to a solution. Thank you for your tutorials!
Actually you don't have to set deltaTime to anything to avoid Tux's falling down. You can also create sf::Vector2i window_position=window.getPosition(); and make a while loop: while(window_position!=window.getPosition()) { clock.restart(); window_position=window.getPosition(); } And that's it, Tux'x not falling anymore and i think it's better than setting deltaTime to specific value :)
When you've been coding in c++ for almost 5 years, every single day, when it's your life. And you sit for hours on end to fix a bug that turned out to be because of a horrible copy-paste accident.
I might do a tutorial about SAT in the future. But it probably won't be any time soon. I don't think that most of my subscribers are on the level that they need to be at in order to understand SAT. I do however have a video that I made for uni in which I explain the basic concept of SAT, and there are a lot of great textual tutorials available on the internet if you are really interested in this topic.
Hey! Sorry I fell off of the face of the earth. College all of a sudden became a lot more busy since I had to build up a portfolio, then I had two internships and now I'm working full time at Nixxes Software. Life has been busy. :) I really would like to come back to UA-cam however since I loved making this video's, so I might make a couple more video's in the next couple of months!
Thank you so much! I have honestly been having a great time working at Nixxes for the last two to three years. In that time I have worked on four released games. Tomb Raider, Lara Croft and the Guardian of Light and Lara Croft and the Temple of Osiris on Stadia, and Marvel's Avengers on Xbox Series X/S. This would've never been possible at any other company, so I am really grateful of where I am in life.
Hey great video as always!, i noticed a bug and i'm not sure if it is only working on my machine but whenever you place your character to close to the edge, like standing on the edge by only 1 pixel and resize the window, the character will fall off the edge into oblivion
Thank you Jayggz! Haha, yeah I know that that bug exists. It is a less evil version of the bug that I tried to fix at the end of the video. There are ways to solve this problem, but they mostly involve more complicated collision systems. So for now just make it so your player cannot resize the window while he/she is one pixel away from the edge.
Hi, a quick question again... How can we use 'void' functions on sfml. I tried but it doesn't know the window we have rendered. and if we render again it creates a new window
Hello! Awesome tutorial! I got this little bug where if I'm not jumping the white platforms tremble a little like they move up and down just by a bit constantly except while the penguin is in jump state and is flying - then they become static. Its annoying they are like moving up and down just by a little unless you are jumping then they are fine... If you have any idea how to fix this it would be great ! :)
That happen because the player continuously collides with the ground due to velocity_y increasing due to gravity. An easy fix is to create a variable gravity that is zero when you can jump and 981.0f when you can't.
Hi i need some help that is not really related to the video. I want to draw out an entire array of objects but the draw function wont take in an array of double pointers, what do i do?
Hey! Do you have any idea why I get the console opens but it says "Failed to deactivate shared context before sharing: The handle is invalid. Warning: The created OpenGL context does not fully meet the settings that were requested Failed to activate the window's context"? Been trying to set up SFML for a quite some time now , finally got it running but keep getting this error.
hey, I have a problem with the collision detection I think. Once my player touches the platform it starts to jitter and I can't move in any direction (I can still jump though).
Hi.. I will be very happy if you answer this one.. I made a game and I want to share it. I tried but it gave me some .dll errors. Can you help me?? (and it doesn't give errors on my PC it gives errors in other computers)
+Ömer Gök Hi! It probably means that that person does not have the correct Visual C++ Redistributable. If you google the error that it gives you it will probably tell you for which version of Visual Studio he or she has to download it. Then download and install the Visual C++ Redistributable for the correct version of visual studio from Microsoft's website. That should fix it.
I wanted to the player can easily start the game and play so he or she doesn't need to think about installing something.. But when you put the dll files into Debug it works!
If you want to be able to double jump. You should internally store an integer that increases every time you jump and your current jump count is less than 2. This integer should be set to 0 whenever the player collides with the ground.
@@HilzeVonck he ment even after the greater than and less than symbols he cant jump more then once ,after jumping once and landing he cant jump again i have the same issue
The easiest way to keep the player within a rectangular play area is by using a method called 'claming'. When you clamp something, you keep it between an upper and a lower bound. You can use this method on the players position, to keep the player in a rectangular play area. Simply clamp both the X and Y position of the player and you're set! The clamp method is defined as follows: float Clamp (float min, float max, float value) { return std::fminf(max, std::fmaxf(min, value)); } You might have to change the name of min and max if windows is included.
Can you make a video for sf::Touch you can develop sfml from mobile with cxx droid and Just 1.99 bucks for montly or Just 10.99 premium Just explain the movement
I won't make a video on this, but it is not that difficult. It works quite similar to SF mouse, except that you have multiple mouse positions, that might not all be active at the same time. You can create a super basic circular movement pad like lots of mobile games have by simply taking the distance between your desired center and the current touch point and dividing this by the desired radius of the movement pad, ensuring that the length of this delta never exceeds one. When you start you can simply loop over all fingers, if one is active, do the circle check and break. Then you could also make it more dynamic by saving the touch position when the player initiates a touch and using that as center. Then you could store the touch ID instead of looping over it all the time. Then you could create different regions and by using the initial touch position assign a touch ID to a specific region. This way you can make multiple circular movement pads. After this you can use AABB vs point and circle vs point checks to create buttons.
Hope to see more tutorials in the future. You have truly helped me out thank you !
I remember when this vid just came out, its been 3 years! please continue this!!!
I watched this video one day when I was making my first 2D game in C++. Now I'm making a 3D game engine and couldn't get collision to work. Reminded myself of this video and it helped, eventhough it's shows 2D collision =)
Thanks a lot man!
Damn dude, your tutorials are really great! I hope you continue them, you've helped me a lot!
Thank you, I am just getting started on an SFML game, but I'm using the C bindings, making following along with most tutorials tough, because they're all in C++. However, it was much easier to adapt your lessons than anyone else's c++ lessons because yours are so clear and concise. Great stuff! I hope you make more eventually!
Just wanted to thank you a lot for these videos. They are simple but yet so powerful. Thank you very much!
This guy really helped me create a 2D game but now I don't even know if this guy is alive or not. He hasn't uploaded in 4 years. Sad.
Keep it up, you're the only guy I can learn SFML from.
And with this new setup, it'll be even better.
Please come back to UA-cam!!!
Please continue this Series Hilze!
please more tutorials because you know many many things and we can all learn from you
great tutorial for the basics of sfml, everything was explained very clearly i really like it
Thank you so much for your beautiful tutorial. Please continue!
man i wanted to enter in gui, but i didnt really know anything apart from opengl and opengl has a huge learning curve, awsome tutorials, you earned a sub
Almost 4 years later, still helping people to get through IT subjects at University :DD
These tutorials have been tremendously helpful! I watched every one, some multiple times. You have improved my c++ and SFML greatly and I really hope you're doing well and one day, if you're not too busy, will once again make a tutorial :) thank you!
Excited for your Graphics Programming talk at BUas :)
Great tutorial! To these people who might have error E0461 - just set && in the Collider class - Check Collision, should work. (Collission &&other).
I think the reason for falling through the floor when moving the window is because it pauses deltaTime. When the window is released, deltaTime will be however long it was held. In the statement that applies gravity, velocity.y += 981.0f * deltaTime, if deltaTime is large enough, say 1 second, out velocity.y is equal to 981.0f. On the next frame, we move exactly that much, completely skipping through the floor before we can detect collision. It has nothing to do with how close you are to the edge. I think I solved this (At least partially) by adding a isTouchingGround boolean to player. It is initialized to false and becomes false whenever jumping. It becomes true when jumping or whenever y velocity is not 0.0f. It becomes true when colliding with the ground. Gravity is only applied if !isTouchingGround. To ensure that you can't walk off the edge and float due to isTouchingGround being set to false, you have to set velocity.y to true if isTouching ground is true. This is fine most of the time because you collide with the ground constantly, but when you walk off the edge, you'll still fall. The only issue that I couldn't fix is that if you Move with screen while in midair, the problem persist because you can build up deltaTime, so it needs some work. Your way is better right now, I just wanted to give perhaps a lead to a solution. Thank you for your tutorials!
Thanks for your SFML tutorials you've really helped me out a bunch. Cheers!
Actually you don't have to set deltaTime to anything to avoid Tux's falling down. You can also create sf::Vector2i window_position=window.getPosition(); and make a while loop:
while(window_position!=window.getPosition())
{
clock.restart();
window_position=window.getPosition();
}
And that's it, Tux'x not falling anymore and i think it's better than setting deltaTime to specific value :)
Very nice series. Too bad that the last videos were 4 years ago. Hoping for a comeback :)
Will you continue the guide?
best tutorials on youtube
please continue the series
Keep making these!! They are SO helpful!!!!
His explanations are so damn understandable
When you've been coding in c++ for almost 5 years, every single day, when it's your life.
And you sit for hours on end to fix a bug that turned out to be because of a horrible copy-paste accident.
THANK YOU SOOO MUCH!!!! This was very very helpful!
See you in the next one, im waiting
Please do some follow ups. Love your videos
I just came here for the Canadian "sorry"
Are you planning on recording any more tutorials? These have been really useful.
Where are you man :( we need you
Thanks! Keep going! Good luck!
Hi! nice video, clear and easy to understand :) just wondering will you be tackling about SAT collision detection?
I might do a tutorial about SAT in the future. But it probably won't be any time soon. I don't think that most of my subscribers are on the level that they need to be at in order to understand SAT. I do however have a video that I made for uni in which I explain the basic concept of SAT, and there are a lot of great textual tutorials available on the internet if you are really interested in this topic.
Yo Dude your tutorials are really good. Are you going to continue them ?
hey dude, great job
!!!
could you post the sourse code, please
Thanks you
Thanks!
Man, where did you go? I'm worried :(
me too man... does anybody know something about this guy?
Hey! Sorry I fell off of the face of the earth. College all of a sudden became a lot more busy since I had to build up a portfolio, then I had two internships and now I'm working full time at Nixxes Software. Life has been busy. :)
I really would like to come back to UA-cam however since I loved making this video's, so I might make a couple more video's in the next couple of months!
@@HilzeVonck oh hey! I’m glad you’re doing fine! God bless you man in whatever you’re doing!
Thank you so much!
I have honestly been having a great time working at Nixxes for the last two to three years.
In that time I have worked on four released games. Tomb Raider, Lara Croft and the Guardian of Light and Lara Croft and the Temple of Osiris on Stadia, and Marvel's Avengers on Xbox Series X/S.
This would've never been possible at any other company, so I am really grateful of where I am in life.
@@HilzeVonck damn, that’s amazing! I’m actually happy for you man! Wishing u the best
Please come back to youtube!!!!!
Please don't stop making the tutorials.
Please Back to UA-cam!!
Hey great video as always!, i noticed a bug and i'm not sure if it is only working on my machine but whenever you place your character to close to the edge, like standing on the edge by only 1 pixel and resize the window, the character will fall off the edge into oblivion
Thank you Jayggz! Haha, yeah I know that that bug exists. It is a less evil version of the bug that I tried to fix at the end of the video. There are ways to solve this problem, but they mostly involve more complicated collision systems. So for now just make it so your player cannot resize the window while he/she is one pixel away from the edge.
Nice video
can you make a tutorial about text cout on the sfml window, with font and all the rest of the pretty text thingies?
Hi, a quick question again... How can we use 'void' functions on sfml. I tried but it doesn't know the window we have rendered. and if we render again it creates a new window
Hello! Awesome tutorial! I got this little bug where if I'm not jumping the white platforms tremble a little like they move up and down just by a bit constantly except while the penguin is in jump state and is flying - then they become static. Its annoying they are like moving up and down just by a little unless you are jumping then they are fine... If you have any idea how to fix this it would be great ! :)
That happen because the player continuously collides with the ground due to velocity_y increasing due to gravity. An easy fix is to create a variable gravity that is zero when you can jump and 981.0f when you can't.
Hi i need some help that is not really related to the video.
I want to draw out an entire array of objects but the draw function wont take in an array of double pointers, what do i do?
Hey! Do you have any idea why I get the console opens but it says "Failed to deactivate shared context before sharing: The handle is invalid.
Warning: The created OpenGL context does not fully meet the settings that were requested
Failed to activate the window's context"? Been trying to set up SFML for a quite some time now , finally got it running but keep getting this error.
Error: 'bool Collider::CheckCollision(Collider &,sf::Vector2f &,float)': cannot convert argument 1 from 'Collider' to 'Collider &'
same here, have you got any issue?
Will continue? Or is there a continuation?
it looks like no
;-;
You just hit 800 subs and I'm the 800th #before1k
Come back to us!
can zou make continue
hey, I have a problem with the collision detection I think. Once my player touches the platform it starts to jitter and I can't move in any direction (I can still jump though).
Hello, have you fixed that :<
Im stucks and im desparated now
Tho my english isnt good but can you help me pls :')?
How about some more Hilze?
this tutorial help me a lot thank you. Someone can help me how to add menu page to it?
Make state machine and update only actual state in game loop
have a look at my channel. there is a complete sfml state machine app in the description of the newest video
Hi.. I will be very happy if you answer this one.. I made a game and I want to share it. I tried but it gave me some .dll errors. Can you help me?? (and it doesn't give errors on my PC it gives errors in other computers)
+Ömer Gök Hi! It probably means that that person does not have the correct Visual C++ Redistributable. If you google the error that it gives you it will probably tell you for which version of Visual Studio he or she has to download it. Then download and install the Visual C++ Redistributable for the correct version of visual studio from Microsoft's website. That should fix it.
I wanted to the player can easily start the game and play so he or she doesn't need to think about installing something.. But when you put the dll files into Debug it works!
Hello!
Do you have any plans on creating 3D SFML tutorials?
can you share please your source code? thanks in advance !
I changed the greater than and less than symbols but I still can't jump twice. please help.
If you want to be able to double jump. You should internally store an integer that increases every time you jump and your current jump count is less than 2. This integer should be set to 0 whenever the player collides with the ground.
@@HilzeVonck he ment even after the greater than and less than symbols he cant jump more then once ,after jumping once and landing he cant jump again i have the same issue
Anyone knows how can I make an invisible wall to limit create the boundaries of my game?
The easiest way to keep the player within a rectangular play area is by using a method called 'claming'. When you clamp something, you keep it between an upper and a lower bound.
You can use this method on the players position, to keep the player in a rectangular play area.
Simply clamp both the X and Y position of the player and you're set!
The clamp method is defined as follows:
float Clamp (float min, float max, float value)
{
return std::fminf(max, std::fmaxf(min, value));
}
You might have to change the name of min and max if windows is included.
Anybody knows how to make same syntax higligthing as author of this video have&
where are you mannnnnnnnnnnn
See you in the next one... Sadge
It's been 10 months, are you busy?
it's been 20 months by now
Can you make a video for sf::Touch you can develop sfml from mobile with cxx droid and Just 1.99 bucks for montly or Just 10.99 premium Just explain the movement
I won't make a video on this, but it is not that difficult. It works quite similar to SF mouse, except that you have multiple mouse positions, that might not all be active at the same time. You can create a super basic circular movement pad like lots of mobile games have by simply taking the distance between your desired center and the current touch point and dividing this by the desired radius of the movement pad, ensuring that the length of this delta never exceeds one. When you start you can simply loop over all fingers, if one is active, do the circle check and break. Then you could also make it more dynamic by saving the touch position when the player initiates a touch and using that as center. Then you could store the touch ID instead of looping over it all the time. Then you could create different regions and by using the initial touch position assign a touch ID to a specific region. This way you can make multiple circular movement pads. After this you can use AABB vs point and circle vs point checks to create buttons.
@@HilzeVonck thx
and now make it multiplayer with the sfml networking module please :P
эх
i there an option to get whole code or project? I need it to school, i started making my game too late and i am really bad at it
too low quality, can't see ..