Handmade Hero»Forums»Code
Mikael Johansson
99 posts / 1 project
To SDL, ot not to SDL
Edited by Mikael Johansson on Reason: Initial post
I have finally started follow Casey along to start building my own game engine from scratch, and am having a lot of fun!
However, I am starting to have a feeling that I may be wasting my time. Maybe it is a better idea to go for SDL? So this question is for you people that have built your own things Casey-style, and left SDL behind. Did it take a long time? Was it worth it? And in that case, how and why? Did you produce stuff of higher quality, and/or more effectively after you finished?
50 posts
To SDL, ot not to SDL
If you keep watching the series, later Casey mentions that for linux development he suggests to use SDL due to the amount of variety on linux flavors and compatibility. SDL would be one third party to add to your project, but will provide you with a wider support for all the linux flavors. You can avoid SDL in Linux of course, then you have to make sure it will run for all the linux distributions, is a lot of work!

In Windows, and iOS, there is no need to put a third party in the middle, you have enough support to use direct calls to the OS API.

It wouldn't be bad for you to learn SDL in the end, notice that some other members of this community have already ported to SDL the series.

Did it take a long time? Was it worth it? And in that case, how and why? Did you produce stuff of higher quality, and/or more effectively after you finished?

I think the series are a great resource to help you develop your own style and adapt better programming practices. The quality and effectiveness relies heavily in your own personal experience, probably.
511 posts
To SDL, ot not to SDL
Also part of the reason for the platform/game layer split is to make it easy to swap out the platform layer if you want to switch later.

that the platform layer is bare metal or on top of a 50M LoC enterprise-grade framework doesn't really matter.
50 posts
To SDL, ot not to SDL
In case you are wondering here you have the SDL port.
SDL handmade
Mārtiņš Možeiko
2562 posts / 2 projects
To SDL, ot not to SDL
itzjac
You can avoid SDL in Linux of course, then you have to make sure it will run for all the linux distributions, is a lot of work!


I'm pretty sure SDL will not solve this. You'll still need to support and test different distributions individually. Who knows what breaks one on Ubuntu version or different due to different glibc or mesa drivers. SDL does not solve this. Same on Windows - you cannot blindly expect application work on Windows 7 if it works on Windows 10. You'll need to test it. But even there SDL can help to use newer APIs on Win10, if you are not familiar with them. So don't look at SDL as something that will solve your compatibility issues with different OS versions. Look at it only as wrapper around APIs you are not familiar or less familiar with. If that is something useful, then use SDL. Even on Windows.
Micah
1 posts
To SDL, ot not to SDL
I use SDL regularly, and didn't find it a waste of time at all.
Keep in mind, the platform code created in the first five weeks is NOT anything planned for shipping the game, and not a replacement for SDL or anything similar. Mostly it's to get a hands-on idea of how things like SDL or GLFW or any other helper API/libraries work under the hood.

For more stable projects SDL is exactly what I'd use, but following along with Casey rolling a platform layer from scratch is great for learning different program design practices, processes, and grants those of us following along a better intuition of how/when to implement custom "handmade" solutions.

So yes, totally worth it :)

Also, while it hasn't been updated in a long while, there is this: https://davidgow.net/handmadepenguin/
16 posts
Based in Japan. Building a fully featured music production system with a twist.
To SDL, ot not to SDL
I would recommend reading this post by Jeff Preshing. He makes a strong case for using SDL (or at least starting off with it).

https://preshing.com/20171218/how-to-write-your-own-cpp-game-engine/

In his wise words:

My first piece of advice is to get something (anything!) running quickly, then iterate.


I think it ultimately depends on how much you value learning versus getting things done.