Sign in to follow this  
GraySnakeGenocide

Is transitioning from C# to C++ really THAT simple?

Recommended Posts

I keep hearing that once you learn one language, transitioning from one language to another becomes a snap.

I started out with C++ but switched to C# at a friends request, to get quicker results/work on games together.

If I remember right, the syntax for C++ really isn't all that different from C#.

Share this post


Link to post
Share on other sites
Daaark    3553
It's not necessarily super easy to switch languages. But when you learn your first language, you are also learning the concepts of programming at the same time. When you pick up your second language, you are only transferring your knowledge of how to program to that new language's syntax and ways of doing things. Because you should already understand how programming works at that point.

C++ doesn't have as nice of a system library as C#. You'll have to find your own for a lot of things that C# provides for you. You will also have to manage your own memory (easier said than done! Memory mismanagement tends to be the cause of most program errors), and put up with the header file system C++ uses.

But it's a lot easier than switching to another non c-like language.

Share this post


Link to post
Share on other sites
Daaark    3553
Quote:
Original post by GraySnakeGenocide
Oh boy. I have a hard time with technical/mathematic junk as is >_>.
Are you referring to memory management? It's not that difficult until your program gets large in size.

You have to erase everything you allocate with (new/delete). C# will automatically free up anything once nothing else is referencing it anymore.

In C++ you need to keep track of what everything is, and how many things might be referencing it. You call delete on things, but you have to make sure that anything else that might be pointing at that instance of memory doesn't ever try to access it again. If your program isn't that complex, then it's no big deal.




Share this post


Link to post
Share on other sites
JoeCooper    350
I transitioned from Java to C++ successfully.

It wasn't necessarily easy and I was aided by already knowing C.

Mostly it was looking through tutorials online, as well as manuals for standard library features like the stl::vector to see how things are done, as well as reading through Effective C++ by Scott Meyers a few times.

That last part is important. You don't know what you don't know. A good book or teacher does! Without it, and only by looking up C++ counterparts to Java components, I would've ran into all sorts of problems and also be completely ignorant of features and issues for which there are no Java counterparts.

I also strongly recommend that particular book.

C# to C++ is going to be a similar experience.

Share this post


Link to post
Share on other sites
Fenrisulvur    186
You recently birthed a thread asking whether C# was leading you away from AAA Microsoft/Sony development, didn't you?

Look, you have completely the wrong idea on this one. I know it's natural as a newbie to place huge amounts of emphasis on the significance of the language to your end goal, and to an (ostensibly inflated) extent the more seasoned among us do debate the finer aspects of implementation language/platform details ad nauseam, as well. That's all fine (er, largely, anyway), and for the most part has it's place.

But actual game development, or indeed development of any complicated software product, isn't anything like that.

What you'll come to understand, is that the real meat of game development, the seriously hard problems, the stuff that'll separate you from the pack (or the pack from you if you don't recognise this at some point), are far deeper and rooted in far more immense and richer theory than meagre concerns like which language you're going to use to encode it in.
Take, for example, physics*. To even start to properly grasp the physical interactions a AAA studio attempts to simulate in a game, you're going to have to come to grips with a monumental, astonishingly perplexing mindfuck of a culmination of mathematical brilliance that is The Vector Analysis. Then, note that university physics students usually get to contrive their investigations and exercises into simplified scenarios and experiments - a physics programmer has to write procedures which handle every case, and maintain the brick-shithouse integrity of invariants, complicated conditions which must hold throughout the course of play (eg. stuff shouldn't go through other stuff). Many problems in the area - collisions, for example - are famous for being absolute nightmares to handle robustly. There are many important phenomena in games which you'd struggle to think how to represent, let alone simulate - how the friggen hell to you handle fluids? Air? Water? Deformable anything? How does it all interact? And how do you balance this stuff juice-wise with the rest of the demands on your chunk of CPU time?

Game physics is one of the genuinely, monumentally hard problems involved in AAA game development - but in among the several other monumentally hard problems in game development it's just another piece. Graphics is the "archetypal" example of a hard problem, and because I plainly know next-to-nothing about it I'm not even going to touch it, suffice to say many a game superprogrammer bases an entire career upon the field alone. What about AI? Audio? Networking? What about the infrastructural "kernal" of a game engine that ties all this stuff together? Ultimately, practically all of this stuff exists in and around the design phase, and by comparison implementation (that is, writing code) is intended to be a methodical and uninteresting by-product.
You should also keep in mind that you will require a strong education in theoretical computer science merely as a basis from which to properly grasp any of these fields.

The fact is, to be at all viable as a big-time game programmer, you need to be a veritable go-to guy on at least one of the big problems, and you need to have a reasonable understanding of what everyone else is doing, too. Attaining this level of understanding is brutally hard - learning a pissy little language like C++ is a friggen cakewalk in comparison.

If you want to do something significant to better your chances of making it into serious AAA game development, serously: go to university, take a computer science course, and don't be that kid who whinges about not doing things in C++.

And, seriously, if, after the immensity of these challenges truly sinks in, you have the mind, ambition, and stomach for these things: good luck. The world could always use more people so dedicated.

*Using this as an example because my interest is simulations and such.

Share this post


Link to post
Share on other sites
qprmanzz    122
Very nice post Fenrisulvur.

I put massive emphasis on languages and 'where to start' etc. etc. when i first attempted to enter the world of programming and video game design/production. I started with a little of VB and was afraid to use anything else, seeing it as VB being 'my' language.

A year or two later i actually started a uni course, and pretty quickly you realise just how huge game production/development is as a whole. Languages become a very small factor in the long run. Once you begin to get your head around programming in general, and other features including maths, physics and everything else involved with how computers/technology works, then it almost begins to simplify with complexity.

You begin to realise how much there is, which at first makes everything seem complex, but at the same time it helps you to realise that decisions on things like programming language are much smaller choices than you would first think.

Im nowhere near an expert on the subject, but ive been doing my uni course for almost a year and it sort of 'clicked' a while ago how much is involved. Once you push through the barrier and understand it as a whole, it helps you to understand each individual concept. Pretty much how learning programming in any form helps your understanding when moving from language to language.

It's very very very difficult to find a good direction or 'order' to follow when learning without using some form of university course or something similar. I started with some simple downloadable courses, but without a truely structured flow of learning its hard to grasp each and every concept as you go.

You do have to be smart, and you do probably need to do some form of higher education within computing. Going back to what you said about changing languages though, if you do have a good understanding of programming in general, and especially if you are moving between two similar languages, it really isnt that difficult to change. :)

Share this post


Link to post
Share on other sites
I didn't really want to do programming to begin with, I wanted to do the David Jaffe work, the Hideo Kojima work.

In other words, CREATIVE work.

But, I was told programming is the quickest way in, so I'm forcing myself to do it.

Share this post


Link to post
Share on other sites
Daaark    3553
Quote:
Original post by GraySnakeGenocide
I didn't really want to do programming to begin with, I wanted to do the David Jaffe work, the Hideo Kojima work.

In other words, CREATIVE work.
You want to be the supervisor without even knowing what it is to do the work you would be supervising?

Share this post


Link to post
Share on other sites
Slateboard    213
I'm of the belief that the reason these things look so difficult/insurmountable is because it's much too early for you.

The game development process should be more of a transition than anything. As you get closer to more 'difficult' concepts, you'll bet getting there with previous knowledge of things leading into it.

I can honestly say it won't be looking this difficult as you invest more time in simply learning.

Maybe you've got that itch to try and make something big this early, but the best thing you can learn in development is patience. You need to slow it down, so you can see the big picture, and to make sure you don't make any major slip-ups along the way.

So my advice is to stay with C# as you are now, and keep learning. C++ won't look nearly as difficult as it used to once you actually know how to 'program'.

Share this post


Link to post
Share on other sites
Daaark    3553
Quote:
Original post by GraySnakeGenocide
What I mean is, I want to write the stories, the characters, the CREATIVE work.
If you want to write, then write. Make a story. Writing is a worthwhile skill on it's own.

You could also try using Unity, and scripting a game. But you still need to produce art assets, which is yet another skill.

Share this post


Link to post
Share on other sites
qprmanzz    122
I understand what you mean GraySnake, at first i looked at it in a similar way, wishing to be a video game designer. However, learning about programming and getting really deep into the meatier stuff expands your knowledge of design work too. Also, the majority of programmers have great design ideas as well, which means that its a choice between someone who has great ideas and someone who has great ideas + knows how to implement them.

