• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Cyb3rGlitch

C++ or C#?

34 posts in this topic

I am willing to get into 3D game programming. My problem is, I don't know what language to use. I have the C++ book 'Sam's teach yourself in 24 hours'. But in another forum I was told that C++ is getting out of date, and C# is better. Another question is, what API should I use? OpenGL or DirectX? I want to get the most realism out of my game (when I get to making it). I will first learn C++/C# (depends on what you guys recommend) then I'll learn Windows programming and finally DirectX or OpenGL. Any suggestions? What books/tutorials should I get?
0

Share this post


Link to post
Share on other sites
Those links just confused me... One opts for C++, another for C#...

What would be the best for creating a game from scratch (with a pre-made open source game engine)?
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Cyb3rGlitch
Those links just confused me... One opts for C++, another for C#...

What would be the best for creating a game from scratch (with a pre-made open source game engine)?


Depends on who you listen to... some opt for C++, some for C#.
0

Share this post


Link to post
Share on other sites
It doesn't really matter, try them both out. Download an IDE and create a few small programs.

As for D3D vs OGL, you aren't ready for either yet. When you are though, the same thing applys, both can do the same thing so it doesn't really matter.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Scet
It doesn't really matter, try them both out. Download an IDE and create a few small programs.

As for D3D vs OGL, you aren't ready for either yet. When you are though, the same thing applys, both can do the same thing so it doesn't really matter.

I'll probably go for C++ then.

So what is essential to learn how to develop 3D games?
0

Share this post


Link to post
Share on other sites
I have programmed in both and each has its own strengths and weaknesses. I don't know who told you that C++ is getting out of date, but I couldn't disagree more. Many, many applications are written in C++ and it is an extremely powerful language. What you should know is that once you know C++, you can easily learn C# and vice-versa. I originally learned C++, but was able to pick up C# in about 2 weeks.

I have never used OpenGL, so I can't comment much on it, but I have programmed in DirectX w/C++ and in Managed DirectX w/C# (I hope to get into XNA soon), and I can say that they are both equally powerful (despite what some here might say otherwise). From what I have read, OpenGL and DirectX are both very powerful APIs and both are used by professional game developers.

I would recommend you learn C++ first, especially if you don't have prior programming experience, so you can start with structured programming. Then, once you move on to object-oriented programming, you can easily switch to C# with no trouble.

For windows programming, there are plenty of good tutorials out there. However, I found that "Programming Windows" by Charles Petzold was an excellent, albeit now outdated, introduction to the Win32 API. I haven't even hardly scratch the surface of this book (it's 1500 pages, more like a doorstop than a book), but the first few chapters are extremely helpful to the beginning windows programmer. Windows programs have a very different structure than "console" programs, so a firm understanding of that structure is essential to any OpenGL/DirectX programmer. Don't make the same mistake that I made by thinking that you can learn windows programming while learning a graphics API.

I found that "Programming Role Playing Games with DirectX, Second Edition" by Jim Adams was a good introduction to DirectX in C++. It isn't always perfectly clear at times, but the sample code is good and usually error-free. The game engine that comes with the book is good for beginners (not a professional game engine, though) but is definitely powerful enough to be used to create your own games. Just be sure to get the second edition (the first edition uses DirectX 8.1, the second uses 9.0b).

For managed DirectX (in C#), "Managed DirectX 9 Kick Start: Graphics and Game Programming" by Tom Miller is an excellent introduction. This book will not teach you how to create an entire game but will give you the tools you need to do so.

Personally, I have found that Managed DirectX is easier to program in. Unmanaged DirectX with C++ is straining to the eyes. MDX is much cleaner looking code and is simpler to start an application from scratch in. The disadvantage to using MDX is that the majority of documentation and tutorials are written for unmanaged DX.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Cyb3rGlitch
So what is essential to learn how to develop 3D games?


The most essential thing is to learn how to program well in your choice of language.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by AIDev
Quote:
Original post by Cyb3rGlitch
So what is essential to learn how to develop 3D games?


The most essential thing is to learn how to program well in your choice of language.


QFE, although you may want to generalise it to "the most essential thing is to learn how to program well". After you've used more than two languages, you'll find that most of the concepts you learn (especially in any multi-paradigm language, of which C++ is an example) can be easily applied to others, be it Java, Python, C#, etc*. If you feel comfortable enough going ahead with C++, which is a tad trickier than C# and other managed languages, feel free. At some point in your programming life, you're going to have to learn about the low-levels (pointers, heap vs. stack allocation, etc), and you may as well do it now. Don't forget, before Java, C and C++ (and Assembler) were the primary languages taught in university, and many programmers somehow graduated. Just make sure you find a good book/tutorial. There are many bad ones out there about C++ - mainly written by old C programmers who apply C solutions to C++ problems, which is wrong. Hope that helps!


*But not Lisp. Never Lisp. [grin]
0

Share this post


Link to post
Share on other sites
You should use whichever API you think is better, though first things first, you should learn some C++ ;)

