Sign in to follow this  
Fractalux

Advice in starting 2D game programming

Recommended Posts

Fractalux    102
I need help in starting on 2D game programming. I consider myself to be an intermediate programmer with roughly 3 years (not in school years; I mean allocated over classes, internships, and self-taught projects) of programming experience with the C family of languages (excluding Objective-C), JavaScript, and just recently Java and HTML5.

I've never done any game programming. Closest thing to it is some graphics exercises in a textbook, but I want to start now that I have a free summer. What I want to know is what is my next step?

I did some research (googling considered research?) and stumbled on this site so I decided to post. If I am not mistaken a good place to start with 2D programming would be Flash (and HTML5?), pygame, and SFML?

Ultimately, I want to program a game in a similar form to a 16-bit era 2D sidescroller but with updated graphics like Braid or Rayman Origins and then move over to a 3D sidescroller like New Super Mario Bros. or Trine with a full team. What would be a great starting point for this? I don't mind if I have to start very basic, like actually programming a 16-bit game or a simple 1 to 2 level pseudogame. I am comfortable (mentally/psychologically but of course not physicaly) coding/debugging for prolonged hours of time with a textbook on my desk. So the preferred method of learning would be a textbook and practice.

I am a bit short on cash so any open source/free/reduced education pricing software to aid in programming the game would be grealty appreciated. Hardware is of no concern at this stage since I am just looking to code for mac/windows computers (eventually iOS [Though I would need to learn Objective-C first] and consoles maybe).

So where do I start?

Share this post


Link to post
Share on other sites
pressgreen    678
If you are already familiar with the C family I would jump right into Opengl with C++ or C#. there are a plethora of tutorials online that can get you started quite quickly with 2D side scrolling level of graphics. opengl 2.0 es is used for the iphone apps and there are alot of quite user friendly tutorials on setting that up. also the [url="http://www.glprogramming.com/red/"]Opengl Red book[/url] is free online if you are trying to save money and it will also help get you started. I also would recomend this route because as your skills grow the C++ language and openglAPI will allow your growth rather then potentially limit you. Nehe also uses many out dated techniques is also a great sorce to get your understanding of opengl and game programing in general up to speed. specifically [url="http://nehe.gamedev.net/tutorial/picking_alpha_blending_alpha_testing_sorting/16005/"]this[/url] Nehe tutorial would help you with the basics of how potentially a side scroler could be set up from textures to moving objects. also if you wanted a mario 16 bit look to the game you can just make textures in photoshop or gimp that have that look and apply them to your flat geometry with that set up. others will give you potentially different advice and it could be valid but this is what i would recomend. any ways good luck Edited by greenzone

Share this post


Link to post
Share on other sites
BeerNutts    4400
Honestly, I wouldn't get into OpenGL to begin with. Start with a simple API, like [url="http://sfml-dev.org"]SFML[/url] for C++. It does everything you want in terms of 2D graphics, and it provides most of the other tools needed to make a game: Input, Audio, Windows, Networking, and Graphics.

