Game Programming and Development Tools

better – gaurdianAQ

gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
what is better for game design C++ or C#? which is easier? are they completly different?
jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
C# is M$'s version of java. It's completely object based, uses interpreted code and has garbage handling. M$ HAS added some extra stuff for directX (managed directX) so if you're using that then maybe you should consider checking that out.
i think C++ is generally more accepted though. C# is newer and only works on windows whereas C++ is portable (depending on library you use:P). Theres a ton of game engines you can build with or you can use openGL/directx and roll your own.
It's really just preference, but i'd consider learning C/C++ a bit better before jumping into C#. theres a lot of concepts you should learn before messing around with object oriented programming. once you get a handle on programming logic and syntax we can head into design concepts
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
I know a lot of concepts already from reading game programming for teens but C++ is probably better are there engines that use C++ that are free?
jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
oh yeah, theres a bunch since you're going to be starting with 2D (i'm making a suggestion, lol), try SDL (its not a game engine, its a media layer). i'm not sure about what C++ 2D libraries are out there but i wrote my own game engine with SDL. once you get the hang of it, its fun.
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
what is SDL? also there is the XNA game studio which works with C#
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
I don't think I have the compatible C++ compiler for SDL I will try XNA
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
C# seems better there are lots of video tutorials which are really helpfull by the end of the tutorials I will have the knowledge to create an RSS reader!
jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
yeah, MS has some REALLY good videos out there. look for their C#/directx 9.0c game programming one. i downloaded it a while ago but i haven't seen all of it yet. its all about managed directx (directx with garbage collection)
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
so would you still say to use c++? cause I am liking the look of C#
SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
C++ and C# are both good choices. If you haven't touched C#, you may be best to stay with C++. SDL, Ogre, and Irrlicht are all discussed on these forums and are good choices. SDL is OK. Ogre and Irrlicht are much better, but also more complicated and involved.

Funny thing is, in C#, you have similar choices. SDL, Ogre, and Irrlicht all have .NET counterparts. XNA is good and there are plenty of great sites, examples and tutorials out there.

I have used both SDL.NET and XNA, but am only slightly familiar with game programming in general. Others here are much more involved in games and more familiar with other tools.

I say, stick with the language with which you are most familiar. Get the fundamental understanding of game programming/development using your engine of choice. Look at Irrlicht or Ogre. SDL may not contain enough of what you will want, but is still a good way to get introduced to game development.

jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
nuh uh. theres no way he should jump right into 3D stuff before at least making a few space invaders.
Matt Langley
Member

Posts: 247
From: Eugene, OR, USA
Registered: 08-31-2006
If your considering using C# + XNA then you should take a look at TorqueX If you purchase TGB you can use a TGBX editor to create your levels and script your game in TorqueX (based on XNA) in C#.

------------------
Matthew Langley
Lead Documentation Engineer
GarageGames

ArchAngel

Member

Posts: 3450
From: SV, CA, USA
Registered: 01-29-2002
I'd suggest C++, on the basis that animating with C# can be choppy at times.I forgot what did it. might have been garbage handling, I don't remember, but it's not always too smooth. this is if you code straight out of C#. I don't know how XNA works with it, tho. I should probably check that out.
I generally would consider C# to be better for Apps and stuff, but then again, I learned it on Visual Studio .NET.

C++ is also a more supported language, being around longer and all.

and with that said, I'm making a game in C#...


I would, however, disagree with jestermax and suggest you learn an Object Oriented language early on, being that it's generally good practice to code that way.

------------------
Realm Master: "I'm cockasian"
Soterion Studios

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
quote:
Originally posted by jestermax:
nuh uh. theres no way he should jump right into 3D stuff before at least making a few space invaders.

I agree. Not sure if you were referring to me, but I never said to go 3D. I did say to learn the "fundamental understanding of game programming/development". Or does Ogre and Irrlicht automatically imply 3D? I thought they allowed for 2D as well.

Arch, C#/XNA are quite smooth. There are plenty of cool tutorials and examples to watch and download. My favorite place is XNA Resources.

jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
i can only speak for Ogre but using it for 2D is difficult and annoying. you're basically stuck with using billboards and that's not the most useful thing to be starting with.
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
I am watching the video tutorials for C# I am not familiar with either C# or C++ so I cannot say which one is better that is why I am looking at both of them
jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
well, i stand corrected. someone wrote a 2D sprite manager for Ogre3D which basically is just a texture wrapper. I wrote one for OpenGL but i didn't take it too far at the time. Anyways, it could be fun to play with. i'll have a look at it more closely a bit later on. Here's the link:
http://www.ogre3d.org/wiki/index.php/SpriteManager2d
gaurdianAQ

Member

Posts: 106
From:
Registered: 01-15-2007
I think I will stick with XNA and get myself a good book to go with it
jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
actually i might try that out too now i'm i code C#. i just ordered a book on Ogre3D but it won't hurt to check out XNA.
Mene-Mene

Member

Posts: 1398
From: Fort Wayne, IN, USA
Registered: 10-23-2006
So far I've spent almost 2 years in BB. You might want to wait a bit. C++ is more common though.

------------------
MM out-
Thought travels much faster than sound, it is better to think something twice, and say it once, than to think something once, and have to say it twice.
"Frogs and Fauns! The tournament!" - Professor Winneynoodle/HanClinto

jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
XNA seems to be very immature at this point. I'll probably install it to see what it's like but i doubt i'll end up actually using it until it gets more effort put into it.
2 days until i get my Ogre 3D book

EDIT: on top of it, XNA won't even work with any version of VS other than express edition

[This message has been edited by jestermax (edited January 29, 2007).]

CPUFreak91

Member

Posts: 2337
From:
Registered: 02-01-2005
Woa. This thread gives me Deja Vu.
gaurdianAQ: Several months ago I asked pretty much the same question you did. Lemme see if I can find the URL, some people gave me great answers.

------------------
All Your Base Are Belong To Us!!! chown -r us ./base
"After three days without programming, life becomes meaningless.'' -- Tao of Programming Book 2

D-SIPL

Moderator

Posts: 1345
From: Maesteg, Wales
Registered: 07-21-2001
When I went to the XNA launch they said that C# was good for game dev. Especially as they were pushing XNA but the industry guys said they still like C++ and knowledge of unmanaged code was pretty much a must.

------------------
"One World. One Web. One Program." -Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!" -Adolf Hitler
"I believe in freedom... not freedom like America, freedom like a shopping cart"

SSquared

Member

Posts: 654
From: Pacific Northwest
Registered: 03-22-2005
Keep in mind, XNA is not meant to be an all-in-one, complete game engine. No physics. No networking. No sound (or very minimal). XNA is an environment and API for use in making games. XNA is meant to bring teams closer together and creates a more efficient build environment from what game developers are used to using.

I had felt the beta of XNA was immature, but as I started seeing the effort and work people were putting into it, I realized there really is something to it. In just a few months there are already physics engines, camera helpers, and two fairly sophisticated and growing production toolsets for creating 3D, interactive environments for use with NXA and C#.

...and I think TorqueX will be pretty neat, too. I haven't looked at it yet, but it does appear to contain quite a lot of functionality necessary to write games.

At one point, people figured out how to get XNA Beta running on VS Professional, but I don't know if that's true for the final release. I am also not sure if XNA will work under Vista at this time.

A good site for seeing what is happening in the XNA world is XNA Resources.

steveth45

Member

Posts: 536
From: Eugene, OR, USA
Registered: 08-10-2005
Call me crazy, but I think that it would be easier to start game programming in C++. That said, the TAO Framework provides .NET and Mono bindings for OpenGL, SDL, Cg, DevIL, ODE, OpenAL, and more. SSquared already mentioned existing .NET bindings for Irrlicht and Ogre.

I've heard that the problem with C# and games is that the garbage collection (which can happen at any time) can cause single frames to lag noticeably. This is because it freezes every running thread, frees unused memory, and compacts the remaining allocated memory. One term for this frame lag is "hitching". Garbage collection happens automatically after a certain amount of managed memory is allocated. This is a problem with XNA, because all your memory allocation is managed. If you used .NET bindings for Irrlicht or Ogre, then the the engine itself is running in unmanaged space and if you use the engine's own image and mesh loading functions, then you are not allocated managed memory. However, with C#, many algorithms and operations allocate small amounts of memory here and there, letting the garbage collector free the space the next time it runs. So, with a significant amount of game logic happening in managed code each frame, you could see the garbage collector running quite often, maybe even every few frames. This could really cripple a game with a high frame rate, especially if you are shooting for 30 or 60 or more frames per second (which I think nearly all games should). There are some tricks to reducing the frequency of garbage collections, but they aren't guaranteed to work perfectly, and may require a great deal of added complexity to your code.

Or, you can use C++, and not worry about that at all.

------------------
+---------+
|steveth45|
+---------+

jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
does anyone know anything about Allegro/AllegroGL?
Lazarus

Member

Posts: 1668
From: USA
Registered: 06-06-2006
Yeah, I've used Allegro a little.(To write Tic-Tac-Toe in 2D)

wiggyh
Junior Member

Posts: 2
From: Yakima, WA, US
Registered: 02-11-2007
I will confess I didn't read all the other posts.
I recommend C++, because as far as I have seen it is easier to find help with. I have been using C++ for about a year now and it is great. There are lots of tutorials, libraries, and free software out there for C++. But in the end it is your choice.

