Sign in to follow this  
Nahrix

Question: Moving from text to 2D

Recommended Posts

Nahrix    237
Hello everyone. I've come here to humbly request your advice. I've studied C++ in highschool, and now, three years after graduating, have come back to relearn what I've mostly forgotten. Tons of online resources and a couple of books later, and I'm right back on track. Using Visual C++ 6, I've made a few text-based games, and now I want to start learning how to make a 2D game, such as the recommended Tetris clone, or a simulation game of sorts. I have a problem, though: I have no idea where to begin. I've assumed that learning DirectX would be a proper start, yet, after researching for several days, I haven't managed to dig up any useful (or should I say, understandable) information. MSDN's DirectX reference, for example, is filled with terms of which less than 1/4 I can only vaguely comprehend. This is the point at which I've realized that a noobie such as I shouldn't make assumptions of where I should go, and what I should learn first. Thus, I ask you to please help out a poor, fletchling programmer. Where can I go to get this Tetris game started? How do you seperate rendering frames from input? How do you render a frame at all? What -is- the meaning of life?

Share this post


Link to post
Share on other sites
Toadhead    244
You will need to learn a library.
These librarys will have classes and functions that you can use. you can create windows with bit, draw images etc.

to give some examples of librarys: DirectX (has many parts: DirectInput, Direct3D, DirectPlay, DirectSound etc.), SDL, OpenGL, Allegro, Win32 etc.

I started with SDL, its simple, and cross platform. DirectX programs can only be executed on a windows machine. OpenGL is a cross platform D3D (Direct3D) liked library. It can be used for graphics (like 3D stuff).

Personaly I wouldnt start with DirectX if I was you. I would start with the win32 library if you only want to make programs for windows, or SDL or allegro if you want to create programs that are cross platform (programs that can be executed on more OS like Windows, Linux, Unix, Mac etc.) I would suggest to start out with SDL. It would be a good thing to learn OpenGL later becuase it works quite good in combination with SDL.

DirectX and OpenGL are however difficult to learn, so again: I wouldn;t start with them. Learn them later and start with something more easey.

Do with my info what you want.

Greetings,
Rob

Share this post


Link to post
Share on other sites
Nahrix    237
Thank you very much for your input, Toadhead/Rob. I did know that DirectX is Windows OS specific, but I chose it under the impression that it was the easiest to learn. I will follow your advice, and instead learn Win32, SDL, and finally both OpenGL and DirectX.

What does SDL stand for, by the way?

Share this post


Link to post
Share on other sites
Bart and Emer    122
Quote:
Original post by Nahrix
What does SDL stand for, by the way?



Simple DirectMedia Layer

i would suggest to start with SDL. Windows programming is more involed.
in SDL only a few lines of code is need to setup a window, but in windows programming it takes around 50 lines of code to get the same results.

Share this post


Link to post
Share on other sites
Rob Loach    1504
I'd go with SDL as well. Gets you quickly into graphics which can not only help you learn the language and drawing methods, but also motivates you to continue your learning. I have some introductory tutorials on my site. Help yourself.

Share this post


Link to post
Share on other sites
Nahrix    237
Everyone's help is extremely welcome, and I'm grateful for the advice given. As of now, I'm browsing this site to set up SDL with a Visual C++ 6 project.

Hopefully everything goes smoothly.

Share this post


Link to post
Share on other sites
ols    128
Just thought I would add my experience as I have recently done just what you are intending.

Contrary to everyone elses opinions - although they are undoubtedly correct! - I decided to learn DirectX rather than SDL or similar. It is a right-royal-pain-in-the-arse to set up at first, but I have found it pretty easy once everything is up and running.

