Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1402048 Posts in 68028 Topics- by 61611 Members - Latest Member: Zoteling

August 11, 2022, 10:00:03 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Greetings! Newbie asking where to start with C++ game programming here!
Pages: 1 [2]
Print
Author Topic: Greetings! Newbie asking where to start with C++ game programming here!  (Read 2441 times)
VortexCortex
Level 2
**


Engram Architect


View Profile WWW
« Reply #20 on: June 27, 2012, 11:59:55 PM »

GODS DAMN Language Wars. Screw that crap right there buddy.  Every. Damn. Time.  Just ignore all that.

Whatever you've got experience with use it.  Personally, I tend to opt for cross platform solutions, and avoid XNA, but that shouldn't stop you in the least.  The more exp you get with any language, easier others are to pick up.  You're not getting married to it, damn.  After a while they're all just sets of syntax rules and APIs that trade speed for complexity or vise versa.

Hell, any language worth its salt, yes even Java and JavaScript, compile code to machine instructions (via JIT for dynamic ones), so all the talk of which is faster is just retarding progress.

Just pick any ol' language and any flippin' framework.  The most important thing is to get a moving square on the screen as soon as humanly possible.  The rush you get from successfully adding little features until it's turned into a Tetris clone or Space Invaders is the second most important thing.

The third most important thing is actually sticking it out once those little rushes subside until you have a playable game.

I'd suggest you go with a clone of a simple game, this way you already know the mechanics and can get right to coding.  Pong has the least amount of world state, but Tetris doesn't need any AI.  Space Invaders has more world state and enemy behaviors.  Brickout has levels, so you'll need to make a level creator. (Mrs.)PacMan has simple AIs and path finding.  Galaga has more advanced enemy behaviors.  (Super) Mario Bros. and other 2D platformers have everything all the others have.  That's a list of clones in increasing order of complexity.

Every time I learn a new language or framework I make these games, or at least Tetris & PacMan -- They're simple and cover all the basics you need to get familiar with: sound, images, animation, input.

Languages, platforms, frameworks and APIs are just things you have to navigate to get your ideas on the screen.  Which ones you pick don't matter.  There's always a tradeoff somewhere for people to argue over, so that makes them all equal IMWO (In my worthless opinion).
Logged

Sir Wolf
Level 0
***


A wolf cub growing up


View Profile
« Reply #21 on: June 28, 2012, 12:34:40 AM »

OK, cool. Also, I can't believe I neglected to mention this, but I have some experience programming with XNA. I don't know how XNA is viewed by the indy-dev community, so I didn't bring it up.

Nothing wrong with XNA.

was made with that. And that X-Box online store thingy is full of indie games made with XNA, I believe. I also use it myself. It's definitely faster for beginners to learn and work with than C++, you'll get things actually done at faster rate when you don't need to wrestle with the language itself so much. As it's been said, if your goal is to make a game and learn about game development rather than to learn C++, and you already have experience with XNA, then that sounds like a splendid choice.

Edit: typo.
Logged

"We don't stop playing because we grow old; we grow old because we stop playing."
-George Bernard Shawn
Hedgehodg
Level 1
*


...


View Profile
« Reply #22 on: June 28, 2012, 01:21:35 AM »

This is my opinion: if you are already learning C++, and you think you are understanding that well, go with that, and start game making with SFML. C++ is not really as difficult as it's made out to be, and as long as you've got a nice library like SFML it should be fine. The tutorial that Rusk linked to looks to be exactly what you need! Good luck!
Logged

Previously known as "darestium"...
rivon
Level 10
*****



View Profile
« Reply #23 on: June 28, 2012, 02:22:56 AM »

Dacke: I don't know how you measured the memory used (whether the tests itself had printed something about it) but you know, it's possible that, as you measured it yourself, that you measured the wrong value as there are more memory measurements - shared memory, resident memory, virtual memory, all having wildly different sizes...
Logged
Eniko
Level 0
**



