2D game programming in SDL

Apprentice
Posts: 17
Joined: 2008.06
Post: #1
Hi, can someone point me a way how to start programming a game like knytt with a level editor in sdl?

[Image: knyttstories3.png]
graphics similair to osman
[Image: osman.png]

I also want to use a weapon system like metroid fusion and megaman 2.

Greetings,

Rhade
Quote this message in a reply
Member
Posts: 53
Joined: 2007.08
Post: #2
SDL has its own 2D drawing functions but I would suggest looking at OpenGL and using textured quads (sprites).

http://www.libsdl.org/ SDL homepage
http://nehe.gamedev.net/ NeHe OpenGL tutorials
http://www.meandmark.com/sdlopenglpart1.html Good guide for getting started with OpenGL/SDL
http://www.opengl.org/code/ Some OpenGL reference

There are lots of examples of SDL/OpenGL stuff out there so look around at the sites above and others, consider purchasing the Red Book for OpenGL (there is an old, copy online I think), and let us know if you get stuck.

Good luck.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #3
If you're asking someone to point the way to how to start, how do you know you want to use SDL? It sounds like you're too early in the process to be choosing an API.

The way you've phrased your questions implies that you don't have a lot of (any?) programming experience. Without having some grounding in reality, it's nearly impossible to understand the scope of what you're trying to do. Your questions approach it from a top-down manner, which simply doesn't work in the programming world. You'll need to start from the ground up. Once you've gotten as far as standing up a basic game application with some placeholder graphics and user interaction, details like a level editor and specific weapon system will intuitively fall into place, since they're built from lower-level concepts you'll have learned along the way.

The path from here to there depends largely on how much programming experience you have so far, your learning style, and your commitment to the project. At a glance, this doesn't look completely out of scope for a first project, though it is a bit hefty. I'd suggest starting by buying and reading this book, and writing some simple command-line applications to get familiar with C programming concepts. Once you're comfortable with that, you could start reading SDL API documentation and get a simple SDL app stood up. Once you get to that point, you should have built up enough of a foundation of knowledge that the next steps will be reasonably intuitive.

Good luck! Don't get discouraged by not being able to jump in and have your game up and running immediately. Programming is very rewarding, even when it takes months of work to see the results come to life.
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2008.06
Post: #4
Hi, my engine will look more like this game Akatsuki Blitzkampf http://www.youtube.com/watch?v=GYlsKtvFFeg.
480i for wii is the main goal, thats why i choose for sdl language.

thanks,

Rhade
Quote this message in a reply
Member
Posts: 26
Joined: 2008.08
Post: #5
Terrydil Wrote:there is an old, copy online I think

A copy of the OpenGL "Red Book" (i.e., the Programming Guide) can be found at http://glprogramming.com/red/, though I'm unsure of how legal that is, and, for another thing, it's (like Terrydill said) old and outdated. As far as I know, the latest is the sixth edition, and costs a good 60 American dollars (I don't know what that is in other currencies)

On another note, you can find the man pages for all the OpenGL functions via the Terminal (/Applications/Utilities/Terminal.app) -- just type "man [function name]".

Assuming that you don't know how to use "man", the keys are quite similar to Vi; j to scroll down, k to scroll up, q to quit, / to search for stuff, N to go to the next found search item. You can always try "man man," too, but it's a lot to digest.
Quote this message in a reply
Member
Posts: 26
Joined: 2008.08
Post: #6
Rhade Wrote:Hi, my engine will look more like this game Akatsuki Blitzkampf http://www.youtube.com/watch?v=GYlsKtvFFeg.
480i for wii is the main goal, thats why i choose for sdl language.

Listen to what ThemsAllTook said and buy yourself a copy of that K&R C book 'e posted a link to -- and don't get ahead of yourself with a Wii project. Nintendo doesn't just hand out dev kits, and I doubt if SDL is quite that portable. Start with simple command-line projects. Once you've got that "down pat", try to build a basic game engine of sorts, rather, just model a basic game structure and develop algorithms to power it.

