View Full Version : newbie C++ questions
Reanimated
05-23-2006, 02:17 PM
Hi,
I'm not sure if this goes here, or in Indie basics, so apologies if this is in the wrong forum. I've been using blitz3d and blitzmax for my games, but now I want to move on to c++. I'm quite familiar with Java so the actual transition shouldn't be too bad. However, there are some things that I'm confused about when it comes to game programming with C++. I've heard of libraries such as SDL and Allegro, but I'm lost as to what they actually do. From what I've gathered, it's a case of them allowing access to user input, graphics etc.. If so, why doesn't C++ have this already integrated into it, like Java's Scanner class for input? At the moment, I'm downloading Visual C++ express edition, which is free (something a student likes to hear :D ), and was wondering whether I should also download allegro or SDL to accompany it? Which one, or any other library, is probably the best. I recall PopCap/GarageGames having a framework (other than Torque), but I am be wrong. Is coding with frameworks/libraries such as these quite easy if your familiar with Java programming and OOP paradigm?
Thanks (sorry, quite a few questions there)
lennard
05-23-2006, 03:11 PM
C++ is a traditional computer language with which you can create anything. Having it bind to and control the hardware isn't it's job.
Think of it this way - your C++ code will control the logic of your game but the machine specific code (an SDK like Open GL, Direct X, PopCap's framework) for I/O will require lower level code that will allow you to control machine specific features that C++ doesn't know anything about. You will use C++ code to tell the SDK what you want to happen ie. play this 3d sound effect at a given time - but then the machine specific code within that SDK needs to take over. Having this all be built into C++ in some kind of abstracted way would make C++ much bigger than it should be and also limit manufacturers to building new widgets that only supplied known functionality. For example, when a 3d hardware card company puts out a card with a fancy new shader then it also provides you with an SDK so you can program that shader directly, If all the functionality for shaders was prebuilt into C++ then, well, we wouldn't actually have shaders because they were invented after C++ was written.
The good news is that all of the simple functionality needed to write casual games is abstracted in all of the SDK's you are considering. If I was starting today then I personally would look at the Garage Games framework because it gives you Mac. support.
Good luck.
mahlzeit
05-23-2006, 03:26 PM
why doesn't C++ have this already integrated into it, like Java's Scanner class for input?
That's one of the advantages to using Java: you get a whole lot of stuff that has already been written for you. That stuff usually also exists for C++, but you have to go out and get it yourself and get everything to work together smoothly. Actually, that's true for Java sometimes too: LWJGL (a popular Java game programming library), for example, doesn't come standard with Java.
In any case, if I was you, I'd use the PopCap framework. It's free and complete. If you use SDL, you'll have to implement a lot of other stuff on top of that. The PopCap framework already has all that, so why reinvent the wheel...
dmikesell
05-23-2006, 04:21 PM
Yes, the creators/maintainers of C++ have definitely opted for a lean, light standard library. Fortunately, there are mature, portable libraries available for applications, like wxWidgets for windowing, OpenGL for graphics, libwww for networking, etc. It is more convenient having everything at your fingertips, but it tends to bloat the language.
ggambett
05-23-2006, 04:49 PM
I'm not sure if this goes here, or in Indie basics, so apologies if this is in the wrong forum.
This thread probably doesn't belong anywhere in IndieGamer, because the focus is games, not programming. GameDev.net or a C++ specific forum will probably be way more useful for you.
why doesn't C++ have this already integrated into it, like Java's Scanner class for input?
What you call Java is actually Java plus a big class library. C++ is a language plus a lower level library. I actually feel better having the option to choose what library I want to use, if any, than having one forced on me. As with many other things, this is also a very personal preference :)
NemesisPica
05-23-2006, 07:03 PM
If you use SDL, you'll have to implement a lot of other stuff on top of that. The PopCap framework already has all that, so why reinvent the wheel...
That is true.I had used SDL to write some little game.When come to design GUI,I put down SDL a while and go to try PopCap framework.
Only a few day later,I have completed the prototype of my game !!
For the C++ question,Reanimated you can think even the SDL libraries is writed by C. You can use C++ to write your own libraries for processing game graphics,sounds,windows,blahblah. But I think it is hard and not as fun as writing game. Yes , no need to reinvent the wheel,except you have interest.
Reanimated
05-24-2006, 01:05 AM
Thanks for the replies. The PopCap framework looks like it's what I need, but the torque 2D engine seems interesting as well. However, they haven't released a demo of torque 2d which is a bit annoying, and so I can only change some of the scripting code. I'll play around with PopCap / general C++. Thanks again.
Vectrex
05-28-2006, 04:35 AM
if you need 3d use www.ogre3d.org and check the wiki for beginner tutes.
electronicStar
05-28-2006, 04:25 PM
After a big loop you'll eventualy get back to the blitz basics :D
Reanimated
05-28-2006, 04:51 PM
Ogre3d looks really good. I remember reading about it before, but it completely slipped my mind. What do major devs use? Do they create their own framework for their game?
After a big loop you'll eventualy get back to the blitz basics
lol I wont be surprised :D
Sybixsus
05-28-2006, 05:48 PM
Popcap's framework is very nice, but I really don't like the way it's organised. Far too complicated for a beginner too, I would wager.
My favourite, and very, very easy for beginners, is Haaf's Game Engine. Personally I'm using it with BlitzMax because I don't see any advantage to using C++ with it, but it's designed to be used with C++ so that'll work well.
It's a good one to start with as it does a lot for you, and doesn't take much learning. It wraps Bass for Audio, so you can play music and sounds just as easily as in Blitz ( except it supports more mod formats ) and has useful built in stuff like automatically loading from zip archives ( literally automatically ) and ini file handling.
http://hge.relishgames.com
EDIT: And I just noticed I'm listed as a testimonial for the engine on account of a previous recommendation for it I made on these forums, lol.
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.