View Profile WWW
« Reply #24 on: June 28, 2012, 02:37:06 AM »

Nothing wrong with XNA.

was made with that. And that X-Box online store thingy is full of indie games made with XNA, I believe. I also use it myself. It's definitely faster for beginners to learn and work with than C++, you'll get things actually done at faster rate when you don't need to wrestle with the language itself so much. As it's been said, if your goal is to make a game and learn about game development rather than to learn C++, and you already have experience with XNA, then that sounds like a splendid choice.
There's also Terraria which was the top selling game on Steam for what, a week, when it came out? XNA is awesome.

Personally I'm against learning C++. Yes, explicitly against it. The language is now 30 years old and unless you're planning to code the next Dragon's Dogma you don't need C++ for the speed it offers over something like C# or Java, particularly if one is already familiar with XNA.

It takes skill and experience anyway to even leverage C++ to be that fast, so I think given a choice a newer programmer who doesn't even really need it is better off with C#. That way you won't have to chase down memory leaks or worse.

NB: In all fairness you might have to debug garbage collection in C# too, but that will be an occasional framerate spike, rather than inflating memory footprint or crashing.
Logged

_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #25 on: June 28, 2012, 02:52:36 AM »

@Eniko: also don't forget that C++ is the most portable of all the languages Smiley
Java will only run on PC, C# will only run on Windows and somewhat on WP7 and XBLIG (and Mono, but I dunno about that), etc, etc. You can cut yourself from lots of platform when choosing a language that is not C++.
But yeah, if you're not an expert chance is that you won't be good enough to write really cross platform C++, so the advantage here is not so clear.
But I would be at least unconfortable when tying a big project to a single platform like C# and XNA, maybe I'm paranoid.

But then XNA is being phased out by MS right now (will not run in Metro mode), so this fear is at least a bit motivated Smiley
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #26 on: June 28, 2012, 03:02:37 AM »


Personally I'm against learning C++. Yes, explicitly against it. The language is now 30 years old and unless you're planning to code the next Dragon's Dogma you don't need C++ for the speed it offers over something like C# or Java, particularly if one is already familiar with XNA.

Yeah, that points to the fact that it is very difficult for anyone without wide and deep programming language knowledge to know when you need C++. I wish there would be some kind of basic rule of thumb to tell anyone who wants to make games if it is worth learning C++ to make this specific game... newcomers don't need it, but what if it's someone who is not new to programming (whatever the language?). It's hard to say even with a description of game. It took me years, personally, and using a lot of different languages to understand when I don't really need it. And sometime I don't even make rational choices, because I don't need to.

Quote
It takes skill and experience anyway to even leverage C++ to be that fast, so I think given a choice a newer programmer who doesn't even really need it is better off with C#. That way you won't have to chase down memory leaks or worse.


*cough* *cough* modern C++ *cough* *cough* RAII *cough* *cough* no memory leak *cough* *cough* easy to manage *cough* *cough* *cough* ahem.

But yeah it takes more time than C#, Java or Python to fully..."master". I think the worst part is certainly the compilation times getting in the way of testing and debugging though.

Go with XNA if you want to make games. Get some books if you want to learn C++. Don't mix these goals. Yet.

_Tommo_ > True, that's one major reason I'm using in a lot of projects that need to run not only on PC.


Also, XNA seems to be a good choice these times as there will be Windows 8 tablets running it too, and I hope Win Phone 8 too.
Logged

Eniko
Level 0
**



View Profile WWW
« Reply #27 on: June 28, 2012, 03:06:52 AM »

Go with XNA if you want to make games. Get some books if you want to learn C++. Don't mix these goals. Yet.
Sorry, shows me to post before my 2nd cup of morning coffee. I basically agree with this completely, I wasn't trying to say C++ is evil or anything, and it should never be learned. Just that I don't think it should be learned alongside learning to make games.
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #28 on: June 28, 2012, 03:18:54 AM »