Currently working on a 2D top-down driving game (http://members.gamedev.net/ols/journal). If you want any help with 2D stuff let me know

Ols

Share this post


Link to post
Share on other sites
thec    212
A friend of mine has written a few articles using SDL, which is located here: Sol's tutorials

I think they are pretty good and it's farily newly written so chances are you can ask him about more tutorials as you go on to the last one.

Let him know what you think too, that's important!
Albert

Share this post


Link to post
Share on other sites
h2mprod    122
*agrees with ols*

imo using direct x, or any api for that matter, to make a 2d game is somewhat trivial in the sense that all you really need from the api is to figure out is how to draw a picture to the screen. of course after you figure out how to draw it to the screen you can do all kinds of fancy things with it, but if you're going for simplicity that's all you need

Share this post


Link to post
Share on other sites
Alpha_ProgDes    6936
http://www.gamedev.net/community/forums/forum.asp?forum_id=33
Tetris Tutorial (using DirectDraw 7.0)

http://www.gamedev.net/community/forums/topic.asp?topic_id=300750
putting text in a game (using Win32 and DirectDraw)



edit: added APIs to show OP

[Edited by - Alpha_ProgDes on February 15, 2005 1:55:58 AM]

Share this post


Link to post
Share on other sites
leiavoia    960
I agree that SDL is easiest to pick up. I went from knowing nothing about graphics to having a simple graphical front-end to my game map in about 6 hours with SDL. Not bad! I would not recommend you learn Win32, DirectX, etc at this point. If you learn SDL, you can piggyback that with OpenGL in the future to simplify window management and input for OpenGL based apps.

Please read the Cone3D tutorials on SDL also. They are not the best code in the world, but they will get you on your feet.

Share this post


Link to post
Share on other sites
Nahrix    237
Well, it seems as though there is a mixed content of suggestion in the replies. On one side, some people believe that DirectX is best to start with, and on the other, SDL comes on top.

I have come to the conclusion that perhaps it isn't out of the question to go ahead and give both of them a chance! As seen above, many of you have provided helpful links to the SDL API. If it isn't too much to ask, I was wondering if anyone knew of any such links relevant to starting an application using the DirectX API for simple 2D sprite display, frame ticking, and whatever other terms I can pull out of nowhere, considering I don't know what I'm talking about :)

Thank you for the replies above, and thank you in advance for any further information pertaining to DirectX.

Share this post


Link to post
Share on other sites
thec    212
SDL maps 2d and 3d (though open gl) on many different platforms, which can definitively be on the plus side if you plan on doing linux or mac deveopment in the future. SDL helps you with setting up opengl or software mode and it sure is easier than dealing with DirectX.

DirectX is pretty much windows (alright, xbox too) only, but some prefer this over open gl. Both are about equally good.

Albert

Share this post


Link to post
Share on other sites
Telastyn    3777
Add one to the DirectX camp.

Getting 2d working nicely was a little frustrating as you describe, but it's only a little bit. A few questions to the forums here and about a week of re-writing as you learn what to-do what not-to-do and you're done and never have to touch it again. It's a lot like setting up windows apps for the first time. Frustrating, but once it's done, you've learned a lot of re-usable stuff, and you can ignore it and get working on the game.

DrunkenHyena is a member here, and has many tutorials which are more English than most.

Share this post


Link to post
Share on other sites
Boder    938
I say start with SDL. Especially if you just want to learn a little about 2d graphics and your just starting out, trying to get a simple game working, go with SDL. There is a large SDL community for making 2d games.

Direct3D is very powerful and fast. Once you get up and running it can be real simple if you mainly use the D3DXSprite class. But DX has a monster SDK, lots of stuff you probably won't use, and only runs on windows. I will say the API is pretty nice and the documentation is top-notch. But the initialization just might not be worth it for you at this stage, how much experience do you have with the Win32 API?

SDL has a good community, lots of indie developers making 2d games, a lot of people on Linux. Very easy to get up and running and very easy to continue running. You get cross-platformability, a C-style API (I don't know what your style is), and tons of open source games to learn from.

Then you realize you might need to do more than just graphics, like loading images, drawing text, playing music, playing sounds, networking, etc.... and SDL has lots of add-on libraries for each of these requirements. DirectX is a slough of different low-level libraries, so you also get sound stuff and the D3DX part is pretty good for loading images, but for I don't think DirectPlay is supported anymore, and there is a text-rendering part in D3DX I believe.

Anyway, I would say start with SDL.After you learn a lot (and you won't be quite as frustrated) you might decide to move to OpenGL or Direct3D, and picking it up will be easier with the knowledge you gained. You knock out a noticeable portion of users when you stick to Windows only (with regard to indepently developed 2d games in this day).[cool]

Share this post


Link to post
Share on other sites
ols    128
I paid for a tutorial on DirectX using www.gameinstitute.com, which I found very useful, but there is a load of information you can find online about setting it up and then using it for 2D work.

Personally I havent used a specific guide/tutorial but there are loads of them online such as:
http://www.gametutorials.com/gtstore/c-5-directx.aspx
http://www.gamedev.net/reference/list.asp?categoryid=24
and there are loads of others around. The gametutorials is probably as good a place as any to start you off. Oooh, as i am writing this I have just seen that they are now starting to charge for tutorials. Will leave the link up there though!

Just had a quick look for other sites to link to:
http://www.gamels.net/index.php?dirID=10 - this has a few links inclduing the very useful looking http://www.c-unit.com/index.php?page=tutorials

Hope this gives you a bit of start

Ols

Share this post


Link to post
Share on other sites
G_D_G    122
A lot of people suggested using SDL, and I'm agree.
Keep in mind, however: SDL is a relatively low-level library (working with things like video pixel buffers and raw audio data). If you want to write some very basic Windows games, standart Windows GDI functions probably may be easier to use.

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