The link to my old blog (in my sig) details steps I took to make a 2d game using C++, CodeBlocks, chipmunk-physics (as my 2d physics engine). However, Serapth has a blog that he details creating Pong using SFML which is more beginner oriented: [url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]http://www.gamefroms...PP-Edition.aspx[/url]
(Be Aware, his tutorial might still be based on SFML v1.6, whereas SFML v2.0 is the latest release, and I'd suggest using it)

Good Luck

Share this post


Link to post
Share on other sites
Fractalux    102
[quote name='greenzone' timestamp='1340242987' post='4951187']
If you are already familiar with the C family I would jump right into Opengl with C++ or C#. others will give you potentially different advice and it could be valid but this is what i would recomend. any ways good luck
[/quote]

[quote name='BeerNutts' timestamp='1340252081' post='4951210']
Honestly, I wouldn't get into OpenGL to begin with. Start with a simple API, like [url="http://sfml-dev.org"]SFML[/url] for C++. It does everything you want in terms of 2D graphics, and it provides most of the other tools needed to make a game: Input, Audio, Windows, Networking, and Graphics.

Good Luck
[/quote]

These are two conflicting suggestions but I like the potential for growth greenzone mentioned taking his method. This is however subjective to what is written among these posts and I still have my own research to do before I chose a formidable option. So I'll take a look at both before deciding which route to commit to. Thanks.

[quote name='szecs' timestamp='1340257187' post='4951226']
Start by doing. start wit smaller games, like Pong, Tetris, Breakout etc.
[/quote]

I always take the basics to be fundamentally important to every skill. Thanks.

Share this post


Link to post
Share on other sites
6677    1054
C# is primarily a windows language but thanks to mono can be coerced into running mac, windows and linux. I think mono also works on solaris and BSD. Mono has iOS and android ports (monotouch and monodroid respectively) however unlike regular mono these aren't open source and I believe are about $500 each.

C# isn't a brilliant beginners language though. VB.net is very similar syntax but much easier. Jumping in at the deep end with game programming with no prior programming experience will probably just make you want to quit.
My recommendation:
Assuming your on windows, download VB.net express from microsoft. Learn how to write code in that.
Somewhere much further down the line download C# express, install it AND then install XNA (its order specific)
Play around in C# for a bit just to familiarise yourself.
XNA is a very good rendering framework that also has excellent sound and input libraries. XNA projects will run on windows XP and above, windows phone 7 and xbox 360. It works very nicely for 2D (which is what I'm doing at the moment) and where its not really a full engine it can be forced to do just about any task involving rendering so its not limited to making games. It doesn't work with mac or linux unforuneately but theres other frameworks that are cross platform but not as easy to deal with as xna.

Share this post


Link to post
Share on other sites
Kasbe    106
I would like to add [url="http://www.libsdl.org"]SDL[/url] with C++ to the list. There's plenty of game development related tutorials out there, and I've found it very intuitive and easy to use, yet powerful.

Share this post


Link to post
Share on other sites
ASnogarD    212
One thing to note is both SDL and SFML have the ability to let you use OpenGL, so you dont need to give up on OpenGL if you go SFML or SDL, and as SFML and SDL are both 2D focused and allow for relatively easy access to all you will need to make 2D games they mesh up nicely with your stated goals.

"[i]Ultimately, I want to program a game in a similar form to a 16-bit era 2D sidescroller but with updated graphics like Braid or Rayman Origins and then move over to a 3D sidescroller like New Super Mario Bros. or Trine with a full team[/i]"

Share this post


Link to post
Share on other sites
Fractalux    102
[quote name='6677' timestamp='1340269117' post='4951267']
C# isn't a brilliant beginners language though. VB.net is very similar syntax but much easier. Jumping in at the deep end with game programming with no prior programming experience will probably just make you want to quit.
It doesn't work with mac or linux unforuneately but theres other frameworks that are cross platform but not as easy to deal with as xna.
[/quote]

I forgot to mention it but VB was the language I was first introduced to and yes it was fairly easy. I also have some experience with C# but I did not want to go the XNA route because of what you mentioned. Thank you for the advice nonetheless.

[quote name='Kasbe' timestamp='1340269575' post='4951271']
I would like to add [url="http://www.libsdl.org"]SDL[/url] with C++ to the list. There's plenty of game development related tutorials out there, and I've found it very intuitive and easy to use, yet powerful.
[/quote]
[quote name='ASnogarD' timestamp='1340302462' post='4951444']
One thing to note is both SDL and SFML have the ability to let you use OpenGL, so you dont need to give up on OpenGL if you go SFML or SDL, and as SFML and SDL are both 2D focused and allow for relatively easy access to all you will need to make 2D games they mesh up nicely with your stated goals.

"[i]Ultimately, I want to program a game in a similar form to a 16-bit era 2D sidescroller but with updated graphics like Braid or Rayman Origins and then move over to a 3D sidescroller like New Super Mario Bros. or Trine with a full team[/i]"
[/quote]

If that is the case then I'll most likely start with sfml/sdl (since I am most comfortable with C++) and when needed/wanted I'll look into OpenGL, but does anyone know any books I can buy to help? I know I can find countless tutorials but I would prefer a book if possible. Thank you all for the suggestions.

Share this post


Link to post
Share on other sites
ASnogarD    212
The only book I know of for SDL is Focus on SDL, but I cant vouch for how good it is.
I would suggest IF you go SDL , visit :

http://lazyfoo.net/index.php for good tutorials and tricks , plus articles.
http://www.sdltutorials.com/ for some more SDL based techniques

or for SFML you could try

http://www.gamefromscratch.com/

Both SDL and SFML have lots of online resources but I doubt you will find many books to read through on the subject.

Hope that helps some.

Share this post


Link to post
Share on other sites
SDL and www.lazyfoo.net

His tutorials are amazing for setting up the environment, and understanding the basic logic and flow of a game. Each tutorial adds a new game element to your toolbelt, and by the end you are able to recreate just about anything.

I had a game programming class in college that followed his tutorials and it was awesome. By the end of the semester we had made breakout, bejweled, space invaders, and a custom project (I re-made super mario for the snes (only the first couple levels though)). It was a quite rewarding experience. I cannot recommend SDL and lazyfoo strongly enough.

Share this post


Link to post
Share on other sites
birko19    151
Here are the options I have used for 2D game development:

- C# with XNA (This is my current favorite).
- C++ with SFML.
- C++ with SDL.
- Python with Pygame.

I know XNA might turn you off based on its lack of platform options, but imo it's the best out of the four I tried when it came to productivity. I also have tried C++ with OpenGL alone but this might not be your best option since OpenGL only handles graphics, you would need something else to handle input, sound, etc. Edited by birko19

Share this post


Link to post
Share on other sites
Fractalux    102
[quote name='ASnogarD' timestamp='1340313124' post='4951499']
The only book I know of for SDL is Focus on SDL, but I cant vouch for how good it is.
I would suggest IF you go SDL , visit :

http://lazyfoo.net/index.php for good tutorials and tricks , plus articles.
http://www.sdltutorials.com/ for some more SDL based techniques

or for SFML you could try

http://www.gamefromscratch.com/

Both SDL and SFML have lots of online resources but I doubt you will find many books to read through on the subject.

Hope that helps some.
[/quote]

Yes it does help, thank you, and based solely on reviews the book doesn't seem all that detailed in specifics but provides an overview of SDL itself.

[quote name='martinis_shaken' timestamp='1340378348' post='4951760']
SDL and www.lazyfoo.net

His tutorials are amazing for setting up the environment, and understanding the basic logic and flow of a game. Each tutorial adds a new game element to your toolbelt, and by the end you are able to recreate just about anything.

I cannot recommend SDL and lazyfoo strongly enough.
[/quote]

I've already set up sdl but have not had a chance to code. Will start on the rest of the tutorials on Monday after a short weekend off.

[quote name='birko19' timestamp='1340399131' post='4951839']
I know XNA might turn you off based on its lack of platform options, but imo it's the best out of the four I tried when it came to productivity. I also have tried C++ with OpenGL alone but this might not be your best option since OpenGL only handles graphics, you would need something else to handle input, sound, etc.
[/quote]

Actually my main reason for putting of XNA development is because my school offers a course in it and I'd much rather learn something a course at my school won't teach. Also I found out a graphics class using OpenGL is being taught as well so I will be signing up for it next quarter. But for now I will be learning SDL/SFML through tutorials.

Share this post


Link to post
Share on other sites
I also recommend openGL. And SDL works well with openGL, I actually used them together for a long time, until recently when I switched to GLFW, which is light-weght and everything you need for a good openGL base.

So yes, I would say SDL and openGL.

Using openGL for 2D stuff also teaches you how to do the same thing in 3D (in a sense, because openGL is the same whether you use 2 or 3 dimensions, really), at no extra cost, so for that reason it's great.

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