Yes no problem really, I was just pointing the misconception of memory leak that should not be true if you learn C++ correctly (but obviously, not a lot of people did. I didn't, I had to relearn it from scratch at some point...)
Logged

Moczan
Level 5
*****



View Profile
« Reply #29 on: June 28, 2012, 04:50:20 AM »

@Eniko: also don't forget that C++ is the most portable of all the languages Smiley
Java will only run on PC, C# will only run on Windows and somewhat on WP7 and XBLIG (and Mono, but I dunno about that), etc, etc. You can cut yourself from lots of platform when choosing a language that is not C++.
But yeah, if you're not an expert chance is that you won't be good enough to write really cross platform C++, so the advantage here is not so clear.
But I would be at least unconfortable when tying a big project to a single platform like C# and XNA, maybe I'm paranoid.

But then XNA is being phased out by MS right now (will not run in Metro mode), so this fear is at least a bit motivated Smiley

Are you sure about Java running only on PC? From what I get, there are machines for both Java and C# that run on almost anything including your fridge or toaster, and porting managed languages is like 100x less hassle than porting C++.
Logged
Halcyon
Level 2
**



View Profile
« Reply #30 on: June 28, 2012, 05:05:00 AM »

I remember when I was completely new and wanting to make games (specifically the next best MMO  Big Laff). I did a little research and found that all the 'professional' games used C++ so I was determined to learn that language. I read through many threads like this one suggesting that I learn something easier etc.. And typically I ignored them all and went straight to learning C++.

What has resulted in this? well a couple of years after beginning my endeavour I have learned the language to a decent extent and have made a total of 0 completed games, with not much to show otherwise. This isn't to say it will go the same for you, you may be a much more dedicated person and far less lazy then I am; but in any case you will spend years learning before you create what you really want to.

Learning a language is half the battle, programming and game development concepts (such as math, OOP, physics, data structures etc) is the other half and they will almost always translate over to whatever language you want to use. I would say that learning these are far more important then learning the language itself, therefore learning a simpler language is indeed a good idea. Even using programs like Game Maker or Unity are good for beginners to game development. Ultimately C++ will give you more control, power and freedom in the long run but you don't need that as a beginner.

But if you are determined to stick with C++ then I would user one of the aforementioned libraries such as SFML, SDL or Allegro; the latter being the only I have little experience with.

Anyway here are some tutorials that may give you a start:
http://www.dreamincode.net/forums/topic/109001-beginning-sdl-part-1/
http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx
http://javilop.com/gamedev/tetris-tutorial-in-c-platform-independent-focused-in-game-logic-for-beginners/
http://www.sdltutorials.com/
Logged
_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #31 on: June 28, 2012, 05:13:40 AM »

Yep. No java on iOS and any console. You can get Java games to work on Android but there are some major library differences, and probably a Java game will be pretty slow on a low-end android device.
For C# there's Mono, so I guess that sticking to that part of .NET that Mono supports you can get decent/good crossplatform support with it. But still you can't use XNA with mono, and you should go with bare-bones OpenGL to support other platforms.

and no, I don't see why porting a managed language should be easier than porting C++.
Logged

Moczan
Level 5
*****



View Profile
« Reply #32 on: June 28, 2012, 06:11:41 AM »

For C# there's Mono, so I guess that sticking to that part of .NET that Mono supports you can get decent/good crossplatform support with it. But still you can't use XNA with mono, and you should go with bare-bones OpenGL to support other platforms.
There is also MonoGames which tries to mirror XNA, but it's not yet complete

Quote
and no, I don't see why porting a managed language should be easier than porting C++.
Because with stuff like Flash it works out of the box most of the time, while with C++ you get so much inconsistent behaviour even on same platform. For small indie teams or lone developers it's really kinda impossible to have 30 different Windows hardware configurations to test, because your game can go fuck itself on specific graphics card or driver, not even talking about porting.

Logged
Dacke
Level 10
*****



View Profile
« Reply #33 on: June 28, 2012, 06:58:12 AM »

GODS DAMN Language Wars. Screw that crap right there buddy.  Every. Damn. Time.  Just ignore all that.

Yes. Sorry about that. I tried to make basic point you were making. Most languages are good enough to make games with. Then I had to defend that point and a language war broke loose. I should have tried to defuse it earlier Concerned

@Klaim: Thank you for the pointers. "Modern C++" sounds fairly interesting.

@Rivon: You may be right, it's possible that my memory measurement was sloppy. But I think that the memory measurement showed actual memory occupied by the program, with the garbage collector cleaning up any overhead as you go along.

@_Tommo_: Almost all Android apps are written in Java. I work as a professional Java programmer and we compile to HTML5. There are embedded devices, BluRay players and cars that run Java. Java can be complied to target iOS with some effort. Technically most of these aren't Java™ because they don't support the entire standard library. But it's really just a matter of using (slightly) different libraries for different platforms, which is exactly what you'd do for C++ anyway.

Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
_Tommo_
Level 8
***


frn frn frn


View Profile WWW
« Reply #34 on: June 28, 2012, 08:29:22 AM »

Because with stuff like Flash it works out of the box most of the time, while with C++ you get so much inconsistent behaviour even on same platform. For small indie teams or lone developers it's really kinda impossible to have 30 different Windows hardware configurations to test, because your game can go fuck itself on specific graphics card or driver, not even talking about porting.

Well, you're using the same driver with LWJGL or JGL or whatever you use to expose OpenGL to C#, so the drivers can fuck themselves pretty good in any language Smiley
But yeah, C++ is more bug prone when you dabble with low level stuff, eg: pointer math can get VERY wrong on different platforms. Some platforms zero their memory, or are less strict about out of bounds access, or won't crash with a double delete, leading to lots of hate when you happen to compile for a platform that's stricter.
Still, using "modern" C++ this is much less likely to happen, and having just ported a very big project I can say that these kinds of problems were the least common.

@_Tommo_: Almost all Android apps are written in Java. I work as a professional Java programmer and we compile to HTML5. There are embedded devices, BluRay players and cars that run Java. Java can be complied to target iOS with some effort. Technically most of these aren't Java™ because they don't support the entire standard library. But it's really just a matter of using (slightly) different libraries for different platforms, which is exactly what you'd do for C++ anyway.

Cool, I didn't know iOS could run Java, is that a terrible hack or something production ready?

Anyway ok, you convinced me, C++ is the most portable language only by a bit Smiley
But let's say that I still prefer C++ for being the "latin" of languages, and for being tied to noone.
Seeing how much each of those Java and C# ports depends on huge efforts from random companies and individuals in emulating the specs of the "real thing", I can't be confortable with it Crazy

PS: yeah sorry for the language war Beer!
Games can be made in any language, even "indie AAAs" as long as they are 2D or even simple 3D... people even consider using HTML5 for games, so this has definitely to be true Durr...?
Logged

Dacke
Level 10
*****



View Profile
« Reply #35 on: June 28, 2012, 08:53:07 AM »

Java (the language) can be compiled to different targets using special compilers. Google PlayN uses different compilers to compile from one code-base to different targets. So from a single codebase you can compile to Java Bytecode (for desktops), JavaScript/HTML (for browsers), Dalvik (for Android), SWF (for Flash) and iOS-ARM-nonsense (for iOS) (or are they just using HTML5 to target iOS?).

The drawback: PlayN is a bloody pain to set up.

edit: I have no idea how the performance is for different targets. But my experiences with using GWT to compile Java to HTML5 are quite positive.
« Last Edit: June 28, 2012, 09:09:19 AM by Dacke » Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic