@@cherryberry1345 this was probably a privated video 9 hours ago, he commented, and 9 hours later (aka now) he unprivated the video to be released to the public
Dude you're gonna have to teach me how you always get memory leaks in your games! I've always wanted to implement memory leaks but don't know where to start :(
There's also that innocent look... It wouldn't look out of place on the SNES with those shades of green and 2D shapes. You could build a golf level that looks like a Super Mario World screen. Inside a program that leaks more RAM than the SNES ever had - in a single frame.
Memory leaks could be a really good theme for a game. Just finish the game before the game crashes, or worst your computer crashes. At the end the score can be calculated based on the total amount of memory leaked throughout the game. The least the better.
4:34 Maybe it would be nicer if you store level configuration in a JSON file then deserialize them on the fly using libraries such as nlohmann/json or similar. Then you don't need to painstakingly hardcode every level. And by using external data it would be easier to expand your game
I havent looked at the code, but seeing it from just this, most likely you are passing a texture by value instead of a reference, this makes your game building duplicates and pushing the memory pretty quick. Been there ;)
@@celmaibunsamper4283 At this point (ha!) I hate them even more than I did when I posted that, I've had to do a lot of pointer arithmetic and binary operations recently
The actual friction law would have the friction to be proportional to the velocity (maybe plus a little constant to lower the final tail of the movement). I think that way the movement would look more realistic
But IRL the golf ball will do some bouncing at higher speeds, meaning it has no ground contact at those times and thus will have less friction than a slower moving ball. Plus, you'd actually be simulating a particle moving through a fluid of a certain viscosity rather than simulating a ball rolling on a rough surface.
@@silience4095 Well, not really. Friction in a fluid is directly proportional to the speed, when v is small, or to the square of the speed, when v is big. Look up, for example, Stokes equation for a sphere moving into a fluid.
@@fuji_films That is aerodynamic/hydrodynamic drag. Also, there's pressure drag, friction drag, wave drag, and induced drag. You're talking about the total, which is only partly due to friction. So, no, I wouldn't say that friction can be used interchangeably with drag. They don't mean the same thing. In the comment thread, we are talking about the classic friction. Static, rolling, and sliding. None of those 3 depend on speed.
If you are interested in getting into gamedev, you will be using the Pythagoras theorem all the time, and try to understand the atan2(x, y) function, it's really important. I recommend you getting into interesting pre-calculus stuff, mainly trigonometry, it's used a ton in everything. For example sin(angle) returns a 'y' position and cos(angle) returns a 'x' position of a circle, that's something that usually high schools don't teach, but it's very important. The movements of the ball of this game are for sure using sin(angle vs mouse) for 'y' velocity and cos(angle vs mouse) for 'x' velocity. If you graph it you will see that if you draw a line for each position in the circumference starting from the middle, the length will be the same, which in linear algebra is called magnitude, this means that the force that it is applying is the same for each direction. Hope you find it interesting, good luck.
Great video! I really need to read into memory leaks more, and discover how not to do them, as I've just started doing more C++! The game looks pretty fun and cute though! :D
I ran valgrind on the resulting binary. The only memory leaks were in the Intel DRI graphics driver on my system. There were uninitialized variables for SDL funtions called which should be initialized in anything that would be released. But, this is a quick game example. I did find that the strokes counter should have used std::str.append() instead of +. Also, I wouldn't want to make it too easy, but if the mouse is moved outside of the window area (or screen if you use SDL_WINDOW_FULLSCREEN) it stops increasing the stroke power. I might accomplish that via keyboard or fix this.
Fantastic spin on the theme! It's unfortunate about the memory leak because it looks great. Also you're so close to 100k subs! You'll get there soon :D
i can see it in a near future "so, i use java to avoid memory leaks since the garbage collector should take care of that for me but i still got memory leak" just kidding tho, great job making it, will try it for sure
Here's a tip: Use a debug flag with the compilation command and then use a program like valgrind to analyse the executable. This'll help you track down memory leaks
Would've been chadly if you simply said the memory leaks were a feature and not a bug. Also you make great content. I've learned a lot about game development and art design from you. Your games always look really nice and have a really consistent style.
When used improperly old things like c and even c++ can cause issues, be slow, break systems, and be very insecure… But when harnessed correctly C is one of the fastest most efficient and powerful programming languages you can write
Then learn to make a game without a game engine Right now i am making my own simple engine with plain C and OpenGL with the GLFW library I have learned so many things because of the decision to not use a game engine
@@OGA-b4l Hello, im kinda new to programming. If i want to make my own game, should i first study using game engine such as unity or not using game engine like SDL with c++? Thank you
@@michaelsanjaya2553 well if you want to make a game you should use a game engine But if you want to learn how to program and maybe get a job later, learning how to make a game engine (or how to make a game with a library) will teach you so many things about programming in general If you use a game engine you will learn how to program in that game engine but most of your skills will be useless ouside of that engine If you make your own game engine or use a library like for example: SFML, Allegro or SDL you learn how to reder object and make your own systems TL;DR: if you want to make a game, use a game engine like unity or godot BUT if you want to learn how to program, making your own engine or using a library will teach you so much and will maybe be able to get you a job. Have a great day and tell me what you are gonna do
@@OGA-b4l Thank you very much for the detailed explanation! I think im going to do the 2nd option that is make my own game engine because i love to code. Is there any recommendation for the library in c++ or just start learning SDL like in the video??
@@michaelsanjaya2553 you said you were new to programming, then i would go with SFML. There are a lot of tutorial here on youtube and it is a lot easier then SDL.
Omg I started laughing so hard when you said it didn’t work because of memory LEAKS LOL THAT WAS SO UNEXPECTED WHY DID THAT HAPPEN?!? I THOUGHT IT WAS GOING SO WELL LMAO
@@PolyMars this applies for a lot of things in programming, but generally resource loading/initializing is very intensive, and you should do it just once somewhere in a constructor or something like that
its so funny last time i watched this vid i knew nothing about game dev and now somehow im using SDL2 to make a game and now i can relate to everything in this vid lol
Yay, a new PolyMars video! Maybe I guess this night could get better after all! Also, you're so close to 100k, Glad you've gone so far! edit: yay poly got 100k :>>>>>>
Next challenge: Learn to integrate LUA(or other scripting language) interpreter with any engine, then learn this scripting language and use it as main game logic code.
Game engines are nice, but coding it yourself is much better and you have no legal strings attached to anyone else. I personally love C and SDL2 for coding (not C++, sorry). Never had a memory leak. I usually watch for that as I code. When I write any code that allocates memory, I immediately write code to free it up.
I highly recommend using visual studio instead since it shows the amount of memory being used by the application, or just have task manager running when you run the program
You definitely need to learn Makefiles. Have you watched anything by Jacob Sorber? He's got several videos on how to write Makefiles and they're quite easy to do.
I liked it because you didn’t used any engine, just some c++libs! That’s cool! I’ll check your channel for more content like this, it’s my first time here
Me: *trying to find how to something in my program* Also me: I don't find how to do what I want to do! I will do that later. Again me: Wait I found the anwser of my problem in the video!
Actually SDL2 is godly, but the only problem I see is memory leak and incorrect/invalid optimization, For any gamejam i spend more than half of my time fixing little bugs and leaks than actually implementing stuff! Kudos to you tho, the game looks really cool :DDD