And, like ThemsAllTook said, don't get discouraged for not having a game up and running quickly! It takes time!
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2008.06
Post: #7
aardvarc Wrote:Listen to what ThemsAllTook said and buy yourself a copy of that K&R C book 'e posted a link to -- and don't get ahead of yourself with a Wii project. Nintendo doesn't just hand out dev kits, and I doubt if SDL is quite that portable. Start with simple command-line projects. Once you've got that "down pat", try to build a basic game engine of sorts, rather, just model a basic game structure and develop algorithms to power it.

And, like ThemsAllTook said, don't get discouraged for not having a game up and running quickly! It takes time!

I'm not going for the wiiware, but for the homebrew channel that's my target. Super Mario War works also proper on the wii.
the engine will be like Akatsuki Blitzkampf. Is openglide right goal as language? I want to start building now a basic engine.
I will start with command line.

Thanks,

Rhade
Quote this message in a reply
Member
Posts: 26
Joined: 2008.08
Post: #8
The fact that I should've replied sooner aside, seeing how they -- that is, the hacker community -- has managed to get homebrew working on the Wii is pretty cool, but it'd be best if you stuck to the Mac (being as it'd be your development platform even if you chose to develop for the Wii) for now, at least.

For now, just write some simple C stuff -- though keep in mind that C isn't the only language out there -- and remember that you can very easily compile C code via your shell of choice. Just fire up terminal, cd to the directory where your code is, and type "gcc [source] -o [executable name]".
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2008.06
Post: #9
Oke, I have two weeks free now. Should I ony start with simple c and not opengl or command line? It will be developed on a macbook intel core duo 2. If I can create a team to build the engine how much time can it speed the progress for final stage?
http://www.youtube.com/watch?v=ybtplaTC9...re=related

Thanks,

Rhade
Quote this message in a reply
Member
Posts: 67
Joined: 2006.07
Post: #10
Like ThemsAllTook said, The C Programming Language is a good place to start. Another alternative is Learn C on the Macintosh by Dave Mark, although I don't know how up-to-date that one is. In essence, before you get into building the more advanced types of applications, including games, you're going to want to start with making command-line programs that run in Terminal.

As for how you'd write these simple C programs, there are several different ways. You can use a text editor if you like, but personally I'd recommend using Xcode, mainly because it has a code editor that offers helpful features like syntax highlighting that can help you write your code easier. A text editor can't offer that.

If you decide to use Xcode, the easiest way to write simple C programs for OS X would be to create projects of the type "Standard Tool" (found under the "Command Line Utility" section of the New Project window in the latest version of Xcode). Your programs will print out to the console that will automatically appear whenever you compile and run your code.

If you want to use a text editor, you'd write your code, save it as a .c file, and then use GCC in the way aardvarc described.

Like I said, using Xcode is much easier, since it takes care of a lot of these things for you, but you can do it in a text editor if you like.

Since when was "Fred" a placeholder variable?
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2008.06
Post: #11
I'll stop working for osx programming and dev on windows with xna for xboxlivearcade.

Thanks for all the comments,

Rhade
Quote this message in a reply
Member
Posts: 26
Joined: 2008.08
Post: #12
Forget everything I said regarding feasibility of homebrew development -- Datel has (I assume) recently unveiled what I consider a homebrew developer's dream -- a so-called"GameCube/Wii SD Media Launcher". Certainly worth checking out, though I don't know if it supports the Mac or what (though I would assume that you could just use the command line to handle SD cards).
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Upcoming Multiplatform Game Programming Book for Beginners JazonYamamoto 3 244 Apr 14, 2014 05:55 PM
Last Post: JustinFic
  Game engines with object programming JonnyThunder 3 7,845 Aug 16, 2010 10:42 AM
Last Post: SethWillits
  free mac game programming book jaked 4 6,355 Jun 8, 2009 12:48 AM
Last Post: SethWillits
  Game Programming Tutorial markvw 0 4,030 Jan 27, 2009 05:10 AM
Last Post: markvw
  Game Programming for iPhone? Help with Cocoa and MVC. holografix 7 6,199 Jan 22, 2009 08:17 AM
Last Post: AnotherJake