if you are having trouble with the DLL file you could modify your CMakeLists.txt like so: cmake_minimum_required(VERSION 3.27) project(your_project_name C) set(CMAKE_C_STANDARD 11) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules) set(SDL2_PATH "your path to sdl2") find_package(SDL2 REQUIRED) include_directories(${SDL2_INCLUDE_DIR}) add_executable(your_project_name main.c) target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARY}) if (WIN32) add_custom_command(TARGET your_project_name POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_PATH}/bin/SDL2.dll" "$<TARGET_FILE_DIR:your_project_name>" ) endif() that makes CLion check for SDL2.dll instead of SDL2d.dll which is the dll for debug mode (if i understood clearly)
no real "reason" really other then just getting this idea out there. Functions and logic definitely should be broken out into their own modules. Trying to plan out a "part 2" here which would include that
I'm looking for an experienced SQL developer. For a paid job porting DX7 to SDL3 pure API without OpenGL. And who can also do some UI reconstruction to be more mobile friendly and stop being static. @Erik Yuzwa arent this a job for you ?
Thanks for a great tutorial. This is really heartwarming for an old Ultima fan like me... BTW. If somebody else is using CMake template by raysan, remember to use ASSETS_PATH macro in front of the filename to load the texture correctly.
SDL3 is gonna come with a powerful GPU API. I think a tutorial series on a old-school C++ 3D game engine would be very useful. Especially if it reaches some sort of conclusion and not end after a few episodes. It doesn't have to be very powerful and fully-featured, something for games like quake 1, doom 1, counter-strike 1.6, unreal tournament 1. I hope somebody makes a tutorial on this - maybe you since you've already written a book about it before. There are some game engine series that are good but they span in the hundreds of videos or are unfinished. I think using a few libraries can help speed up things (sdl3 for windowing, graphics and audio; glm for math; imgui for engine UI or whatever else needed) and show a complete project suitable for beginners. There are enough videos in the category of "Make a game with { pygame, SFML, etc } framework", especially for 2D games. I want a proper 3D engine one.
interesting that I'm coming across this now. I've been looking more into raycasting and stuff. It's really a great suggestion. So sorry for taking so long to respond, but I appreciate the long feedback.
@@ErikYuzwa There are already enough good raycasting and doom-like game engine youtube tutorials. I was thinking of something more similar to quake-like engine.
Great tutorial , thank you for the guidance and how can one not mention about the BG music, I felt like coding along in some GOT northern Ireland winters , Amazing !
The callback-based program flow is significant because it enables web-based deployment of your C-based SDL3-based game. That in turn is useful for game jams or sharing with friends.
Hi. I'm a complete beginner learning C, about to learn pointers and memory management. I want to eventually make simple games using sdl2, but now I've learnt of the existence of sdl3. Considering the amount of time each has been in use (SDL2 and SDL3) and the tutorials on these written strictly in C, should I learn sdl2 or sdl3?
welcome friend! It's a great question - please forgive me but it's not a straight forward answer. I think that SDL2 is stable and will be around for a long time (SDL1 is still available for example). You will not "lose" anything if you learn and continue with SDL2, plus because it has been available a lot longer, there are more resources, guides and tutorials for SDL2. SDL3 is still really cooking, so it's going to take a while for videos to be made, and guides written, etc.
Your algorithm for counting tiles seems to give incorrect numbers around the outer edges because it tries to reach index 12 of the array when we only have 0 to 11. You can see it here: 28:13 and 29:07. We need to do a check with IsTileIndexValid before we count the number of mines. Something simple like: if(IsTileIndexValid(col + colOffset, row + rowOffset)) { if(grid[col + colOffset][row + rowOffset].isMine) { count++; } }
finding the location of a tile by a index is as simple as int spritesheet_col = sprite_index % total_sprites_in_row; int spritesheet_row = (int)sprite_index / total_sprites_in_row; there is tons left but it is a reasonable-ish start for series The only thing I really don't like is how you conceptualize triggers doing it by x,y cripples your game design to hard coded locations. Instead use a trigger struct... something like when you move test if a tile has a trigger and act accordingly struct { trigger_type // ie combat, teleport, interact object_id // whatever object id be it a mob or different level etc } I only bring this up as you said it is a comprehensive guide
fair points! And yes, it's definitely not an ideal approach to hardcoding locations. Definitely something I'm planning to return to. I like that idea of a trigger. Helps with maybe layering triggers when necessary. What I am trying to avoid is falling into an "engine trap". So at times there may be decisions that reflect that. Thank you so much for the input though, I appreciate it!
great question! It *might* be a hold-over from SDL1 and SDL2 days, but it 's a common practice used to avoid situations on some machines where other CPU threads were being starved because the game loop would monopolize it. As I said...it was a thing for previous versions, but thanks for reminding me to see if SDL3 still needs it. Hope that helps!
Sorry! Yeah I always struggle trying to find a balance between readability and workability for videos. Others that I come across on YT are WAY too small for me even if I fullscreen or whatever. Apologies, but I'll try to find a better size..
Followed this exactly, getting "The code execution cannot proceed because SDL2.dll was not found." I have the SDL2 file in C:/clibs/SDL2-2.30.3/x86_64-w64-mingw32 but no luck. Everything else is 1:1 what you have in your video.
The create renderer function changed and you can use something like the following now. The migration notes showed that the accelerated flag is removed since all renderers are accelerated. SDL_RendererFlags RendererFlags = 0; renderer = SDL_CreateRenderer(window, "Window!", RendererFlags);
Varmeste løvebror, thank you for saving me. It has been the most informative video I have watched. <3 You are WAY better than my professor at DTU Denmark Lyngby, course number 02322
Great video, subscribed!!! Question: Do I have to do the same setup for ALL future project, where I want to use SDL2, then? (except of course for the downloading steps)
This is what I am excited about "SDL3 Introduces A Vulkan Renderer" I was considering going with SFML as I am already familiar with it, but learned SDL3 was coming out and had a look at some of the things they were bringing to the table and was like, hell yeah! I am in. Do you plan on doing a full tutorial series? Most of the SDL tutorials on RU-vid are quite old and are not the best, so could be good to get up some before the influx of new tech videos pop up for SDL3. Anyway, I really enjoyed the vid and just discovered this channel today.
thank you so much! Yeah - I'd like to get some more SDL3 projects and content recorded for sure. I'm still very new to working with shaders, so that's one area I'm excited to explore within SDL3.
@@ErikYuzwa If you found the time to make some vids, that would be awesome for sure. I did not end up learning shaders in university, but heard it can require a bunch of math and be quite confusing to some. If you are excited about something in my experience that will take you so much further than something you are not excited about, so I reckon just go for it if that is what you want to do. :)
@@cameronbelcher4065 I 100% agree my friend. Yes, I felt the same exact way when shaders first came on the scene with HLSL and GLSL. The whole development process felt so awkward to me, when all I wanted to draw was a few textured quads. I am doubly excited too dig more into the shader approach of SDL3 to see how that's come along...
Excellent question! There's quite a few areas that are new within SDL3. Maybe I should record a short video going over some of the differences between them...
Great tutorial, im following along using C++ since I want to use some of its features even if most of the code is actually C. I've done a few changes to your implementation, mostly about some data structures I thought would be more convenient. to use (like I have a Vector2i to store integer vectors). Right now Im working on the zone transitions, my approach was a bti different form yous, because I didnt want to follow your tutorial strictly. I will share my code later when im done.
please do! yeah -- I'm not entirely "happy" with how I'm handling zones. That kind of data might be neater tucked into a pure virtual type of collection...
@@ErikYuzwaI just used a string flag for different zones, of course, it would be cumbersome if I had say, 15 different zones with different state, but but something this small and simple, it will do. maybe when im finished I can think of a more robust solution.
Wowowow. I bought your book on game programming a long time ago when I was beginning to learn. This was so unexpected; it's like meeting a school teacher after a long time. Happy to see you! Unreal.
hehe thanks - I really appreciate that. I'm still trying to buy the rights back from the publisher, but I think I'd rather sit down and create some new small e-books instead. Welcome! I hope you're still learning something!
@@Antagon666 lol - shhhh. But yeah I know. Must've been very tough to determine what features go into SDL3 and what to enhance within SDL2 (beyond something like shaders for example)
I've been grinding a lot of C++ code making game(s) and other, but CONSOLE app only which is obviously useless for an end-USer. People seem to get scared away when they see CONSOLE via. my shares on YT or FB. I would guess that people are obviously more interested in an App for which is a GUI-interface . For a card game, I've tried SFML, didn't care for it too much. It's ok I guess. Thinking, that I need to re-write and take my code to smart-phones, I literally just self-taught myself C# which is fine, I guess. Now, I have been using the Windows Forms App (.NET framework) thinking this is what I have to do to make a GUI app. I feel better and more advanced at writing C++ code, but not finding any good software to take my backend code to frontend. I am fine writing code in C# to add. To make a long story short, I just need a better way to take my code, and make it real so others can use it.
very carefully *grin* - it is essentially the same way, but you've got to setup paths to TTF and Mixer. I'm wondering if it's going to be a lot easier when SDL3 comes along...I'll keep an eye on that.