Here's the deal, /prog/. Over the winter break, I have decided I want to practice and expand my skills, and as such, design a small applet type game using C++. Now, i am fluent in C++, and MFC, but MFC wouldn't exactly be ideal for this. I fully intend for the game to be 2D Sprite based.
What should I look into, what should I use, and how should I go about things? I've heard openGL would work well, is there anything else I ought to remain cognizant of?
Name:
Anonymous2007-12-21 20:45
Look into SDL or Allegro. OpenGL, while powerful, might be a bit too much for a small 2d project.
>>2
I disagree. SDL is software-bound and going to be fill-rate limited; for applications using anything bigger than a 800x600 primary surface just the clear call is going to be slow as fuck compared to a glClear. OpenGL, even in immediate mode, is both faster and more scalable than rendering with SDL.
Arguably, SDL is probably better to start with if you've never done any graphics stuff before, but it represents a rendering paradigm that was phased out half a decade ago. No one bitblts anymore.
I've never used Allegro, so I can't comment on that.
Name:
Anonymous2007-12-21 21:07
Hmm. Well, previous experience was in MFC, we used bitblts for that. I think we used MFC for socketing and, well, I can't recall what else. Managed to make a decent game in it, but everyone else I know reccomends against it.
The game isn't planned to be top end or anything particularly special, mind you, more or less an exercise in c++.
>>4
Well, my point was that the win32 implementation of SDL's rendering components is just a wrapper around DirectDraw, so (assuming you use all software surfaces) you probably won't get much better performance than just using bitblt. And SDL's hardware surface support is absolute shit; you have to either sacrifice alpha blending (because IIRC SDL handles all alpha shit in software anyway), or deal with the GPU<->CPU pipe bottlenecking.
Personally though, I've never really thought games to be particularly useful for learning language features, simply because you can use a little bit of knowledge and hack them together fairly easily and still come out with something nice.
I dunno; it all comes down to what you want to do. I'd definitely recommend OpenGL for rendering, but futhermore, I'd recommend taking a look at the Boost libraries (if you already haven't). They provide a bunch of language functionality (through template hacks): smart pointers, pointer containers, functors that aren't raw pointers, closures, etc. Almost makes C++ usable as a language, lawds.
>>1
Why would you possibly choose C++ as a language to do fun projects in in your spare time?
Name:
Anonymous2007-12-21 22:27
>>5 Personally though, I've never really thought games to be particularly useful for learning language features, simply because you can use a little bit of knowledge and hack them together fairly easily and still come out with something nice.
This is very true. It depends on how far you want to take the game though. As a senior in high school I hacked together a little scrolling game in VB (GDI for drawing, iirc) as my final project. It was terrible code, but it did what it was supposed to do. I couldn't have expanded it easily. If OP is thinking of doing something like that, it's a waste of time unless OP is very nub indeed.
On the other hand, if OP is planning on adding some fancy stuff, figuring out how to do that could be a good exercise. Maybe if the characters were flexible instead of sprite based it would be worthwhile.
>>5
And perhaps, but what else to build? I need something to push me forward, and if it would make a decent portfolio piece, all the better. And I will take a look at Boost, definitely. And well, as to what I wanna do? Just make an ordinary 2D sprite game, not sure what else to add to that. Just something easy that I can make look somewhat polished, and that I can do with the low experience I have.
Name:
Anonymous2007-12-21 22:39
Define flexible. I am admittedly rather nub, having only done a small handful of visual projects, and never getting my hands on as much code as I would like. But I would intend for this to require at least some work, ie: no scroller shooters, simple top down games and such. I'm likely going to make a platformer, and see how much depth I could add, and something easily expandable. The fact that I haven't really worked with Visual C++ outside of MFC is probably the strongest indicator of where I currently lie.
Name:
Anonymous2007-12-21 22:42
>>10
By flexible, I mean animating characters based on their surroundings rather than just dropping an appropriate bitmap in. Sort of a 2d ragdoll thing, but without the rag part. No, I'm not sure how you might do this. It's just the first thing that popped into my head.
Name:
Anonymous2007-12-21 23:07
Hmm, would be interesting. Now I want to give that a shot, but I feel I could probably develop an algorithm that would get the job done. Coding that would not be hard, all the work would be in the algorithm that determines joints and simulates flexibility and such. I just need to dive into code and do something, really. Though I likely would tackle that later on.
Name:
Anonymous2007-12-22 2:30
Write a game for the GameBoy Advance or something. It'll be in C++ and you can use call real hardware sprites and shit instead of dicking with the everything-is-a-framebuffer issue of PC land. Plus, it's a lot easier to design something for a constrained platform than for an open-ended PC that can do anything.
>>13
I've done a couple of projects on the DS hardware, and to be honest, setting the shit up and figuring out the basics is a real pain in the ass. Once you get it up and running, it's a lot better (I never actually got the DS gdb stub working though, so debugging was a bitch and a half).
>>9,10,12
Well, I would argue that your definition of "language practice" is a bit too broad. I would classify algorithm design as language-agnostic; algorithm implementation is practice.
At the same time though, doing anything with a language is practice in itself.
If you really want to pick up some of what some people call the ``finer aspects'' of the language, then I'd recommend picking up a book like Modern C++ Design, Exceptional C++ (or any in that series), C++ Coding Standards, and C++ Metaprogramming Concepts. You'd be surprised how much shit you'll learn from reading that stuff (that you probably won't pick up from just winging it on your own).
Pretty soon you'll be winging around closures and shit and wonder why you're not using a language which actually has working features. lawds.
Name:
Anonymous2007-12-22 3:08
SDL, as I understand it, is hardware accelerated, and has been for the last year or so. It will, however, fallback to software for anything not being reported as doable by the hardware. You can also extend it with OpenGL. For a simple game, assuming relatively modern hardware, graphics acceleration shouldn't be a big deal anyway. Just my two cents, best of luck OP.
Name:
Anonymous2007-12-22 3:16
>>14 No one cares what languages you like/dislike. GTFO.
>>16
Thanks for the material, I'll definitely look it up. Though I still don't care about your thoughts on C++
>>18 No one cares what languages you like/dislike.
If this statement were true, this board would not exist.
Name:
Anonymous2007-12-22 3:21
>>15
Yeah, I know. I can't blame you for that. But maybe OP can be induced to adopt a proper attitude towards the language.
>>17 SDL, as I understand it, is hardware accelerated
Last I heard it was hardware-accelerated-ish. On some (possibly most) systems you can get surfaces that reside in video memory, but the advantages of doing so are nebulous, since the speed gains may not be what you hope. Unless they've got it doing alpha blending in hardware or something. Do you have newer information than me?
But with OpenGL, you should get the same hardware acceleration you get with plain old OpenGL. In which case you might as well just use that.
Not that I'm against SDL. I like it, and use it for my 2d stuff, but be aware that neither do you necessarily have 2d stuff in hardware, nor do you necessarily want/need it to be so.
Name:
Anonymous2007-12-22 3:26
>>18 THERE CAN BE NO DISCUSSION ABOUT THE RELATIVE MERITS OF COMPUTER LANGUAGES
C++ is absolute garbage in every way. Deal with it.
>>18
(Off topic)
Just a tip. Unless it's lisp it's enterprise and everyone here hates it.
(On topic)
If you want to exercize your coding skills it'd probibly be better if you stuck with either straight up OpenGL or Direct3D (whatever floats your boat) and write your own wrapper for it instead of using someone elses.
Name:
Anonymous2007-12-22 20:50
If you're going to make a 2D game, USE SDL BECAUSE IT'S FUCKING GOOD. OpenGL is unecessary in your case.
>>23 OKAY YOU FUQIN ANGERED AN EXPERT PROGRAMMER
GODFUCKIGNDAMN
FIRST OF ALL, YOU DONT FUQIN KNOW WHAT A MAN PAGE IS
SECONDLY, THIS IS /prog/ DO NOT SUGGEST USING ENTERPRISE LANGUAGES WHICH ARE OLD AND DYSFUNCTIONAL
THIRDLY PROGRAMMING IS ALL ABOUT PHILOSOPHY AND ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
AND FUQIN LASTLY, FUCK OFF WITH YOUR BULLSHYT
EVERYTHING HAS ALREADY BEEN ANSWERED IN >>4,2,26
Name:
Anonymous2007-12-22 20:58
>>25
(Off topic) >>25 is just an ENTERPRISEfag who can't figure out what makes him ENTERPRISE.
(On topic)
Mindlessly wrapping OpenGL or Direct3D and duplicating the tedious effort of others is a good way to exercise your coding skills? See, this is why we don't like C++. It trains poor, weak-minded programmers like you to think that (eq coding-skills willingness-to-waste-time) => T. In C++ land, code is judged strictly by its volume. And more is clearly better.
>>25,28
(Off topic)
Where the fuck did all this talk about a fucking wrapper come from? SDL and Allegro?
>>25
(On topic)
If you want to exercize your coding skills it'd probibly be better if you stuck with either straight up machine code or assembly (whatever floats your boat, you'll probably need to write an assembler anyway) and design your own processor architecture for it instead of using someone elses.
Name:
Anonymous2007-12-22 21:25
>>29
(Off topic)
Beats me. My 2¢ was just that making your own is a stupid idea when you want to practice something worthwhile. Especially in C++, where OpenGL or SDL's perfectly good function-based interface would get replaced with C++ classes. Even in Common Lisp, home to the greatest object system around (aside from possibly Smalltalk, which is apples and oranges), no one bothers to mess those libraries up with objects when they make wrappers.
Name:
Anonymous2007-12-22 21:48
OP here. No, I don't care about language debates. Yes, I am looking to one day be employed by a PC game developer.
OpenGL I know I can pick up later, s'on my course roster even. At the moment I merely need something good, and something that can make my life easier. I do want to learn Direct3D though, I'd probably best save it for a later time. As simple as this project is, all I wish to do is become more comfortable using visual C++, and make something halfway worthwhile when I'm done. My main problem is having done little of it, I don't rightly know where or how to start, other than don't use MFC. I r nub.
>>25
Thanks. I just dismissed most of them as simple trolls. This is 4chan after all.
Name:
Anonymous2007-12-22 22:43
>>31
I can't believe that in this whole thread, >>25 is the one you take seriously. What an idiot (both of you).
>>28
I agree with you. Wrapping every little thing OpenGL can do IS stupid. I meant writing a minimal set of functions that does ONLY what is needed so the graphics code isn't everywhere in the program.
>>31
I am going to backtrack a little and say it probibly is better to use a pre-existing engine. This early on you'll probibly run into way too many traps and headaches.
>>31
Okay, so I'm confused: do you want to learn more about the language? Or do you want to learn about a graphics library? They're not necessarily completely disjoint goals, but I still think it'd be hard to have as wholesome an experience if you try to learn too many wildly different things at once.
>>34 I am going to backtrack a little and say it probibly is better to use a pre-existing engine.
While in many situations I'd completely agree with you, this isn't one of them. It doesn't sound like the OP wants to make a game; he wants to learn bullshit. And the best way to do that is to wade through half the traps and headaches so you can come to /prog/ three years later and troll threads with some sense of satisfaction.
Well, I do want to learn both about the language and a graphics library. For now I planned just to make something simple and bitblt everything, and then look into integrating it with a library if I can. Which hopefully won't be too painful if I keep Paint() separate from everything else in the code. And yep, I need to wade through traps and headaches, one so I know what they are, and 2 because in some way, it's the definition of experience. I think you grasp my goals fairly well.
Of course, that coupled with my lack of experience outside of MFC has made everything, well, more intimidating than it need me. Which I am slowly gathering as I drop the MFC crutches and start crafting the project. No kidding there's really not a whole lot to it at all. There's still plenty about the language I need to learn, smart pointers and virtual functions, but I'll likely have to work on something higher end to tackle those I'd think.
>>36
As a C++ programmer who has gone one dumber and actually learned MFC, you can't talk about anybody.
Name:
Anonymous2007-12-24 16:14
>>37
I see you live in a world where learning somehow makes you dumber.
lol internet
Name:
Anonymous2007-12-24 21:21
>>38
By learning MFC he's wasted valuable brain space and time that he could have used for something applicable outside the hellish and nonsensical world of C++ trivia.
Name:
Anonymous2007-12-24 21:30
>>39
He could've stored how to make infinite loops in every Lisp dialect.
Name:
Anonymous2007-12-24 21:50
>>40
The culmination of all software engineering? I think so.