If you feel like you need more inspiration for programming, just imagine how much it will help you with your design ideas. For me, i have so many ideas floating around in my head all the time, i often wonder what it would look like in a game-type situation. Being able to implement your ideas of design into small projects/games while you are learning programming will really help to keep you motivated.

If you really dislike programming, then you will never be great at it, interest is the most important thing when learning anything.

I understand where you are coming from, but you just have to remember that everyone wants to be a designer and thinks they have amazing ideas. What you will find is that the most creative people will also have background knowledge, so they know what can and cant be done.

I know this all sounds harsh too, but its just you need to find a solid direction to go in. Working on video games is the dream of most guys out there (and girls too!) so you really have to know your stuff.

One piece of advice i would say is realise that it takes time. Uni courses run for 3-5 years and really push you for working at a fast pace, even then there is still more to learn. You will have to get hopes of understanding all of programming within 5 months out of your head, it simply doesnt happen.

Once again not trying to sound harsh, but you have to realise the scope of things first. Also, just a note if you are feeling like you dont 'understand' things. Alot of people wont memorize each function/class etc. etc. little bits sink in over time. I've made a handful of small games, but without looking through all the code and familiarizing (spelling?) myself with the project, it would take me a very long time to recode it from scratch. That said, now if i was to look through a similar project alot of the information would jump out at me. Its all part of a process, step by step, inch by inch.

It's really worth it when you've spent 2 hours stuck on a single problem to finally find the solution. It's a strange feeling when that finally happens. :)

EDIT: Slateboard pretty much hit the nail on the head exactly.

Just imagine you have to get to the top of the building, but the lift is broken. You have to take the stairs one step at a time. :)

Share this post


Link to post
Share on other sites
Slateboard    213
I've had friends who expressed interest in stuff like Microsoft's XNA program, and in a few weeks already had something playable. When I asked them about it, it turns out that one was a CS Grad student, and the other had just completed 4 year of CS himself. And neither one had really used C# at all, but they had experience and knew the programming concepts.

What you need to do is keep learning the concepts and gaining experience.

Share this post


Link to post
Share on other sites
ApochPiQ    23000
Quote:
Original post by GraySnakeGenocide
I didn't really want to do programming to begin with, I wanted to do the David Jaffe work, the Hideo Kojima work.

In other words, CREATIVE work.

But, I was told programming is the quickest way in, so I'm forcing myself to do it.



You were given very bad advice.


First of all, if you want to learn to design games, learn to design games. What you're doing is learning to be an industrial window washer because someone told you it's the easiest way to become an architect. (This should be clear bullshit advice when phrased as such.)

Secondly, you need to understand one thing: nobody goes out and just starts designing games and gets a job doing it. Architecture involves aesthetics, engineering, mathematics, even philosophy and sociology - many disciplines make up aspects of that design process.

Game design is no different. You must understand mathematics and statistics to balance a game. You must understand human philosophy and psychology to create compelling experiences. You must understand programming and technological limitations to build a design that can be practically realized. You must understand art, graphics, audio, music, electronics, history, anthropology - any number of areas - to really be a good designer. Without a comprehensive grasp of these facets, your work will lack in critical areas.


So I have two things to leave you with.

  • If you don't want to be a programmer, stop wasting your time trying to be a programmer.

  • If you just want to do game design because you want to make games and think that the "creative" stuff is the easy part, stop wasting our time and find something you're really willing to invest your energy into instead.

Share this post


Link to post
Share on other sites
CodeStorm    127
Just my two cents of course but, going from C# to C++ is HARDER than going from C++ to C#.

Sure, there are quite a few similarities between the two but C# is a much "tighter" language in that it does its damned best to make sure you don't screw up too much. C++ on the other hand is much "looser", which gives you more power but more rope to hang yourself upon if you abuse that power.

There are a whole host of other factors of course but, bottom line, coming from a less disciplined language to a more disciplined language seems a hell of a lot easier than the converse.

One simple example is the huge amount of in-built support that C# has for, well, just about anything. In the C++ world, you will have to write a large majority of that support yourself. Of course, libraries like Boost and the STL will help you a bit of the way, but let's face it, the .NET Framework is far richer in both scope and depth.

