Advice in starting 2D game programming

Started by
12 comments, last by antiHUMANDesigns 11 years, 10 months ago
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?
Advertisement
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 Opengl Red book 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 this 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
J-GREEN

Greenpanoply
Honestly, I wouldn't get into OpenGL to begin with. Start with a simple API, like SFML 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: http://www.gamefroms...PP-Edition.aspx
(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

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Start by doing. start wit smaller games, like Pong, Tetris, Breakout etc.

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



Honestly, I wouldn't get into OpenGL to begin with. Start with a simple API, like SFML 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


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.


Start by doing. start wit smaller games, like Pong, Tetris, Breakout etc.


I always take the basics to be fundamentally important to every skill. Thanks.
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.
I would like to add SDL 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.
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.

"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"

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.


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.


I would like to add SDL 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.


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.

"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"


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

This topic is closed to new replies.

Advertisement