C# is a lot easier to learn than C++, it is like the best parts of Java and C++ combined and compressed intot his really awesome package, the only reason I'm not learning Directx through C# (just yet) and instead am learning C++ with Directx is because of my course at uni :p

So I'd recommend C# with Directx, but thats just my opinion.

If you do want to go C++ 'Introduction to 3D Game Programming with Directx' is the best book to get a hang of Directx, I'm building my first 3D game engine on top of a lot of the source code and principles I learned from that book, in the space of a week!
0

Share this post


Link to post
Share on other sites
Wow! A week. How much have you learnt in C++? I'm up to classes and pointers etc.

EDIT: Oh, and do you need to learn Windows programming to use that book?
0

Share this post


Link to post
Share on other sites
C# is indeed a lot easer, but ot was never ment to be a game programming language. .NET platform is too slow ( at least now, maybe some day... ) to be used in proffesional game programming other than 2D windows games ( like saper ). If you want to use directx, then your obvious choice schould be C++
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Hacy
C# is indeed a lot easer, but ot was never ment to be a game programming language.

Why is that? I really would like to know.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Hacy
C# is indeed a lot easer, but ot was never ment to be a game programming language.
In the same way that C++ is a systems programming language, and so only good for OS/driver development? [wink]

Quote:
.NET platform is too slow ( at least now, maybe some day... ) to be used in proffesional game programming other than 2D windows games ( like saper ). If you want to use directx, then your obvious choice schould be C++
.NET applications are not slow in the slightest. Badly written code, or code that fights against the framework and runtimes is going to perform badly - but that's the same for any environment or language.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Hacy
C# is indeed a lot easer, but ot was never ment to be a game programming language. .NET platform is too slow ( at least now, maybe some day... ) to be used in proffesional game programming other than 2D windows games ( like saper ). If you want to use directx, then your obvious choice schould be C++


Uh?

I guess that schizoid on the XBox360 will be really slow. And that it was not made by proffessional game developers.

Not to mention Tin Soldiers or Arena Wars, which is using an OpenGL wrapper IIRC.

Concerning the "speed problems" of the .NET framework, I'm pretty sure that a lot of people around there are able to write C# code which will be as fast (or faster) than your C++ code. Today.

Quote:
I would recommend you learn C++ first, especially if you don't have prior programming experience, so you can start with structured programming.

That's really not a good advice IMHO. C++ is a very convoluted language, and C# is a lot simpler, so why should I learn the most complex language first, the procedural programming paradigm, then learn the object oriented programming paradigm (ie loose a lot of time by trying to understand concepts that are radically different from what I just learn), then , finally, a simple, modern and neat language like C#?

Regards,
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Emmanuel Deloget
Quote:
Original post by Hacy
C# is indeed a lot easer, but ot was never ment to be a game programming language. .NET platform is too slow ( at least now, maybe some day... ) to be used in proffesional game programming other than 2D windows games ( like saper ). If you want to use directx, then your obvious choice schould be C++


Uh?

I guess that schizoid on the XBox360 will be really slow. And that it was not made by proffessional game developers.

Not to mention Tin Soldiers or Arena Wars, which is using an OpenGL wrapper IIRC.

Concerning the "speed problems" of the .NET framework, I'm pretty sure that a lot of people around there are able to write C# code which will be as fast (or faster) than your C++ code. Today.


I agree. Managed code compiled JIT can easily keep up with unmanaged code. Last I heard, there's about 4% difference in performance (and that's just because we're talking about managed code).

Quote:
Original post by Emmanuel Deloget
Quote:
I would recommend you learn C++ first, especially if you don't have prior programming experience, so you can start with structured programming.

