Jump to content

  • Log In with Google      Sign In   
  • Create Account

For being good game programmer ,good to use SDL?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 gamazone   Members   -  Reputation: 100

Like
0Likes
Like

Posted 17 May 2011 - 01:24 AM

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

Sponsor:

#2 lpcstr   Members   -  Reputation: 126

Like
0Likes
Like

Posted 17 May 2011 - 01:42 AM

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

#3 rip-off   Moderators   -  Reputation: 8726

Like
3Likes
Like

Posted 17 May 2011 - 02:15 AM

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.

#4 SriLumpa   Members   -  Reputation: 198

Like
0Likes
Like

Posted 17 May 2011 - 12:33 PM

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.

#5 MarekKnows.com   Members   -  Reputation: 739

Like
0Likes
Like

Posted 27 May 2011 - 11:40 PM

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.

---
Free C++, OpenGL, and Game Development Video Tutorials @
www.MarekKnows.com
Play my free games: Ghost Toast, Zing, Jewel Thief


#6 jbadams   Senior Staff   -  Reputation: 19350

Like
0Likes
Like

Posted 28 May 2011 - 04:22 AM

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 problem solving skills and create programs without having to worry about basic functionality like creating a window.

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.

#7 Zoner   Members   -  Reputation: 232

Like
-1Likes
Like

Posted 02 June 2011 - 04:41 PM

I've never seen much of a point for using SDL for a few reasons:

  • 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 scgames   Members   -  Reputation: 1977

Like
1Likes
Like

Posted 02 June 2011 - 05:39 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.

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

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.

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.

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)

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.

#9 artes   Members   -  Reputation: 102

Like
0Likes
Like

Posted 06 June 2011 - 04:37 PM

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.

#10 Ryan Konky   Members   -  Reputation: 95

Like
0Likes
Like

Posted 08 June 2011 - 06:47 AM

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

  • 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.
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.
My Twitter

I do not care for reputation, merely to help fellow users.

#11 japro   Members   -  Reputation: 887

Like
0Likes
Like

Posted 09 June 2011 - 04:34 AM

  • I would avoid SFML as there are very little tutorials and I don't really know a lot of support.

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.

#12 Ryan Konky   Members   -  Reputation: 95

Like
0Likes
Like

Posted 09 June 2011 - 06:12 AM


  • I would avoid SFML as there are very little tutorials and I don't really know a lot of support.

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'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.
My Twitter

I do not care for reputation, merely to help fellow users.

#13 B O N E S   Members   -  Reputation: 93

Like
0Likes
Like

Posted 09 June 2011 - 06:52 PM

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.

#14 scgames   Members   -  Reputation: 1977

Like
0Likes
Like

Posted 09 June 2011 - 07:09 PM

SDL hasn't been updated in years.

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

#15 swilkewitz   Members   -  Reputation: 128

Like
0Likes
Like

Posted 09 June 2011 - 09:30 PM

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.


http://nehe.gamedev.net/lesson.asp?index=01



#16 scgames   Members   -  Reputation: 1977

Like
0Likes
Like

Posted 09 June 2011 - 10:10 PM

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.

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.

#17 rip-off   Moderators   -  Reputation: 8726

Like
0Likes
Like

Posted 10 June 2011 - 02:18 AM

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.
#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!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS