Skip to main content

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password
Register
  • Home
  • Browse
    • 2D Art
    • 3D Art
    • Concept Art
    • Textures
    • Music
    • Sound Effects
    • Documents
    • Featured Tutorials
  • Submit Art
  • Collect
    • My Collections
    • Art Collections
  • Forums
  • FAQ
  • Leaderboards
    • All Time
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
    • Weekly
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
  • ❤ Donate
Programming

Going from XNA --> C++?

Napoleon
Monday, September 26, 2011 - 05:39

I have been programming games for a few years in XNA now and before that I created database applications in C# and Oracle and you name it.

I do however have almost no experience with C++. I'm constantly running into garbage problems with XNA due the poor handling of garbage in the XNA framework and the fact that you can't release xbox games for free and some other annoyances.

However, going from XNA --> C++ is a big step it seems. There are no generics List<T> for example. Is there an idiot-proof guide to convert from C# to C++? Including what IDE to use and such unless VS c++ happens to be the best choice as I can get the profesionnal edition I think.

I'm only a 2D programmer as I never had the chance to really get into those really complicated 3D alghorithms.

  • Log in or register to post comments
Beast
joined 14 years 2 months ago
Monday, September 26, 2011 - 07:54
Beast's picture

No there isn't.

Here are some things you should consider, though:

  • C++ doesn't have any kind of garbage collection, that means you actually have to care about pointers, allocation and deallocation. (You practically only have what is called "unsafe mode" in C#.)
  • The standard library for C++, the STL, is a lot worse than what you'll know from C#. (Not as bad as not having no list<T> class, but still, it makes a lot things harder than they should be.)
  • If you want to learn C++ in a less painfull way you should try Qt. It has a insanely good documentation, the SDK comes with a proper IDE (including compiler) and it ships it's own replacment for the STL which is way more comfortable and intuitive. Also it's free, cross-platfrom and open source.
  • Log in or register to post comments
bart
joined 13 years 10 months ago
Monday, September 26, 2011 - 08:01
bart's picture

I'm not aware of any guides, but on the other hand, I've never tried doing what you're doing, so I haven't had a need to look for them. :)

That being said, if you want generics in C++, look for the Standard Template Library, which comes with all the major C++ distributions and provides generic container classes like lists and queues and all sorts of other things.

There's nothing wrong with visual studio as an IDE.

Also, if you want to aim to make your game cross-platform, I'd consider using free libraries like SDL and/or OpenGL to handle your graphics and sound, rather than relying on DirectX.  If you must use DirectX, write some wrapper functions so you can swap it out later.

Furthermore, if you want a library that's a bit more intuitive than the STL (but also a somewhat bigger), consider looking into Qt Core, which is Qt without all of the GUI stuff on it.  It provides a bunch of nice template classes and some other stuff (like XML parsing, etc) that are immensely useful.

Feel free to ask any questions.  I don't know XNA, but I do know C++ and I can probably help. :)

Bart

  • Log in or register to post comments
Napoleon
joined 13 years 9 months ago
Saturday, October 1, 2011 - 16:19

Thanks for the replies :). Seems like going from c# --> c++ is a lot harder than I thought. But mastering C# took me years so mastering c++ will probably take pretty long too.

 

Ah yes good tip on the OpenGL.

  • Log in or register to post comments
Anonymous (not verified)
joined 0 sec ago
24.152.134.21
Tuesday, October 11, 2011 - 15:07

I think one other important thing to bear in mind is that OpenGL is a lower-level API (and so a  steeper learning curve) than XNA.  

 

Dave

  • Log in or register to post comments
creek23
joined 14 years 9 months ago
Wednesday, October 12, 2011 - 05:06
creek23's picture

Napoleon, I was into Java before I got into C++.  Since C# is basically Microsoft's clone of Java, I do feel your frustrations. :P

So what I did was, looked into open source 2D game engines that already exists -- obviously, there are lots of them.  One way to choose which, is to have a check list:

  • what type of game you want to make?
  • what API (SDL/DirectX/OpenGL) you want to use?
  • which compiler you want to use? (setting up GCC with MinGW/Cygwin could frustrate you)
  • is the project in stable state -- no rapid major changes in source code?

After choosing one, try to make sure it's compilable with the toolchain you have setup.  This way, you can tinker with the source code as it pleases you -- makes learning even more fun; studying the source code could take a while.

Optionally, you have to have the repo edition of the engine's source code -- get it from projects SVN/CVS/BZR/Git/etc -- so any change you made which suddenly broke the code can still be reverted.

got game?

  • Log in or register to post comments
Acorn
joined 13 years 5 months ago
Wednesday, December 7, 2011 - 19:56

learning c++ is never a bad thing. Just make sure you understand each concept before you move on. Eventually you will run out of concepts and basically know it. c++ offers 25 different ways to slice a piece of bread. dont stress out and let people make you think you have to know all 25 ways to be productive. it will come in time.

 

  • Log in or register to post comments