For being good game programmer ,good to use SDL?
#1 Members - Reputation: 100
Posted 17 May 2011 - 01:24 AM
I just started developing games, i found that we can use SDL to develop games, but using such API's is really a good option?
or we should avoid such things to improve our skills? I want to be a good game programmer, so i think it will be good if i do many
of the things in my own?
Also game studios recruitment clearly shows the need to have good grip over c++ , OpenGl.
Using the SDL ,Can i still improve my these required skills?
Please suggest !!
Thanks&Regards
#2 Members - Reputation: 117
Posted 17 May 2011 - 01:42 AM
Most people will tell you to use SFML instead of SDL, if you are planning on programming in C++.
#3 Moderators - Reputation: 5309
Posted 17 May 2011 - 02:15 AM
#4 Members - Reputation: 189
Posted 17 May 2011 - 12:33 PM
And if you ever feel limited, in possibilities or in "skill challenge", you can replace SDL with something of your own later.
#5 Members - Reputation: 126
Posted 27 May 2011 - 11:40 PM
---
Free C++, OpenGL, and Game Development Video Tutorials @
www.MarekKnows.com
Play my free games: Ghost Toast, Zing
#6 Staff - Reputation: 9020
Posted 28 May 2011 - 04:22 AM
If you look at the List of games using SDL on Wikipedia you'll find that there are a lot of quality games, and that even some very big commercial titles have used it for Linux ports; working with SDL will not be a waste of your time.
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#7 Members - Reputation: 228
Posted 02 June 2011 - 04:41 PM
- It probably has the wrong open source license (its unusable as-is on platforms that don't have dll support), and for the platform's you would need the commercial license won't come with code to run on that platform (PS3, XBOX, etc) anyway, which more or less makes me wonder why the commercial license of SDL costs money.
- You still have to deal with shaders (GLSL, Cg, HLSL), which arguably is where a huge portion of the code is going to live. Supporting more than one flavor is a huge amount of work, which can be mitigated with a language neutral shader generator (editor etc), which is also a huge amount of work to create.
- Graphics API's in the grand scheme of things aren't all that complicated since the hardware does all of the work, using the APIs raw or even making a basic wrapper for one is a pretty trivial thing to do.
- For C++ the real time consuming things end up being things like serialization, proper localization support and string handling, and memory management (multiple heaps, streaming textures etc)
#8 Members - Reputation: 1896
Posted 02 June 2011 - 05:39 PM
It's not quite so simple. SDL 1.3 is now zlib (or some similarly permissive license). However, 1.3 is still a WIP (last I checked, at least), and so may not be suitable in some cases. 1.2.x is relatively stable, but is still LGPL (IINM). Whether that's a problem depends on the circumstances, of course.It probably has the wrong open source license (its unusable as-is on platforms that don't have dll support), and for the platform's you would need the commercial license won't come with code to run on that platform (PS3, XBOX, etc) anyway, which more or less makes me wonder why the commercial license of SDL costs money.
Naturally, if a library doesn't support the platforms you're interested in or if the licensing terms or cost don't meet your requirements, then it probably won't be of much use to you. That goes for any library though, more or less (SDL isn't unique in this regard).
Although SDL 1.3 does provide a wrapper over the underlying graphics API for hardware-accelerated 2-d graphics, many people just use SDL to handle windowing and events, and do all the low-level graphics stuff themselves. As such, SDL is still useful even if you want to write all the low-level graphics code yourself.Graphics API's in the grand scheme of things aren't all that complicated since the hardware does all of the work, using the APIs raw or even making a basic wrapper for one is a pretty trivial thing to do.
If you're talking about development time, I'd say it's probably easy to underestimate what goes into a cross-platform library like SDL unless you've actually tried to implement such a framework yourself (that is, a library that supports at least Windows, OS X, and Linux, and offers support for windowing, events, basic audio, and so forth). It can be surprising how much is involved (IMX, at least).For C++ the real time consuming things end up being things like serialization, proper localization support and string handling, and memory management (multiple heaps, streaming textures etc)
Note that I'm not specifically advocating for the use of SDL here; I'm just responding to the points you raised.
#9 Members - Reputation: 102
Posted 06 June 2011 - 04:37 PM
#10 Members - Reputation: 95
Posted 08 June 2011 - 06:47 AM
SDL is also compatible with the much more powerful OpenGL. SDL has many tutorials on the web, Lazy Foo being the best I have found so far, though I no longer have a need for tutorials and only really use them as a reference. OpenGL, when used with SDL can give it a bigger punch. SDL should be learnt first then OpenGL (walk before running).
- I would avoid SFML as there are very little tutorials and I don't really know a lot of support.
- Allego (Don't make me laugh).
- Win32 API is great, lots of control but without learning an API before, you will find it very difficult and probably get frustrated.
I do not care for reputation, merely to help fellow users.
#11 Members - Reputation: 843
Posted 09 June 2011 - 04:34 AM
The tutorials on the SFML homepage explain pretty much anything that one needs to know, also I found that thanks to the very structured oop approach of SFML I have to study documentation and tutorials way less.
- I would avoid SFML as there are very little tutorials and I don't really know a lot of support.
#12 Members - Reputation: 95
Posted 09 June 2011 - 06:12 AM
The tutorials on the SFML homepage explain pretty much anything that one needs to know, also I found that thanks to the very structured oop approach of SFML I have to study documentation and tutorials way less.
- I would avoid SFML as there are very little tutorials and I don't really know a lot of support.
I'm talking of what I know from about a year ago, so it may have well changed since then. I would still choose over SDL over SFML. It was the first API that I learnt to use and helped me learn more complex APIs like WIn32 API and OpenGL.
I do not care for reputation, merely to help fellow users.
#13 Members - Reputation: 93
Posted 09 June 2011 - 06:52 PM
Good luck!
EDIT: That reminds me, while SFML is actively being worked on, SDL hasn't been updated in years. It does have a strong community built up though.
#14 Members - Reputation: 1896
Posted 09 June 2011 - 07:09 PM
SDL 1.2.x is relatively stable, and indeed hasn't had any major updates in some time. However, active development has continued on SDL 1.3. (It's still a WIP, but to say that SDL hasn't been updated in years is inaccurate.)SDL hasn't been updated in years.
#15 Members - Reputation: 124
Posted 09 June 2011 - 09:30 PM
http://nehe.gamedev.net/lesson.asp?index=01
#16 Members - Reputation: 1896
Posted 09 June 2011 - 10:10 PM
The primary advantage of an API such as SDL or SFML is (arguably) portability. If you're only targeting Windows, then that may not matter for you, in which case using WinAPI directly may be perfectly suitable. But if you were to try to replicate that functionality for Linux and OS X and perhaps other platforms as well, you might start to see how a cross-platform library such as SDL can be useful.Do realize that I have never even used SDL, so I don't know the advantages... I just know that I don't need it.
#17 Moderators - Reputation: 5309
Posted 10 June 2011 - 02:18 AM
Here is a simple SDL program that draws a sine wave.
#include <cmath>
#include <cstdlib>
#include <iostream>
#include "SDL.h"
void drawSineWave(SDL_Surface *screen)
{
int h = screen->h / 2;
float time = (SDL_GetTicks() % 1000) / 1000.0f;
for(int x = 0 ; x < screen->w ; ++x)
{
float f = (x / static_cast<float>(screen->w)) + time;
int y = h + static_cast<int>(h * std::sin(360.0f * f * (M_PI / 180.0f)));
SDL_Rect r = {x, y, 1, 1};
SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0xff, 0, 0));
}
}
int main(int, char **)
{
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
std::cerr << "Failed to init SDL " << SDL_GetError() << '\n';
return 1;
}
std::atexit(&SDL_Quit);
SDL_Surface *screen = SDL_SetVideoMode(800, 600, 0, SDL_DOUBLEBUF);
if(!screen)
{
std::cerr << "Failed to set video mode: " << SDL_GetError() << '\n';
return 2;
}
bool running = true;
while(running)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT)
{
running = false;
}
}
SDL_FillRect(screen, 0, 0);
drawSineWave(screen);
SDL_Flip(screen);
}
return 0;
}
Ain't it pretty!






