This is an under rated teacher. The amount of knowledge i have collected just from a few hours of watching these videos is probably more than the knowledge i got from my college syllabus. Thanks.
@pavelnezamayev Жыл бұрын
This is very well explained. And the code is beautiful. I love the simplicity of C. Thanks a lot, Gustavo!
@cybergizmo6902 Жыл бұрын
Thank you. I am writing an emulator for the first time in C with SDL and this was a very useful resource!
@ulysses_grant Жыл бұрын
I'm saving money to enroll in the 3D Computer Graphics Programming course. I love your videos!
@kwameopareasiedu Жыл бұрын
I created a relatively simple game without an engine using Electron (Typescript) which ended up around 200mb. Feedback was the game consumed too much resources (I actually expected this from an Electron app running at 60fps on the Chromium browser). Ive started learning C and will port the project over to C and SDL. I think I can do way way better. Thanks for this amazing guide... ❤
@caracal38929 ай бұрын
I have followed the tutorial up to 1:14. I am using vs2022 for c++ and SDL2.30, named the main.c main.cpp and everything compiles without errors. However the screen is black. The program reacts to closing with escape. The console output reports no errors. Not entirely sure where the issue is. All functions appear to work as intended, input reacts to the correct key, the window isUsing SDL 2.30the correct size. Just that it is all black.
@abbasio11 ай бұрын
This is a fantastic video, thank you! Great introduction to lower level game programming. For anyone like me who might have had issues with the window loading initially - I'm working on Linux (Fedora 39), and when I tried to run the game at 1:07:39 it ran with no errors, but no window appeared. Apparently for some platforms, the window won't appear if you don't have anything to render - continuing with the tutorial and changing the render color made the window show up once I hit the 1:14:00 mark
@alnaif324111 ай бұрын
I'm also fedora 39 user everything worked perfectly but my window is not centered though I've written the same code. Would you please tell me whether your window was centered?
@abbasio11 ай бұрын
@@alnaif3241 My window was also not centered - but I wasn't too bothered by that, so I didn't look into it. My assumption is that there's just some difference in how the origin is calculated in SDL vs how it visually appears in Fedora, so you could probably just play around with the parameters there manually until it looks centered.
@alnaif324111 ай бұрын
@@abbasio I came to know that the window positioning doesn't work on wayland... So I used Xorg and it worked perfectly.
@demon_hunter9547 Жыл бұрын
This was a rather nice introduction to SDL, thanks for making this !!!!!
@ianmakesmashups28 күн бұрын
Anyone on the M1 mac, I had to add -I/opt/homebrew/include -L/opt/homebrew/lib to my compile flags to get SDL2 to work. Thanks for the tutorial!
@dhoncrisley7 ай бұрын
O sotaque não nega, esse cara é BR
@pikuma7 ай бұрын
Óbvio! 😅
@heliofilho65662 ай бұрын
Seus cursos tem legenda BR ?
@alpha001 Жыл бұрын
Pretty well explained tutorial, Keep going! Helped me a lot to solve some problems i've been having during my journey on learning about SDL-based game dev :)
@ChrisMabryTV Жыл бұрын
Fantastic video. You are a great teacher - I look forward to doing your 2d game engine course soon!
@SirenSeph4 ай бұрын
truly the best sdl explanation i have seen clear and concise thx very much!
@gordonmccrary6279 Жыл бұрын
this is one of the best channels on youtube for gamedev. thanks for your content!
@luscapolo Жыл бұрын
Amazing video! Thanks for sharing your knowledge here. I learned about capping and delta time in the past but the concepts never consolidated in my mind, now I really understand. Thanks again.
@hapboyman9 ай бұрын
Many thanks, Gustavo. I studied a lot from this very brief explanation.
@rodrick2312 Жыл бұрын
The best explanation so far, thanks for this content!
@shaikantest7646Ай бұрын
I've come here for pure theory on game loop (since i had generaly understaning, but still had missing a few things), and gladly i've got what i came here for. Thanks for the video. If anyone interested in pure theory - you may skip example-game related sections and jump directly to sections "Capping our framerate" and "Using SDL_Delay". While sdl is a thirdparty you probably wont use, the theory behind it is explained quite good. "delta time" is also nice part, just not that relevant to me.
@BryanChance Жыл бұрын
What a great class! Great explanation of important points in game development concepts.
@oytun30748 ай бұрын
this has helped me a LOT thanks for the lecture!
@jasonboyd782 Жыл бұрын
Hi Gustavo. I appreciate all your content and your book on graphics programming is great. I took a couple days to figure out, earlier this year, how to get SDL running on my Macbook. Contrary to what you say in this video, gcc/clang was not pre-installed, I had to install Xcode and do xcode-select install to get "command line tools" including clang. Beyond that, I installed homebrew and SDL (homebrew is also not pre-installed), and it took a while to figure out how to get a project in Visual Studio Code to know where the SDL headers and library files were. Finally, because VSCode for some reason was very buggy when trying to run my code in the debugger -- it would typically take a few minutes to start up and another few minutes to respond to each step over, I switched to XCode, where selecting the include and library files was another hurdle. I don't know why such things are not well documented somewhere (like SDL's site). It would be good if you could include such things. It was nowhere near as simple as one line of using homebrew to install. I'm also curious as I'm learning C and C++, why do we need both .lib files and .dll files on Windows, and what are the equivalent on OSX and Linux? I'm wondering how one bundles up their application for distribution. My understanding is for Windows you would just need to include the .dll file(s) alongside your app? But I'm not sure for Mac and Linux. Any help is welcome.
@pikuma Жыл бұрын
I think I recorded that from what I did on my old Intel-based MacBook. I recently tried an M2 MacBook Pro and I had to install the Xcode command-line tools, yes! Also, with SDL now the easiest way of setting the compiler and linker flags is by using: `sdl2-config --libs --cflags` in your gcc/clang build command. Windows .DLLs are usually .SO (shared objects) files on Linux. This is actually a pretty big thing and I'd rather leave a link here to explain it: stackoverflow.com/questions/9688200/difference-between-shared-objects-so-static-libraries-a-and-dlls-so Even if we don't manually copy the .DLLs on Linux or MacOS, the correct equivalent .so and .dylib files are there in the OS and were installed by the apt or brew package manager.
@s1lkysl1m8310 ай бұрын
the documentation included with the SDL download from the site has all of the installation and configuration information included
@Exotic694206 ай бұрын
Haven't touched C before. Only some bare C++. I loved this eitheray and learned a lot.
@jayaganthan1 Жыл бұрын
Great explanation! Thanks for making this video.
@dhruvasambhoo34964 ай бұрын
Thanks a lot, you saved me a lot of time and effort!, GREAT EXPLANATION!, and so far the best video that really helped me on this topic!
@AnkitSinghKushwah10 ай бұрын
Thanks Gustavo. You are always so helpful man
@maxraj428011 ай бұрын
Really nice tutorial it almost made me cry that his channel only has 14k subs :(
@paulooliveiracastro Жыл бұрын
I wouldn't agree with the argument used when picking 24fps. We certainly can perceive less fps as smooth movement (Zelda ran at 20fps on n64). And we can certainly perceive high fps (just see how many people complain when their games are running under 30fps on newer consoles)
@pikuma Жыл бұрын
Oh, I agree! What I meant to say is that ~24 fps (used by films) is about the lowest FPS that the human eye can perceive as animation (instead of frame by frame images). I remember playing Daytona USA back in the day, and the high FPS value was clearly visible! It was different than previous ~30 FPS games we were used to play.
@paulooliveiracastro Жыл бұрын
@@pikuma what I mean is that even lower FPS can be perceived as animation. The game "The Legend of Zelda: Ocarina of Time" on the Nintendo 64 (and many other games on that platform) ran at just 20fps. Was it great? No way! 30 fps is actually much much smoother. But we still perceive that as animation and not as a series of photos.
@pikuma Жыл бұрын
Yeah. I guess you're right. There were games in the past that ran even lower FPS numbers than that and they were still fun. Maybe the 24 FPS is mostly a soft value for the claim. Here's what HP said about it. www.hp.com/us-en/shop/tech-takes/what-is-frame-rate#:~:text=At%20a%20minimum%2C%2024%20fps,and%20viewing%20experience%20will%20be. It's not an academic journal, but I've seen the number 24 more than once in this claim. Still, not really something to sweat too much over.
@David_Raab3 ай бұрын
@@paulooliveiracastro I guess we can even perceive 1 fps as an animation, as long there is not much change between the frames.
@jyuart Жыл бұрын
Just what I needed. Thank you very much
@amund88219 ай бұрын
Wanted to switch from using pygame and I know pygame uses SDL so I decided to try this out. Have to say I like this way of doing this a lot better.
@Traiden_2 ай бұрын
I love this, but I also love whatever clicky keybaord you are using. What is it? I have to know! Keep up the good work.
@eugenevladoff27588 ай бұрын
This will now be my favorite video. And of course, I subscribed and liked)
@peterjansen48265 ай бұрын
On Arch anyone who has a general gaming-setup has SDL2 too (used by many games) and the name of the package is sdl2 so people can figure that out. :)
@simardeepsinghmudhar70657 ай бұрын
Fantastic Tutorial
@shaikshakur11 ай бұрын
Best coding video ever
@heyheyheyhoev419 Жыл бұрын
20:01 Maybe it's stupid question, but is there any way to skip the all "VC++ Directories" and etc. stuff in VStudio in interface? It's too confusing even if you have done this many times, it's always difficult to manage right parameters without errors. Only way I remember is to generate project files with CMake(GUI for example)
@PolarisMyWay Жыл бұрын
Well done! Thank you!
@happygofishing Жыл бұрын
Amazing video, I've always found game engines to be too high level, I keep loosing motivation to learn godot/unity etc, I want to see the raw functions, the render loop, whats really going on etc.
@ductive8 ай бұрын
Great lecture, thanks
@DougLopes Жыл бұрын
Além da ótima didática, é exatamente o que eu tava procurando GameDev em C puro, porque escrever código sem orientação a objetos é bem difícil de entender depois de estar acostumado.
@pikuma Жыл бұрын
That's great to hear. Gustavo usually uses C in his lectures.
@mecaniac96055 ай бұрын
cara como eu gostaria de que vc fosse meu professor, estou fazendo um curso seu de assembly de atari 2600 e achei este video por acaso, mt obg por disponibilizar esse material ❤!! dica: se puder ponha legendas em pt-br em alguns cursos da udemy issuo ajudaria mt a acelerar alguns topicos (a pesar do seu ingles ser otimo e mt compreensivel)
@dishtroyer14211 ай бұрын
1:32:57 best part of the video
@fabianrr Жыл бұрын
Que bueno que lo subiste aca 👏
@specialx9856 Жыл бұрын
Very helpful, thanks for the video👏.
@brecoldyls Жыл бұрын
Thank you for the video. I have a question. At 1:45:55, why do we need the right hand side of the logical and expression in the if statement condition? Won't time_to_wait always be less than or equal to FRAME_TARGET_TIME? Or is this to handle integer underflow?
@FxWitch11 ай бұрын
Did you figured out the answer? I think he added that to only sleep if the game updates slightly faster than the target frame just to sync with fps. Idk.
@a.v79988 ай бұрын
Damm! this was awesome! learned soo much from this video! look forward to follow along ;)
@weitnow Жыл бұрын
Great video😊
@costelinha1867 Жыл бұрын
Você é Brasileiro, Gustavo? Por que se sim, primeiramente, seu Ingles é MUITO BOM! E segundo, acho que esse é o primeiro tutorial de desenvolvimento de jogos em C que eu já vi que n foi postado a mais de 3000 séculos atrás. O que é bom, já que eu tive que usar C num curso que eu fiz alguns meses atrás, mas desde então n consegui achar nenhum motivo pra usar essa linguagem em expecifico. (O que é uma pena, já que eu até que gostava de usar C no curso.)
@pikuma Жыл бұрын
Hi. Yes, Gustavo is Brazilian. 🙂
@zrIywcN8XJdHaY13K3tx11 ай бұрын
Notei o sotaque dele de br também
@joaobarreto367110 ай бұрын
@@pikuma Wow that's so nice to hear! knowing we have someone with so much knowledge out there to represent us, is a big motivation to the studies
@GameDevBoss5 ай бұрын
Gustavo eu tb volto a esse video de tempos em tempos. Hoje eu desenvolvo em SDL por influência sua
@spowrei Жыл бұрын
great video it really helped me
@detroit198810 ай бұрын
Thanks for your tutorial. I get a fluid game (at 60 hz) like love2d when I put SDL_RENDERER_PRESENTVSYNC option (see my fork of your Github project). In this way it is like love2d : automatically sync. I have notices the SDL 3 wich is an improvement with for example stream sound.
@viylouu Жыл бұрын
i still get the linker issue after adding the linker stuff in im at 24:29
@James-l5s7k5 ай бұрын
Hurray! C rules!
@idc2120 Жыл бұрын
I've often seen that substepping is used along with delta time, as a solution to get around some issues where the processing time between frames is large. For example, moving a object with delta time during a lag spike could cause the object to pass through collision that is smaller than the position delta. There are ways around this particular issue such as ray casting, but I just wanted to ask about how this substepping might be introduced in your example.
@chill887310 ай бұрын
Very good video!
@mesmodev9 ай бұрын
Hey Gustavo! Loved this course (I saw it back on Udemy)! Could you please tell me how do you record your terminal? I want to achieve a similar style in my videos. Do you record with OBS?
@gameprogramming6550 Жыл бұрын
Great Content. Love it
@DogeOfWar6 ай бұрын
Why is it not considered redundant effort by WIndows MSVC projects to have to manually add the lib to BOTH the library directories AND the linker? what is the reason for it not being able to deduce the linkage based on the included libs?
@adamhafchadi49247 ай бұрын
greate video greate explnation! how can i avoid using all the global var that you have used? usally global var are bed practice , myby bulding a struct?
@radshahmaddaiyan16339 ай бұрын
why after running "The application was unable to start correctly " is showing?
@nelbr11 ай бұрын
Loved your video. Just subscribed and will definitely check you book. Thanks for sharing.
@alnaif324111 ай бұрын
I'm on Fedora 39, the problem is my window is not centered though I've written the same code. Will anyone please help me?
@mactheknifeguinness Жыл бұрын
Great series. Do you have a book?
@pikuma Жыл бұрын
No, unfortunately no. Only lectures. 😶
@mactheknifeguinness Жыл бұрын
@@pikuma well its great to find you. I have a great interest in the didactics of mathematics and gameification and programming. I am also in the uk. I might get the 3D course seems like right what i have been looking for. So far your videos are perfect and the direction of this channel excellent.
@pikuma Жыл бұрын
@@mactheknifeguinness Great to meet you. Let me know if you need any help or want to discuss ideas. 🙂
@mactheknifeguinness Жыл бұрын
@@pikuma very nice to meet you too. I look forward to everything.
@Metrix20248 ай бұрын
I was trying to find the doc to see what each function do and the arguments they take but I am just the ask 1.2 versions docs and the only other thing I saw is how to migrate from 1.2 to 2
@HypesReactive Жыл бұрын
great video!
@owdoogames Жыл бұрын
This is great, thank you Gustavo. But I'm just wondering why you went with C++ with SDL for your 2D game engine course instead of C? I'm a hobbyist wanting to get 'back to basics' after 4 years of jumping from game engine to game engine and not feeling satisfied, but I've found C++ too complex when I've looked at it in the past. I've been learning C and really appreciate and enjoy its simplicity.
@eugenevladoff27587 ай бұрын
Hello, Gustavo! Is it possible in SDL2 to find out when the SDL_RendererPresent() function finished working if the SDL_RENDERER_PRESENTVSYNC flag is turned on? Then I could start a new rendering of the back buffer. And I could accurately calculate FPS.
@eugenevladoff27587 ай бұрын
I tried to measure the FPS and it turned out that in this case no delays are needed. It looks like the render itself adds delays of up to 60 fps. The CPU load is minimal.
@erzei Жыл бұрын
just for anyone having the "error LNK2019: unresolved external symbol SDL_Init referenced in function main", instead of using x86 on the linker I used the x64 libs and the code works as shown on the video
@adampassaretti9149 Жыл бұрын
Great video, can i ask you how to use the process monitor you used?
@pikuma Жыл бұрын
Hi there. Gustavo used "htop" for that particular example.
@minhan4444 Жыл бұрын
Can you give me name of C font in video, please ?
@pikuma Жыл бұрын
Code Page 437
@minhan4444 Жыл бұрын
@@pikuma thanks :3
@David_Raab3 ай бұрын
It's not quite right that the fps doesn't matter as long we use some kind of deltaTime. I run into this problem lately where i didn't activated frame-cap and the game run over 12000 fps. I started and just let some ball bounce and it was somehow wrong. Activating a frame-cap made it right. The problem is simply that running at extremely high fps can lead to extremly small floating point values and floating-point arithmetic starts to break. I guess it is important because not restricting frames and starting with a new project where you literally do nothing will always yield extremely high fps.
@tempyreuz94698 ай бұрын
Hey Gustavo, I was just wondering if you're currently working on any new courses or videos? Your twitter page seems to have been deleted.
@pikuma8 ай бұрын
We are the handle @pikuma on Twitter. And yes, full-force working on a new course.
@thomasnguyen11509 ай бұрын
What’s the font you use?
@nskeip Жыл бұрын
I got a question about "unlimited" FPS. What happens if we have a very-very small delta time, such that multiplying a "x-speed" of a ball by its value we get something close to 0? Seems like it would be converted to int value (as we can not have 0.01 px), and it will be 0. Does it mean that on a very fast computer the ball will not move at all? UPDATE: just realized that the GameObject's x and y are floats
@FxWitch11 ай бұрын
But then those float will be typecasted to int for rect, so still 0? how?
@hozunon Жыл бұрын
Was this previously not uploaded? Just having a deja vu moment that I've seen it before.. Unless its on the site
@pikuma Жыл бұрын
Good eye. I'm in the process of removing all the free courses from our website to improve the quality of people enrolling. This was an old lecture that was free on the school website that is now being uploaded to KZbin. 🙂
@hozunon Жыл бұрын
@@pikuma Sounds like a valid and reasonable plan!
@SABaruj Жыл бұрын
currently there are like 15 versions of SDL on windows and i dont know wich one to install, im asking everywhere and i dont know, i just need one that works and thats it, my system is 64 bits windows 10 but im aiming to do a game that can be launched even on 32 bits machines.
@pikuma Жыл бұрын
If you're using Visual Studio, what you want is the dowload option that contains "devel-VC" in its name. This one comes with the development files (header files, .libs, .dlls) that work well with Visual Studio. Visit the SDL homepage, click the "Releases" link, and scroll down to find the "devel-VC" one. Here's a direct link to the page: github.com/libsdl-org/SDL/releases/tag/release-2.28.4
@pikuma Жыл бұрын
This file also contains two folders, one with the library files for x86, and another folder for x64.
@SABaruj Жыл бұрын
@@pikuma thanks, its on the "lib" folder, i will keep going with my proyect.
@2dapoint424 Жыл бұрын
Can you do a game tutorial using Raylib?
@pikuma Жыл бұрын
I'll probably focus my efforts on new courses at the school first, but I'll see if I can squeeze something small using Raylib here on KZbin in the future. 👍
@2dapoint424 Жыл бұрын
@@pikuma thank you :)
@grenadier4702 Жыл бұрын
What font do you use?
@pikuma Жыл бұрын
Code page 437
@tullman3craggs1026 ай бұрын
feel when now its github download link, and theres no lib folder
@jamessouza6927 Жыл бұрын
👏👏👏👏👏👏👏👏👏👏👏👏
@hobbit1256 ай бұрын
Creating a Game Loop in an extremely old version of C & SDL.
@RegenerationOfficial Жыл бұрын
Explains what he doesn't want to do like foreshadowing
@LauraCraig-b7zАй бұрын
Claudia Hollow
@tsukamigames Жыл бұрын
tu é br né?
@pikuma Жыл бұрын
Sim.
@patrickjaeger97144 ай бұрын
why is main() returning FALSE?
@pikuma4 ай бұрын
GOod question. So, a C executable might be called by the operating system or other application, and some of these applications or OS would expect a return from your C program. This return is basically an "error code". In our case, since everything ran perfectly and there were no errors, our return error is 0. If there was some issues mid-program, we might also return something else. But in this simple example, return 0 at the end is enough. Some modern versions of the C language also allow programmers to return the constant EXIT_SUCCESS, which is exactly the same as return 0.
@designordu1596 ай бұрын
install on linux: quite easy. install on mac: hmmm! easy too install on windows: incantations n magic spells, windows need true love kiss to work
@rexoverwatch Жыл бұрын
i need a very simple 15v15 first person shooter game made for me, do you know of any programmers willing to take on small projects? thank you
@clintonreisig9 ай бұрын
What is wrong with the sound?
@pikuma9 ай бұрын
Probably the old mic I had when I started to record these videos years ago. Hopefully the newer videos are a bit better.
@FrankBudino4 ай бұрын
bro yappin
@pikuma4 ай бұрын
I was not aware of what that meant in English. "Yapping" means to talk a lot in a very annoying way." I guess it all checks out. 😅
@FrankBudino4 ай бұрын
@@pikuma It's kind of a zoomer phrase nowdays, just a joke. Appreciate the SDL2 tutorial very much, as there are virtually no pure C tutorials around and most use C++. It is much easier to build a 2D engine using just C.
@StellarHarbor15 күн бұрын
I wish there was more C content, you finish C programming playlist by watching and writing useless stuff and don't know anything about development after that and if you're that unlucky one who wants to make games and not high speed quantum calculators or whatever, you literally have no content...
@Oaifee Жыл бұрын
Você é Brasileiro não é?
@pikuma Жыл бұрын
Sim. 🙂🇧🇷
@jvega1793 Жыл бұрын
Promo>SM 👉
@pikuma Жыл бұрын
Sorry, I don't understand what that means. 😔
@ShaunPrince2 ай бұрын
No, gcc does not use clang "under the hood". gcc uses IR, were Clang uses LLVM IR. not reason to invent facts to sound cool... when you clearly are not.
@pikuma2 ай бұрын
@@ShaunPrince I am most definitely not "cool." But I believe you are confused about what I meant by "gcc executes clang" in the video. What I meant is that on macOS, the /usr/bin/gcc file points to clang. Even though both Linux and macOS users can type the same "gcc" command in the shell it's useful to let them know that they are *not* really invoking the GCC compiler if they are on macOS.
@ShaunPrince2 ай бұрын
@@pikuma interesting to know, as I tested in Ubuntu and got upset very quickly and made an emotional comment. In my culture, only rich people use MacOS, so I made an assumption, and I was wrong.
@pikuma2 ай бұрын
@@ShaunPrince I was also really confused when I saw that the first time. But really, Apple decided to include a file called gcc that simply calls the clang compiler behind the curtains. It tricks some students but at the end of the day I can *theoretically* just use one build command when teaching and it will still work for everyone. 😬
@kalekold Жыл бұрын
Jesus, use a proper font!
@pikuma Жыл бұрын
Sorry, I don't understand what that means.
@kalekold Жыл бұрын
@@pikuma That doesn't surprise me.
@paulooliveiracastro Жыл бұрын
Wtf? This font is great. Please keep that
@c3vette47 Жыл бұрын
my makefile build command gives me 'build' is up to date. It doesn't build. Yet if I enter gcc -Wall -std=c99 ./src/*.c -o game directly in the terminal I get a build. I can then make run and make clean and the Makefile executes as it should. Can you help me out please?
@ianmakesmashups28 күн бұрын
you may have to add the *.c files as dependencies in the makefile recipe
@TheBitProgress Жыл бұрын
You can use... #linux timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = ms * 1000; select_(0,NULL,NULL,NULL,@timeout); #windows WaitForSingleObject(event_, ms); ...instead of delay. I think you will get higher precision.