That's really not a good advice IMHO. C++ is a very convoluted language, and C# is a lot simpler, so why should I learn the most complex language first, the procedural programming paradigm, then learn the object oriented programming paradigm (ie loose a lot of time by trying to understand concepts that are radically different from what I just learn), then , finally, a simple, modern and neat language like C#?

Regards,


Again, I agree. If someone wants to program a game, give him toys and let him play. C# is easier to begin with, there's no denying that. In that respect, I'd advice him to go and learn XNA.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by _neutrin0_
Quote:
Original post by Hacy
C# is indeed a lot easer, but ot was never ment to be a game programming language.

Why is that? I really would like to know.


Which of his statements are you referring to? He claims both that C# is easy and that it was never meant for game programming.

C# is generally considered easier for various reasons. The normal example is memory management. C# pretty much manages it for you (with GC) while in C++ it can be very complicated to manually manage it. Of course if you need good performance you need to understand the garbage collection which can be quite complicated, especially when different platforms (Windows and XBox) have different GC algorithms (at least that is what I've heard). However if you know how it works it's still much easier to use and just as fast (faster in many cases).

It also protects you against all kind of things, especially beginner mistakes like forgetting a break in a switch statement, making an assignment instead of a comparison, etc. It provides a lot of useful features which can help you to develop applications more easily. These are things like a big standard library, events, interfaces, reflection, slightly smarter templates/generics, etc.

It also makes sure you don't make certain common design errors by restricting certain features (inheriting from multiple classes, global variables, etc.)

Also the fact that it doesn't have to have as much backwards-compatibility as C++. Therefore it have a proper module system, no evil preprocessor (and no need for it), etc.

C# have never been promoted as a pure game programming, but I think it would be incorrect to say Microsoft never meant it to be a game programming language. The actual "game programming" languages are either too basic (e.g. DarkBasic) or just some secondary scripting language (e.g. QuakeC).

Microsoft have indeed put quite some focus on C# game programming. More than anyone ever put on C++ in the first three decades. I remember an initiative called Coding4Fun started by them which tried to teach some basic game/graphics programming with C#. It also has a C# game programming competition running and they have been putting a major focus on XNA in the last half year. Also why do you think Managed DX developed so quickly? Because C# game programmers needed it.

Saying that it wasn't meant as a game programming language is misleading IMO.

[Edited by - CTar on April 25, 2007 10:42:32 AM]
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Cyb3rGlitch
Wow! A week. How much have you learnt in C++? I'm up to classes and pointers etc.

EDIT: Oh, and do you need to learn Windows programming to use that book?


nah I was already fairly competant with C++ beforehand, that book isn't meant for people who don't know anything about C++.

You don't have to know, the code for all that is supplied so you can just get to the fun stuff straight away and build on top of their sample applications.
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Cyb3rGlitch
I am willing to get into 3D game programming. My problem is, I don't know what language to use.

I have the C++ book 'Sam's teach yourself in 24 hours'. But in another forum I was told that C++ is getting out of date, and C# is better.

Another question is, what API should I use? OpenGL or DirectX? I want to get the most realism out of my game (when I get to making it). I will first learn C++/C# (depends on what you guys recommend) then I'll learn Windows programming and finally DirectX or OpenGL.

Any suggestions?
What books/tutorials should I get?


Well, I've never so much as written a C# program, but the first thing that comes in to my head is "if you don't know enough to make the choice yourself, use C#"

