Sign in to follow this  
GautamSingh

For being good game programmer ,good to use SDL?

Recommended Posts

GautamSingh    100
Hi All,

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

Share this post


Link to post
Share on other sites
lpcstr    127
The purpose of SDL is to give you a cross-platform way of performing common tasks, like creating a GUI Window and accessing keyboard and mouse. If you only plan on creating a game for one platform and one only, then you might think of it as a convenience. If you ever plan to deploy it on multiple platforms (eg. Windows, OS X, Linux, iPhone, Android) then it is an absolute must that you use something like SDL.

Most people will tell you to use SFML instead of SDL, if you are planning on programming in C++.

Share this post


Link to post
Share on other sites
rip-off    10979
If you want to develop games, no one will likely care about your skills in writing the boilerplate code for creating a window and setting up a suitable rendering context. In commercial situations, this is almost certainly already handled by existing code, either through a library/engine or some in-house project boilerplate.

Share this post


Link to post
Share on other sites
SriLumpa    198
Programming a game is such a vast task, you can use SDL and still find lots of things to practice your skills (and as said by others, more interesting things than what SDL does).

And if you ever feel limited, in possibilities or in "skill challenge", you can replace SDL with something of your own later.

Share this post


Link to post
Share on other sites
mmakrzem    1036
When I first started working in 3D, I also used SDL. Eventually when I was comfortable enough with SDL, I ended up replacing it with Win32 API calls to have more control over my games. SDL was a great stepping stone for me because it let me get up and running quickly and what you learn there, carries forward to other platforms as well.

Share this post


Link to post
Share on other sites
jbadams    25713
To answer part of your question a little more directly: YES -- using SDL will still let you practice your C++ and (if you choose to use it) OpenGL, and more importantly it will allow you to exercise your [i]problem solving[/i] skills and create programs without having to worry about basic functionality like creating a window.

If you look at the [url="http://en.wikipedia.org/wiki/List_of_games_using_SDL"]List of games using SDL on Wikipedia[/url] 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.

Share this post


Link to post
Share on other sites
Zoner    232
I've never seen much of a point for using SDL for a few reasons:

[list][*]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)[/list]

Share this post


Link to post
Share on other sites
jyk    2094
[quote name='Zoner' timestamp='1307054509' post='4818883']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.[/quote]
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.

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).

[quote]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.[/quote]
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.

[quote]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)[/quote]
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).

Note that I'm not specifically advocating for the use of SDL here; I'm just responding to the points you raised.

Share this post


Link to post
Share on other sites
Artes    102
Many open-source games use SDL, so if you are interesting in contributing to them, learning SDL would not be so bad. (There are also many using OpenGl.) It can only be a positive thing if you mention SDL on your CV, though OpenGl might have a higher status. With those API things though I think that when you have learned to use one it will be easy to learn the others.

Share this post


Link to post
Share on other sites
ryancfcsas    97
SDL is really the only decent low level game programming API; this is compared to an API like the Windows 32 API.

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).

[list][*]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.[/list]It is important to start with an API that is technical enough, yet simple enough for you to use; there is no point in abandoning games half through because you don't know how to solve the programming specifics. It will also help to build up your problem solving skills, which you will use across all APIs that you learn.

Share this post


Link to post
Share on other sites
japro    887
[quote name='Ryan Konky' timestamp='1307537241' post='4820913']
[list][*]I would avoid SFML as there are very little tutorials and I don't really know a lot of support.[/list][/quote]
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.

Share this post


Link to post
Share on other sites
ryancfcsas    97
[quote name='japro' timestamp='1307615680' post='4821261']
[quote name='Ryan Konky' timestamp='1307537241' post='4820913']
[list][*]I would avoid SFML as there are very little tutorials and I don't really know a lot of support.[/list][/quote]
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.
[/quote]

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.

Share this post


Link to post
Share on other sites
Deadlybones    93
I used to use SDL but I switched to SFML shortly after. I mostly use it for windowing/events but I have used the graphics library that's included for my first few test projects. If you do choose SFML then I recommend you download the version 2.0 snapshot instead of the current version(1.6). Laurent, the creator, even claims that the newer "unreleased" version is more stable than 1.6 and he only has a few more major things to implement before officially releasing it. The only thing that will change drastically should be the graphics library.

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.

Share this post


Link to post
Share on other sites
jyk    2094
[quote name='B O N E S' timestamp='1307667162' post='4821548']
SDL hasn't been updated in years.[/quote]
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.)

Share this post


Link to post
Share on other sites
swilkewitz    128
What's all the fuss with the Win32 API? That's what I started with, given some good tutorials on creating Windows and using the message loop. I used NeHe's openGL tutorial to get started rather quickly. Technically, you don't even need to know the ins and outs of creating a Window. Just go through the first ten or so tuts and experiment a bunch. 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. Also, you don't have to use openGL, and if you want to skip the nitty gritty stuff, you could just start with an open source game engine.


[url="http://nehe.gamedev.net/lesson.asp?index=01"]http://nehe.gamedev.net/lesson.asp?index=01[/url]

Share this post


Link to post
Share on other sites
jyk    2094
[quote name='swilkewitz' timestamp='1307676613' post='4821580']
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.[/quote]
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.

Share this post


Link to post
Share on other sites
rip-off    10979
Leaving aside portability, even creating a simple window/input loop in Win32 requires a lot of (frankly ugly) boilerplate. With SDL, you can get the same result with a tiny amount of (very readable) code.

Here is a simple SDL program that draws a sine wave.
[code]
#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;
}
[/code]
Ain't it pretty!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this