Saying that however, you could code in managed C++ which would have access to .NET. So this "middle" route could certainly be the best way to transition from C# to C++.

Anyway, all I can say is, be prepared to pick up some bad habits if you dive into the world of C++. With all that raw power at your disposal it would be difficult not to get seduced by the dark side!

Transitioning from C++ to C# can be a very pleasant experience! Sure, the rules are a lot tighter but, when everything just seems so damn easy, who the hell cares!

Share this post


Link to post
Share on other sites
Slateboard    213
I think his current issue is he's hung up on the languages, and he hasn't gotten the essential concepts yet.

Perhaps a book covering programming concepts (not geared to any specific language) would work?

Maybe something like this?

http://www.amazon.com/Programming-Logic-Design-Comprehensive-Farrell/dp/0538744766/ref=sr_1_1?s=books&ie=UTF8&qid=1291511155&sr=1-1

Share this post


Link to post
Share on other sites
JoeCooper    350
Fenris's post is fantastical.

As for your case, if you don't want to be a pro programmer but want to lead projects and do design work, at no point do you need C++.

You might use C# to be able to make your own prototypes and drafts, but other than that, being a serious program is a huge investment on its own and there's no reason to expect that Hideo Kojima knows anything about C++.

In fact, the Wikipedia article on him specifically says

Quote:
Kojima's gameplay ideas were often overlooked initially, and due to his lack of familiarity with programming was repeatedly snubbed for his failures in his initial years at Konami


That's not exactly going to be the case today. Non-programmers have a well understood, recognized role in the world of computer game products.

Quote:
switched to C# at a friends request, to get quicker results/work on games together.


This is what you want right now; to make games.

You don't have to be the programmer, but you do want to be able to do game design and building implementations (even if they're on paper) is a great way to test them and learn the craft.

Share this post


Link to post
Share on other sites
Ok, I went and got the O'Reilly C#: Building Windows, Web, and RIA Applications for .NET with C# 4.0 book (his newest).

What now? I have a bunch of small silly questions following:

Are his books designed to help me fully understand what the code does, or just provide the basics when it comes to those particular things.

How do I make 100% sure that I know what the code is doing, as well as knowing what code to use when I try making a game/program on my own?(I have a bad habit of forgetting things after I've read passed them).

I just want to make sure I fully utilize this book where I can program without issue. And hopefully stop asking so many newbish/annoying questions. I thought I had more questions, which I probably do, but I forgot what they are, so that's it for this moment.

Share this post


Link to post
Share on other sites
Daaark    3553
Quote:
Original post by GraySnakeGenocide
Ok, I went and got the O'Reilly C#: Building Windows, Web, and RIA Applications for .NET with C# 4.0 book (his newest).

What now?
Read it. Then find another book, and read it too. Then look at the MSDN C# tutorials (which I would look at first, maybe try your book second...) and work through those. Don't do what most do, and think you know enough to begin some big project after every little thing that you read or learn.

Quote:
I have a bunch of small silly questions following:


These questions will be self evident once you have a grasp of C#, and of programming as a whole.

You always know what the code does. Because the language keywords are broken down into tiny concepts that don't do anything meaningful on their own. You have complete control, and you will build everything from the ground up. Your programming language will only ever do what you tell it to do.

The times when you don't know what your code is doing come down to logic errors on your part. When the code is doing everything you told it to do, but you forgot to be specific enough, or handle a certain case that is causing some kind of unintended behavior.

Share this post


Link to post
Share on other sites
JoeCooper    350
Quote:
Original post by GraySnakeGenocide

knowing what code to use when I try making a game/program on my own?(I have a bad habit of forgetting things after I've read passed them).


Unfortunately, remembering things after you've passed them is pretty much all you're trying to do.

Like in Algebra class they teach you about graphs and y=x^2 and all that?

Then this past week I needed to have the computer randomly fetch a word from a list, but prefer words earlier in the list.

Then I remembered how x^2 looks on a graph between 0 and 1 - how for values of x under 3/4, y is under 2/4.

So I apply that tool to the randomizer. If I have 1000 items in the list, I fetch a random number between 0 and 1000, square it, (divide it by 1000), and zvarri, I get a 75% chance of getting an item from the first 50% of the set. A figure like 560 becomes 313.

...This is why they make you do all those story problems.

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