I've been programming in C++ for quite a long time now (although I only really got my head down and learnt how to use it properly a year or two ago - I used to use C a lot and I still think it's a more elegant and consistent language than C++ despite being pretty short on features compared to pretty much every other language out there - and no, that isn't suggesting you use C), and I still think C++ is a bastard of a language (quite literally - its heritage causes a number of problems), and the only reason I use it is because I'm too lazy to learn anything else right now (that, and the fact that I haven't seen a language that really seems like a step forward yet - apart from garbage collection, most language features are basically window dressing).

On the API front: OpenGL vs. Direct3D. I've never written a program in DX, but as far as ease of coding goes there's probably not much in it. OpenGL gives you portability (to MacOS X and Linux, if you care), although with XNA/D3D you could also target Xbox 360, which you won't get with GL. Sony have been dropping hints about homebrew again, so maybe PS3 will be a consideration, and that would be OpenGL. Take your pick. OpenGL also gives you extensions - very annoying to work with if you don't have a wrapper library like GLEW (I'm not sure if there's one available for C# but I'd be surprised if there wasn't), but they do let manufacturers expose new functionality in their graphics cards before MS goes through another DX release cycle which usually means you get to use it sooner - the notable exception of the last few years being EXT_framebuffer_object.

You know, I think that's the first time I've ever written a paragraph that has more text in brackets than out of them.
0

Share this post


Link to post
Share on other sites
I think the bottom line to most of these discussions is that you as a beginning programmer (and please don't take offense as it this is very general) will limit the language more than the language will limit the language. For example, as said, a program is only as good as the code that is created for it. If it is poorly written, slow, and bulky then the only limitations come from the programmer's skill (or lack there of) and not the actual language's capabilities. If that makes any sense...

Its one thing for someone with absolutely control and mastery of concepts to begin to nit-pick every little feature of each language. Its another story for someone brand new, or with little experience.

Therefore, my best advice, and take it as you wish, is to look past as much of the extra "fluff" (I couldn't find a better word) and just get down into the actual programming. Pick something and run with it. I personally wouldn't chose a programming language on the basis of making it work with a project that is just a goal for the future. Regardless, you can create whatever you want in either of the languages. We know that C++ is proven for the purpose of game making and further C# is also capable of things very similar. Again, whatever you pick, many can assure you, you will be fine with.

Anyway, if you decide you would like to switch to the other language, it isn't the end of the world. While on a professional level, this "philosophy" might not hold water, I personally think that for someone trying to get their feet wet, this is a valid approach, especially if all of these details are getting to you.
0

Share this post


Link to post
Share on other sites
I agree with JBS. C++ can't really be out of date as some people said though. Its syntax might be butchered to heck and back, but all the modern features are still there, which means it is no way outdated. C# has been really easy to pick up for me, but not in the 3D aspect. Therefore, I recommend C++ for 3D programming because of the extensive amount of libraries it has, and overall more support.

[Edited by - Frodo on April 26, 2007 2:40:56 PM]
0

Share this post


Link to post
Share on other sites
Personally I'd say go with C# and check out Microsoft's XNA. It does a lot of the tedious work for you which allows you to get right down to actually coding a game and not a whole bunch of managers / data loaders. It runs plenty fast, comparable to many of my openGL/C++ games I've written. Another plus is you can use your same code more or less and compile games for xbox360.

Here's the link for XNA: http://creators.xna.com/
0

Share this post


Link to post
Share on other sites
Thanks for all the replys.

At the moment I'm thinking C++ with DirectX, and Blender for the 3D modelling.

I need to ask a few questions though:

1. What elements/concepts of C++ are harder to learn than C#?
2. What resources should I use to learn C++?
3. How long approx. would it take me to learn C++ if I study about an hour a day?

I'll ask more questions when I need more help. Cheers!
0

Share this post


Link to post
Share on other sites
Quote:
Original post by Cyb3rGlitch
Thanks for all the replys.

At the moment I'm thinking C++ with DirectX, and Blender for the 3D modelling.

I need to ask a few questions though:

1. What elements/concepts of C++ are harder to learn than C#?
2. What resources should I use to learn C++?
3. How long approx. would it take me to learn C++ if I study about an hour a day?

I'll ask more questions when I need more help. Cheers!


What elements/concepts of C++ are harder to learn than C#?

Possibly not harder, but just more. By its very nature, C++ has more stuff to learn than C#, so it can be considered "harder" for beginning programmers. Not because of the language (although when you move into obscure parts of the language, the syntax can become a little convoluted, and the errors generated are always verbose) - no, not because of the language, but because you are exposed to the machine far more than in C#. C# abstracts a lot of things away from you, like pointers, the heap and the stack (including stack unwinding with exceptions), allocation and deletion, etc. These things are present, so there's more to learn in C++ to do the same amount of work as in C#, which is why people can develop products in C# faster than C++.


What resources should I use to learn C++

This one's easy - use Microsoft's Visual C++ 2005 Express Edition. It's a free download from Microsoft itself.


How long approx. would it take me to learn C++ if I study about an hour a day?

I've been learning C++ for about 7 years now, and I like to think I know the language pretty thoroughly - but I'm still learning design patterns with regards to C++. You don't need as much time to be able to produce tight game code, but it helps if your project becomes massive.
0

Share this post


Link to post
Share on other sites
Thanks. When I asked about resources I meant tutorials, books etc. (I already have Visual C++ Express Edition).
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0