I wish to make an attempt at correcting JesterMax. I am pretty sure C# is Microsoft's version of C the predecessor to C++. J# is the MS version of Java. They lost the right to use "Java" in a lawsuit so they renamed it.

------------------
My Website http://wiggyh.googlepages.com
It
It contains my projects I am working on I update on Saturdays

ArchAngel

Member

Posts: 3450
From: SV, CA, USA
Registered: 01-29-2002
C# is a lot more like Java than C.

------------------
Realm Master: "I'm cockasian"
Soterion Studios

D-SIPL

Moderator

Posts: 1345
From: Maesteg, Wales
Registered: 07-21-2001
quote:
Originally posted by ArchAngel:
C# is a lot more like Java than C.



It appears they took all the good features of Java, dumped the rubbish and made C#

------------------
"One World. One Web. One Program." -Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!" -Adolf Hitler
"I believe in freedom... not freedom like America, freedom like a shopping cart"

Calin

Member

Posts: 358
From: Moldova
Registered: 12-04-2006
OS programming is Microsoft's first language, game development is not. I think when we talk about Microsoft products it's good to eat the meat and spit the bones. XNA is obvious a mule for XBOX, personally I was surprised how XBOX oriented XNA was when I watched the promotion videos/downloaded it (which I'm not saying is a bad thing)

C# is a whole different story, it has to do with application and OS programming which is definately Microsoft's yard. My belief is C# will at least be on the same footing with C++ in several years. Think of C# as the glue code used in sticking various speed critical components ( which will still be using C++, i.e. rendering engines, sound, physics, etc). With the changes in version 3 it will even make a nice scripting language.

Learning C++ will not hurt, although it does get hairy when you start building complex things.

Using C# with Irrlicht/Ogre is a nice combination if, as someone mentioned, the engines themselves aren't too much to swallow.

[This message has been edited by Calin (edited February 12, 2007).]

steveth45

Member

Posts: 536
From: Eugene, OR, USA
Registered: 08-10-2005
quote:
Originally posted by Calin:
Using C# with Irrlicht/Ogre is a nice combination if, as someone mentioned, the engines themselves aren't too much to swallow.

I've toyed around with this idea, but it severely complicated the build and distribution process.

Distribution: When I make a game with Irrlicht in C++, I can statically link the engine with the final binary, and it works, especially if I've modified the engine in some way. With C#, I believe the wrappers all work by using .dll's or shared libraries (in Linux) and just p/invoking into those libraries. Well, on Linux, you have to go through some hassle to get shared libraries working, not to mention there may already be a different version of the engine installed. In Windows, you've got something similar we like to call DLL Hell.

Build/debugging: This shared library, p/invoke cross-over is difficult to cleanly debug. Also, getting everything set up even to build and run correctly on your own system can be a hassle.

Why all this hassle? so you can do this:
device.VideoDriver.BeginScene(true, true, new Color(0,100,100,100));

instead of this?:
driver->beginScene(true, true, video::SColor(0,100,100,100));

The difference is mostly syntactical. The C# code here is slower and takes more memory because of the P/Invoke overhead and the heap instantiation of the Color object.

------------------
+---------+
|steveth45|
+---------+

Calin

Member

Posts: 358
From: Moldova
Registered: 12-04-2006
I do agree C# has highs and lows. However the trade off is worth it IMO. The prime time for C# has not yet come. It will as more users buy Vista (which has Net Framework 2.0 as part of it).

In your example you can use a static object instead of creating an object on the heap:

device.VideoDriver.BeginScene(true, true, Color.From(0,100,100,100));

Calin.

[This message has been edited by Calin (edited February 13, 2007).]

spade89

Member

Posts: 561
From: houston,tx
Registered: 11-28-2006
hey which one is better java or c# ??

as far as fast codes and efficient algorithm development go c++ seems to be the best.specially for games it seems to me that it is much easier to code opengl and directx in c++ than any other language.

------------------
Matthew(22:36-40)"Teacher, which is the greatest commandment in the Law?" Jesus replied: " 'Love the Lord your God with all your heart and with all your soul and with all your mind. This is the first and greatest commandment. And the second is like it: 'Love your neighbor as yourself.All the Law and the Prophets hang on these two commandments."
Whose Son Is the Christ

jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
quick comment: java has JOGL (java for opengl)
spade89

Member

Posts: 561
From: houston,tx
Registered: 11-28-2006
and j3d.

------------------
Matthew(22:36-40)"Teacher, which is the greatest commandment in the Law?" Jesus replied: " 'Love the Lord your God with all your heart and with all your soul and with all your mind. This is the first and greatest commandment. And the second is like it: 'Love your neighbor as yourself.All the Law and the Prophets hang on these two commandments."
Whose Son Is the Christ

jestermax

Member

Posts: 1064
From: Ontario, Canada
Registered: 06-21-2006
actually i think theres an Ogre3D for java extension as well (looooove ogre)