Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL

Started by Spire Games May 13, 2009 at 1:24 PM 3 replies 1.2k views
Original Post
Spire Games
Spire Games
My friend and I are thinking about creating a simple 2D top down RTS in C++. To start out, we are designing a game engine that suits are needs, with basic abilities and pointers to all the necessary objects. Conceptually, we understand the code extremely well, but not so much in terms of syntax and actual coding. To fix this we are both taking a month-long C++ course soon which will hopefully allow us to start work. I already know a bit about coding, having taken a short class last summer, but not enough to do any actual game programming other than the shell. Anyways, here is my question. I use Visual C++ Express 2008, and I encountered a problem very early in the programming process. When you click new project, there are a certain number of options you can choose from, such as "Empty Project", "Win32 Console Application", etc. However, I went through all of these options and all the ones I could get to work gave me a console when they ran. What I want is just a blank window, not a console, just a blank window that I can display images on and use to create a simple graphical prototype of our game. What am I doing wrong? Is there another option I haven't seen that gives me a blank screen to work with, resize, display images upon, etc? Is there some library or similar tool that I should be working with to allow this stuff? Sorry if this seems like a simple question, but I haven't found the answer anywhere else. I found SDL which seems pretty cool and does manage to give me a window, but it seems to be based on displaying images and not much else, which isn't really what I want, or is it? All help is appreciated, thanks again. -Spire Games
rip-off
rip-off
Well, most 2D games are simply displaying images. You can do more advanced 2D effects using OpenGL, but I don't know if that fits with your description of a "simple" RTS game.

I think you will find SDL is very good for writing 2D games.

There are two important points I am going to make now.

The first is that if you are not comfortable with C++, you will find it extremely difficult working on such an ambitious project initially. A month long C++ course should get you the basics, but there are certain things you only learn by working with programs bigger than a certain size.

Things like how to design something complex like a game engine (this is the second point). I strongly recommend throwing away the idea of making your own game engine. Read this for some good reasons.

If you are familiar with how to design large systems (maybe you have used a different programming language before), I would still advise against trying to write an engine in isolation. Just write your game, if the design you come up with is fairly good you will find you can reuse parts of it later.

If you are not familiar with large system design, I would recommend that you make some smaller games first. You need to learn how to walk before learning how to run.
TheHighPriestess
TheHighPriestess
It sounds like the first step you've taken is to go in over your head.

Anyway, the "Window" you seek is really just a construct within an existing API. If you're working specifically with Windows, that window is something you'd have to set up within the win32 API or with DirectX. SDL does this for you, but if you're only using SDL then you won't be accessing everything available in the win32 API like menus, buttons, etc.. However, if you're making a game with PNG images and sounds, then SDL should suffice for you.

Check out Lazy Foo's SDL tutorials for a good way of at least previewing the sorts of code you'll be handling to do your graphics displaying and manipulation. The closest thing I have to a WYSIWYG editor is a book of graph paper and GIMP for doing a rough draft.
Spire Games
Spire Games
Thank you both for the replies, they were actually quite helpful. I managed to use your advice to finally get SDL set up and running. I quite like it, and it seems to be very useful and simple to adjust to, and at the same time it has a decent amount of power behind it. I took Lazy Foo's tutorials along with a few other ones, and got a very simple game up and running. I actually learned a lot about what I know and what I only think I know from this entire endeavor, and a bit about good coding as well.

Also, I am interested in some more advanced tutorials, or even just other good tutorials that I could learn more from, both SDL and OpenGL.

My only beef with SDL is that it is a bit low level for what I am ultimately trying to do. Instead of asking for a higher level library, which I know that OpenGL is, I will instead ask a broader question, so that I can learn as much as possible, which is my ultimate goal. Where should I go now? Am I headed down the right path as far as what projects I am trying to tackle first? What should I be trying to learn or create? What skills will be useful to me as a game designer? I just want to know if I am doing the entirely wrong thing here or if I should just modify my course a little bit. Maybe this is the wrong thread to be asking these questions in, but I don't really know where to ask them.

Thank you!

Ezbez
Ezbez
An alternative to SDL and/or OpenGL is to use SFML. It's very SDL-esque, but provides just that extra amount of functionality and speed to make most simple, 2D uses of OpenGL unnecessary. Namely, it provides you with fast rotation and scaling of sprites, which is a must for many games and would require you to muck around in OpenGL with SDL.

And the best part is that if you find out that you need more functionality, it's easy enough to pop right into OpenGL and implement it yourself alongside all the functionality that SFML provides.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.