-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to newer SDL2 #4
Comments
Hello I think I started an upgrade process twice but I gave up when I realized how much bigger SDL2 has become since. On Linux an external SDL2 can be used in the build process because our outdated SDL2 straight up crashes on some distributions while on Windows I don't see that many problems. Better input device support would be nice though. ZillaLib with it's goals to be dependency free and produce small output sizes (often in a single executable) are somewhat at odds with current SDL2. It doesn't want to be statically linked and if forced comes with a ton of overhead. So instead of fighting with SDL2, I'd love to move the three platforms that use it (Win, Mac, Linux) to glfw and miniaudio or something alike. You mentioned support for newer operating systems, is there something specific in your mind? I guess Switch is supported by SDL2 (albeit non-publicly) but other than that a move to glfw would not hurt compatibility I think? Cheers, |
Thanks for your swift response! I would generally love to keep it lightweight as well, and I know SDL has been struggling quite a lot with feature overload and bug fixing. |
Ouch regarding Android... GLFW is a popular project with many contributors so I am hopeful that it is at least as compatible and up-to-date as SDL2 (on the three desktop platforms). Adding any rendering support to ZillaLib besides GL (and GLSL/WebGL) would be a giant undertaking which I don't see happening unless I find myself suddenly with a lot of free time or this project somehow becomes much more than it is. The way Apple is treating OpenGL nowadays is saddening, but the idea of bundling MoltenVK with a ZillaLib game for their platforms is extremely unappealing to me. There was a time where Android and iOS were my top priority in regards to ZillaLib but things have a bit shifted for me, which brings me to this... It's funny, I wanted to write in my last post that it is essentially just me for now developing ZillaLib so it focuses on what I need/have. My phone still runs Android 6 and macOS 10.14 is all I have access to. My interest has been on WebAssembly recently which is perfect for distributing small games on desktop platforms. I quite dislike how ginormous Android SDK and NDK has become but if the output files straight up refuse to run on newer OS versions I want to look into that. Maybe I can get one of those Android emulators for PC to test. I know it would be easy to just use SDL2 for all platforms and let them deal with it but that's not fun :-) Also if I can't make 150kb gamejam games what is the point. Now if I could make 64kb games with ZillaLib... mmmh |
I just discovered ZillaLib yesterday but I have been working with a multitude of engines, SDKs and APIs over the last decades (and written a fair share of my own) and I simply love the idea of a lightweight but capable cross-platform C++ engine. Zillalib comes really close to a good featureset for many developing needs in my opinion and I would love to see it used by more people. |
Oh, as a side note, on my Samsung S10 with Android 9 (which will probably get upgraded to Android 10 in the next days), if I disable the app security checks, I can run the Zillalib sample and game apks. There still is a warning message saying this application was not compiled for this Android version which can lead to problems, but it runs fine. At least as far as I could tell, as all of the Android samples seemed to require an attached keyboard and are not working just with touchscreen controls. |
Funnily if I didn't join the games industry professionally, chances of a ZillaLib game coming out on Steam would have been bigger and then maybe my needs would have been different. But as it is I only ever get to use it for small games like last weeks ludum dare game jam. Yeah SDL is used for Window creation and management, GL context creation, raw audio output, window/input events, fullscreen switching and joystick support. It also does touch screen support on desktop platforms which I have actually used for an interactive toy thing. It uses some multi threading functions offered by SDL but that is a tiny amount of code if we just do Win32 and pthreads. Maybe we could keep SDL2 support, but remove the included old SDL 2.0.6 and replace it with GLFW for tiny games and offer full support for external SDL2 everywhere (maybe even on non-desktop platforms). Hopefully building with a newer Android SDK still allows us to be compatible with old Android versions (as many as possible). APKs built by ZillaLib now still run on Android 2.3 because it doesn't use anything fancier than available there. I think it's OK nowadays to increase that OS requirement but shallow security checks alone seem a silly reason to do so. I tried the BlueStacks Android emulator but it comes only with Android 7 and had no problem running the sample APKs. Touch input worked fine, none of the samples do much with the keyboard but the input one. Maybe old touch APIs got deprecated (again) and an update is needed. |
GLFW also had the problem with black screen in Mojave/10.14, so you would need a rather recent version that has the fix included. Development on MacOS and for iOS is getting increasingly horrible, especially with the deprecation of OpenGL and the new requirements for 10.15 (e.g. requiring Apple to sign your binaries), making me want to step away from this unfriendly infrastructure if only I could. As for Android topics, I will open up another issue so as not to mix it with the SDL discussion here (I previously assumed you also use SDL on Android in ZillaLib). |
Meh, I just downloaded the latest GLFW for Windows and compiled it as a static lib, and a minimal example already has more than 250kB in file size in release mode. |
Note that GLFW does now always include the SDL game controller database and uses it to handle the multitude of input devices and their button mapping, pretty nice. |
I just played around with it a bit, 2 things are immediately big in GLFW:
The controller mappings we can easily z-compress down to 8kb. GLAD we don't need, it's fine to manually bind only the needed GL functions, ZillaLib already does this. I also tested with removed EGL and OSMESA support on Windows which removed another 10kb from the exe. There are 6kb of static data in glfw which is a bit of a bummer because it is just zeroes in the output file it could be replaced by dynamically allocating that memory on load. Our current slim SDL2.0.6 results in just 44kb binary on Win32 in release (that includes audio), GLFW3 is at 46kb (6kb reduce possible) with audio features not included. Not that exciting but also not devastating. |
Great job! If I find the time, I will check if I can further reduce it (also for my own projects using GLFW). |
With MacOS 10.15 that was released last week, things got really awful in the software world and most developers are faced with a flood of tickets and complaints. |
Sorry my bad, no idea why I wrote 2.0.6 there, yes 2.0.3 is correct. Yeah I personally have barely any interest in keeping apple OS support alive and hearing about these changes makes me lose any remaining motivating in regards to them. If they can just go ahead and completely remove OpenGL support there might be a chance I never have to look at Xcode ever again, which would be great (-: Microsoft kind of started to show some mean messages regarding "unknown" exe files for some users on some Win10 installations which made me worry. That is how Apple started out a few years ago. Personal computing as we know is dissolving in front of our eyes... |
Any plans/chance to replace SDL2 in ZillaLib on desktop targets with pure GLFW? I guess probably not :) ;) |
Almost exactly to the day 4 years later, it's me again. :) |
An interesting project and maybe a possible alternative to SDL or GLFW is this very lightweight header-only library: https://github.com/ColleagueRiley/RGFW/ |
Has anyone tried to update the included SDL2 sources? Zillalib ships with 2.0.3, which is almost 6 years old, and in the meantime there have been big improvements in all areas of SDL, like supporting newer operating systems, input devices, rendering, audio, etc. Unfortunately it is not as simple as just replacing the "sdl" folder with sources from the latest SDL release, so I am curious if someone has already tackled this job, as it does not seem trivial.
The text was updated successfully, but these errors were encountered: