|
Title: Going with C++ w/ SDL2 and Code::Blocks Post by: swipefaststudios on April 09, 2016, 01:24:58 PM I am starting to make a game and I am wondering which Library is better for making a 2D Platform Game.
I have learned C# and C++ in school and want to use one of them to make a game for fun. I have heard that C# is easier to make games with and most people make it with xna but SDL looks pretty good to make games with. On the other hand I know there is a lot more documentation and a more active community in C++ and OpenGL but I do not know if it is a lot harder to make games with or if that matters at all. If you have any opinions on this let me know. I am leaning towards C# and SDL library but just unsure if it is updated to work with current graphic cards since the website has articles last written in 2010 so I am guessing it isn't updated regularly. So basically it is programming games in c# because it is easier or program a game in C++ because it has more documentation and updated website. I am looking for developers experience with each language and which one they think is better to make a game with. Thank you for your help! Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 10, 2016, 02:49:12 AM SDL works with C++ too and you can always add OpenGL support later. My engine started out with vanilla SDL graphics and then I changed the rendering to use a custom OpenGL setup later, and I didn't have to recode the actual game stuff (but surely SDL for C# lets you use OpenGL as well, or is it so tied to Microsoft that it only allows either DirectX or nothing?).
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 10, 2016, 08:21:08 AM SDL works with C++ too and you can always add OpenGL support later. My engine started out with vanilla SDL graphics and then I changed the rendering to use a custom OpenGL setup later, and I didn't have to recode the actual game stuff (but surely SDL for C# lets you use OpenGL as well, or is it so tied to Microsoft that it only allows either DirectX or nothing?). Thanks for your opinion! I think in the end that it would be good for me to do C++ SDL and OpenGL because it has more documentation and seems better for making games. I also want a challenge in coding games and learn about different techniques to draw images on the screen and such. Thanks again for the help! Hopefully I start to make a game soon! Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Shine Klevit on April 10, 2016, 08:50:03 AM Well, it's all about understanding the purpose of C++, C#, SDL, XNA, and OpenGL.
It really matters what you're looking for. If your focus is ease of use over portability I would pick C# over C++. C++ is much better for portability, and more powerful(Albeit, it kind of sounds like you don't really need that much power. C# would probably function quite well). Yet, C# is much easier to code in. If you want something a little more difficult that gives you significantly more power you probably want to go with OpenGL possibly using SDL as a front-end for input. SDL alone, however, functions pretty well if you're just interested in doing something simple. I mean, you can actually do some interesting stuff with pixel manipulation in SDL, but it's kind of tricky to do that in a way that's efficient. I don't know if you would need SDL with C#. SDL's biggest advantage is portability, where as C# isn't really particularly geared for that(Albeit, I haven't looked into C# for a long time, and could be completely wrong about this). I think C# might actually have access to much easier alternatives that perform all of SDL's functions. Then again, I may be more ignorant on these topics than I think I am. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheezmeister on April 10, 2016, 05:45:02 PM Pedantically, XNA is dead. It was reborn as MonoGame, which is pretty healthy last I heard. Solid choice for a "lighter" Unity. It's the path of least resistance for your game, I suspect.
I didn't know you could use SDL from C#, but it doesn't surprise me because SDL has bindings for everything under the sun. I would not recommend unless you *really* want SDL's API and *really* like C#. C++/SDL/GL is the canonical open-source, portable game stack. I love it personally but it takes some effort to do even the basics. I wrote this little skeleton, which you may find useful if you're intent on going that route (but be warned there's no sprite support): https://github.com/Cheezmeister/jamboot For a 2D platformer, you really don't need GL at all. SDL has decent 2D capabilities on its own, and it's way easier than 2D with GL, which was built primarily with 3D in mind. In any case: good luck! Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 10, 2016, 07:30:31 PM C++/SDL/GL is the canonical open-source, portable game stack. I love it personally but it takes some effort to do even the basics. I wrote this little skeleton, which you may find useful if you're intent on going that route (but be warned there's no sprite support): https://github.com/Cheezmeister/jamboot Thanks I will have to take a look at your code, thanks for the helpful knowledge as well!For a 2D platformer, you really don't need GL at all. SDL has decent 2D capabilities on its own, and it's way easier than 2D with GL, which was built primarily with 3D in mind. In any case: good luck! C++ and SDL sounds very promising for me now! Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 11, 2016, 12:54:32 AM Don't forget that SDL2 is out and so much better in case you'd missed that, tho I assume that's what you're implying by just saying SDL. So don't get old SDL!
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 11, 2016, 05:05:35 AM I heard about it but I can't find the link,
Do you have a link to the download of it? Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 11, 2016, 06:11:11 AM Weird that you can't find it. I just googled "sdl2" and found it right away.
https://www.libsdl.org/download-2.0.php Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 11, 2016, 07:35:59 AM One More Question:
What Editor or IDE should I use with SDL2? Does it matter what visual studio I use? Or do you recommend something else? thanks Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 11, 2016, 07:48:31 AM Well, use whatever you prefer. I personally use Xcode, but that's Mac only, but Visual Studio is probably its Windows counterpart. Some people prefer full-blown IDE's and some do not.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 11, 2016, 09:21:02 AM Ok Thanks! I will probably use visual studio 2013 or something or 2015 since I only have windows!
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Polly on April 11, 2016, 09:53:19 AM I will probably use visual studio 2013 or something or 2015 since I only have windows! If you decide on Visual Studio, you probably want to get "Visual Studio Community" ( which is free ). It's the successor to the "Express" series of Visual Studio, except that it's no longer a stripped-down version of the regular Visual Studio ( which costs money ). Do keep in mind that it's a behemoth of a application which will take some time to install & gobble up quite a few GBs on your hard-drive. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 11, 2016, 09:55:20 AM If you decide on Visual Studio, you probably want to get "Visual Studio Community" ( which is free ). It's the successor to the "Express" series of Visual Studio, except that it's no longer a stripped-down version of the regular Visual Studio ( which costs money ). Do keep in mind that it's a behemoth of a application which will take some time to install & gobble up quite a few GBs on your hard-drive. Okay thanks for the info! I will download it now! I have a bit of space on my hard drive so that will be okay :) Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 11, 2016, 10:10:32 AM One thing worth noting is that someone has been telling me their VS keeps adding backslashes in paths instead of the cross-compatible and UNIX-friendly forward slashes (#include "folder\file.h" instead of the almost universally preferred (and functional on Windows as well) #include "file/path.h"), so watch out for that and other possible windowsisms that VS might throw upon you and perhaps try to see if you can turn those off. Give it a web search.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 11, 2016, 10:15:05 AM One thing worth noting is that someone has been telling me their VS keeps adding backslashes in paths instead of the cross-compatible and UNIX-friendly forward slashes (#include "folder\file.h" instead of the almost universally preferred (and functional on Windows as well) #include "file/path.h"), so watch out for that and other possible windowsisms that VS might throw upon you and perhaps try to see if you can turn those off. Give it a web search. Thanks for the heads up, I will keep that in mind!Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: InfiniteStateMachine on April 11, 2016, 10:17:47 AM One thing worth noting is that someone has been telling me their VS keeps adding backslashes in paths instead of the cross-compatible and UNIX-friendly forward slashes (#include "folder\file.h" instead of the almost universally preferred (and functional on Windows as well) #include "file/path.h"), so watch out for that and other possible windowsisms that VS might throw upon you and perhaps try to see if you can turn those off. Give it a web search. Yeah it's very annoying that this is the default behavior. To make it use forward slashes go Options -> Text Editor -> C/C++ -> Advanced and set Use forward slash in #include to true Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 11, 2016, 10:18:38 AM Can it handle UNIX newlines these days too?
Also I remember trying VS many years ago and it added some extra files when all I wanted was a main.cpp and nothing else. Does it still do that / are those necessary / do they interfere with portability? Maybe I just chose the wrong project template? Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Polly on April 11, 2016, 10:52:09 AM Also I remember trying VS many years ago and it added some extra files when all I wanted was a main.cpp and nothing else. Does it still do that / are those necessary / do they interfere with portability? Maybe I just chose the wrong project template? You probably forgot to enable the "empty project" option. Otherwise Visual Studio automatically adds some boilerplate code / files and configures your project to use precompiled headers. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: InfiniteStateMachine on April 11, 2016, 11:32:13 AM Can it handle UNIX newlines these days too? Also I remember trying VS many years ago and it added some extra files when all I wanted was a main.cpp and nothing else. Does it still do that / are those necessary / do they interfere with portability? Maybe I just chose the wrong project template? Yeah I think polly is right. Sounds like you might have picked win32 console app rather than a empty command line app. If that happens it adds a bunch of crap like stdafx.h (their precompiled header stuff). I'm pretty sure the stdafx stuff is not portable (I've never actually used it so I'm not totally sure). You should just have the 1 file when generating a new commandline project. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheesegrater on April 11, 2016, 02:20:48 PM It is portable, it is just that stdafx won't be precompiled on other platforms, but it will still be #included like any other header file.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheezmeister on April 12, 2016, 01:39:19 PM Look into Code::Blocks over Visual Studio. It's a little basic, as IDEs go but I find it's way less complicated than VS and doesn't steer you towards Windows-isms that make porting a pain, if and when you choose to. It's also, itself, cross-platform. Though, I guess VS is too now, isn't it? :D
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 12, 2016, 03:50:41 PM I loved C::B back in the day but after using Xcode and other hypermodern stuff it now feels so horribly deprecated and old and clunky to me. :f
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: InfiniteStateMachine on April 13, 2016, 07:10:03 AM Look into Code::Blocks over Visual Studio. It's a little basic, as IDEs go but I find it's way less complicated than VS and doesn't steer you towards Windows-isms that make porting a pain, if and when you choose to. It's also, itself, cross-platform. Though, I guess VS is too now, isn't it? :D How does VS steer your towards windowisms? VS isn't cross platform and it sounds like it never will be. It's made on WPF which while being an amazing gui framework, is enormously complex and bound to a lot of windows only tech. It sounds like both MS and the open source community feel it's too complicated of a problem. While we're throwing out alternative IDE options, I've always liked KDevelop. It's project files are cmake files. That's pretty neat. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheesegrater on April 13, 2016, 08:24:12 AM VS isn't cross platform and it sounds like it never will be. They probably mean Visual Studio Code (https://www.visualstudio.com/en-us/products/code-vs.aspx), which is cross platform. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: InfiniteStateMachine on April 13, 2016, 09:16:59 AM Ah yes. Unfortunately the only thing VSCode has in common is the name. It's really just a modified version of Atom.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheesegrater on April 13, 2016, 09:19:25 AM Monaco, not Atom, but your point still stands - it is a different thing with a confusing name.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 13, 2016, 09:46:40 AM So should I use Visual Studio or a different IDE for portability?
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheesegrater on April 13, 2016, 09:48:23 AM If you want to use the same IDE on every system, use something else. If you just want to port the resulting code, it really doesn't matter.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 13, 2016, 09:49:19 AM They only meant that the IDE software itself is not written in portable code, meaning that you can't find the same IDE for multiple systems. This however does not prevent your own code from being portable.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 13, 2016, 09:50:24 AM What IDE can be used on every system?
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheesegrater on April 13, 2016, 09:53:14 AM I like Eclipse.org OK.
Some other people already mentioned Code::Blocks. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 13, 2016, 09:55:16 AM C::B is basically too buggy to use on OS X. It's literally broken. At least the last time I checked. I can't remember exactly what the problems were, tho, so while it's not suitable to work in, it might still be possible to open an existing project and get it to compile. But if you want to do it the Mac way, with an .app and everything, it's probably just for the best to compile in Xcode TBH. You'll have to read up on that yourself, but I think so at least.
Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: InfiniteStateMachine on April 13, 2016, 11:42:15 AM Monaco, not Atom, but your point still stands - it is a different thing with a confusing name. Ah my bad. Google is not helping me out here. Is monaco a fork of atom/electron or is it something completely different? In regards to trying to run the same IDE on different platforms. Personally I'd elect to abandon that quest and a build system that will generate solution/project files for different ide's. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: Cheesegrater on April 13, 2016, 11:50:17 AM Ah my bad. Google is not helping me out here. Is monaco a fork of atom/electron or is it something completely different? It uses electron (atom the app toolkit), but is not a fork of atom (atom the code editor). It's also the online editor for Visual Studio Team Services. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: swipefaststudios on April 13, 2016, 01:04:25 PM This is a good tutorial I think for SDL
http://lazyfoo.net/SDL_tutorials/lesson01/windows/eclipse/index.php For SDL2 here is one for eclipse as well! http://zamma.co.uk/setup-sdl2-eclipse-windows/ Just posting it if anyone else needs it :) Title: Re: Going with C++ w/ SDL2 and Eclipse IDE Post by: Shine Klevit on April 13, 2016, 01:42:04 PM I was using codeblocks quite extensively for awhile, but only stopped just recently. Actually, in most ways, did an admirable enough job of everything that I needed it to.
However, I don't know if it's the way I've been coding, or what, but it became a ridiculous pain the ass to debug in codeblocks after awhile. I tried using a graphical debugger(Nemiver) to do the job, and it carried over none of the problems. No idea why since they both just interface gdb, but codeblocks didn't seem to have many or any relevant options in how it interfaced with gdb that I could use. Then again, there's a creeping suspicion that it might have something do with the way I'm coding even if I'm oblivious to what it could be, exactly. So, for that reason, I don't know if I can really recommend it, personally. Then again, if you're running everything on Windows, you might not run into the same problem. Title: Re: Going with C++ w/ SDL2 and Eclipse IDE Post by: Cheezmeister on April 13, 2016, 03:05:31 PM Yikes, I unintentionally started one of those IDE derails. Sorry, @swipefaststudios ^_^;
Use what you're comfortable with. As you can see there's dozens of choices. None of them are really the best. I suggest C::B mostly because it sounds like you're just getting your feet wet and therefore want simplicity over capabilities. It's totes your call. Ah yes. Unfortunately the only thing VSCode has in common is the name. It's really just a modified version of Atom. Yep, I was thinking of VS code. I thought it was a trimmed-down VS of some sort. My mistake. Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: oahda on April 13, 2016, 04:14:40 PM This is a good tutorial I think for SDL Lazyfoo has tutorials on SDL2 too, just so you know.http://lazyfoo.net/SDL_tutorials/lesson01/windows/eclipse/index.php For SDL2 here is one for eclipse as well! http://zamma.co.uk/setup-sdl2-eclipse-windows/ Just posting it if anyone else needs it :) Title: Re: C# w/ SDL or C++ w/ OpenGL Post by: InfiniteStateMachine on April 13, 2016, 05:44:07 PM Ah my bad. Google is not helping me out here. Is monaco a fork of atom/electron or is it something completely different? It uses electron (atom the app toolkit), but is not a fork of atom (atom the code editor). It's also the online editor for Visual Studio Team Services. Ah thanks, clear now :) Title: Re: Going with C++ w/ SDL2 and Eclipse IDE Post by: swipefaststudios on April 13, 2016, 07:28:14 PM Yikes, I unintentionally started one of those IDE derails. Sorry, @swipefaststudios ^_^; No problem, It's a forum haha. Title: Re: Going with C++ w/ SDL2 and Eclipse IDE Post by: agoacher on April 20, 2016, 06:11:20 AM CLion is a great C++ IDE! You pay for it but it is awesome - also uses CMake as a project system.
Visual Studio is just all around a wonderful environment to write code in. Yes it has "windowisms" and no it's not cross platform but while you're working in Windows it is one of the best development experiences you will have. Title: Re: Going with C++ w/ SDL2 and Eclipse IDE Post by: Raptor85 on April 20, 2016, 06:36:25 PM I see you've already picked, but just for the sake of letting you know about it, a fantastic C++ editor environment/IDE (kinda) is Sublime text and it's free clone Lime text http://limetext.org/
Title: Re: Going with C++ w/ SDL2 and Eclipse IDE Post by: swipefaststudios on April 21, 2016, 02:25:51 PM I see you've already picked, but just for the sake of letting you know about it, a fantastic C++ editor environment/IDE (kinda) is Sublime text and it's free clone Lime text http://limetext.org/ Thanks I may check that out!I tried setting up SDL2 with eclipse but couldn't get it to work. So instead I tried with Code::Blocks and it worked great after I watched a tutorial! So I will start doing some coding tonight! Title: Re: Going with C++ w/ SDL2 and Code::Blocks Post by: oahda on April 23, 2016, 11:06:22 AM Just found and watched this nice overview of SDL2. It's easy to miss or forget about some of its features even after having used it for a long time, so it was a good watch. I didn't know that it has stuff to determine where to save files on whatever OS you are on, for example. Really nice to have that solved for you already. I've seen so many discussions on that here on TIGSource before.
https://www.youtube.com/watch?v=MeMPCSqQ-34 Title: Re: Going with C++ w/ SDL2 and Code::Blocks Post by: Cheezmeister on May 01, 2016, 08:26:31 PM I love this video. Ryan Gordon is such a great speaker.
Title: Re: Going with C++ w/ SDL2 and Code::Blocks Post by: Deckhead on May 24, 2016, 08:31:15 PM I've been using code::blocks ever since I tried installing visual studio and asking myself, "wtf is this installing? Nothing should take this long."
What does VS have, or other IDEs have, that code::blocks doesn't? Title: Re: Going with C++ w/ SDL2 and Code::Blocks Post by: deathgreps on June 06, 2016, 09:09:39 PM I've been using SDL2 using C++ and a word of advice: SDL_Renderer will be just about {every,any}where you need a texture. I also suggest setting up smart pointers for the commonly used SDL structures (Surface, Texture, Renderer, Window, TTF (if you use SDL_ttf)). Makes things much easier in the long run.
Title: Re: Going with C++ w/ SDL2 and Code::Blocks Post by: Christian Knudsen on June 07, 2016, 09:25:40 AM I didn't know that it has stuff to determine where to save files on whatever OS you are on, for example. Really nice to have that solved for you already. I've seen so many discussions on that here on TIGSource before. :o |