Basic must haves for SDL game programming

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
azaron08
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 40
Joined: Sun May 27, 2012 12:50 pm

Basic must haves for SDL game programming

Post by azaron08 »

hello,
I was wondering if there might be some must have info,when using SDL, that everyone should know befor starting to create a game in SDL by them selves. maybe stuff like steps to follow when setting a project up,certain code, tutorials to watch, "must know" kinda of info.If you have any or multiple things please leave me a list. Im trying to get what i need to know to start a simple game like snake or tetris as a starting platform for desighning some games. I have some great ideas for some RPG or MMOs but i need to get to a level where i can start desighning those.Any help is very appreciated!
Thanks,
Azaron08 :)
User avatar
superLED
Chaos Rift Junior
Chaos Rift Junior
Posts: 303
Joined: Sun Nov 21, 2010 10:56 am
Current Project: Engine
Favorite Gaming Platforms: N64
Programming Language of Choice: C++, PHP
Location: Norway

Re: Basic must haves for SDL game programming

Post by superLED »

Before starting programming any game at all, make sure you have all your functionality in your head or on paper. Otherwise, you may ending up with "Hey, if I am going to implement this into the game, I must change the whole process of loading up images, or handling the input"

And if you are going to make an MMO with a hounded team members, keep in mind it will take you ~5 years. If you are making it on your own, pray to God that your son will pick up the project after you die, and make him pass the game over to your grandson when your son dies. It would be a great way to make sure your grandchildren is working on a really outdated game.
azaron08
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 40
Joined: Sun May 27, 2012 12:50 pm

Re: Basic must haves for SDL game programming

Post by azaron08 »

Lol k thanks!! I like that last part :lol:
azaron08
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 40
Joined: Sun May 27, 2012 12:50 pm

Re: Basic must haves for SDL game programming

Post by azaron08 »

any other help is welcome!! if you have anything else that might be helpful please add a comment :)
User avatar
DistortedLance
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 26
Joined: Fri Jul 22, 2011 12:36 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Basic must haves for SDL game programming

Post by DistortedLance »

http://www.lazyfoo.net

Lazyfoo was a pretty awesome resource for me (and I'm pretty sure many others). It doesn't get into the hardcore details about creating a game, but it gets you started with SDL, including the setup (which is often the most frustrating part). I would absolutely start with Pong if I were you; it'll introduce you to input handling, collision, basic rendering and whatnot.
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Re: Basic must haves for SDL game programming

Post by Light-Dark »

This might be a little late but anyways, my tips would be know your language, im assuming you are using C++? if so take some time to learn all about the std library and all its various containers and such some of them are pretty useful, for handling input i use something called a map, basically you can do something like this:

Code: Select all

std::map<const char*,bool> keys;
if(What ever key is down)
{
 keys["Key"] = true;
}
else
{
 keys["Key"] = false;
}


just a rough example, but yes as people have mentioned have a plan in your head of how you are going to do it, like are you going to use 2D arrays for storing maps or have a class or struct for tiles or just maybe just a value storing their type and have them contained in a vector or something, example:

Code: Select all

std::vector<unsigned char> tiles;
or
class Tile
{
 SDL_Rect box;
 unsigned char type;
}
std::vector<Tile*> Map;

I don't know if this is exactly the best method, but it's up to you to figure that out, hope this helps in someway or another!
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
Post Reply