Game Programming Primer - Page 3
Forum Index > General Forum |
simpler
Sweden49 Posts
| ||
Fandango
291 Posts
On November 18 2012 15:24 RayzorFlash wrote: Bookmarked and saved! The Quick Refresher stuff is SO IMPORTANT and so amazingly well put together. A lot of the fundamentals in there is what people in the industry REALLY look for when hiring and during interviews. This is an amazing review sheet to use before an interview. Thanks a lot!!! :D It really isn't, it's more the stuff you're expected to know in the same way you're expected to know how to type. Most questionnaire type things on stuff like that are just there to catch people who literally know nothing and forgetting how a hashmap is stored internally is not going to stop you from getting the job if you get most of the other stuff right. Good interviewers who want good hires will generally place a lot of emphasis on a pre-interview programming test as well as asking you about situations you most likely have not dealt with to see your problem solving ability. Software engineering whether it's games or anything else is 80% problem solving using as elegant solutions as you can come up with, it's not about writing constantly heavily optimised code all the time, even on AAA projects. It's about finding solutions to problems that don't end up causing more problems, whether that's a performance problem or a dependency issue or whatever. You learn how to do this mostly from experience, you can know what code pattern X is, but unless you know the situations where it's an actual benefit instead of a theorhetical one it's largely irrelevant knowledge. You learn to make games by making games, you don't learn to make games by making game engines that you think are so elegantly designed that in theory anyone could make any game ever on it, because you don't know yet what the real issues are going to be. It's the most common habit of the student games programmer where they're so obsessed with doing things 'properly' by their own definition of whatever that may be, that they never run into the real problems they'll actually have to deal with. | ||
nimdil
Poland3746 Posts
On November 18 2012 02:16 1handsomE wrote: That's like 2 years of comp sci in an essay!!!! Noobs might want to take it slow, but this is good introduction. You meant newbs, Noobs won't bother. Also not exactyl justified because to actually apply all the information presented here you have to have a LOT of comp sci knowledge not mentioned directly here. But nicely put indeed. | ||
Radiated11
United States32 Posts
| ||
moxley
United States65 Posts
| ||
kYem
United Kingdom412 Posts
As moxley said, i do feel Java has a lot bigger market share, so it's very good investment as you can find a well paid job, while it would be very difficult to get one for c++ in a software company. Maybe someone did a switch from Java to c++ and can share their experiences. | ||
iamke55
United States2806 Posts
On November 18 2012 21:00 uZr wrote: That's some insane amount of work you put in there, congrats ! However some things are just bugging me. What do you mean by "name of an array will be converted to a pointer" ? Strictly speaking those two things are just the same: pointers. the name[idx] syntax is just some syntaxical sugar over doing *(name+idx). Furthermore the "size of the array" is never stored anywhere in C. You can write it explicitly when allocating on the stack, but it will eventually get lost when compiled, and the compiler won't give you any warning if you access out of bounds entries. What he means is something that will rarely ever come into effect, but nonetheless is true. To see the difference between an array name and a pointer to the first element, run this test program.
b should have a size of the number of characters plus the null at the end, while a's size is the number of bytes a pointer uses. If you pass the array name as a function argument, it is cast to a pointer. | ||
iaretehnoob
Sweden741 Posts
On November 18 2012 21:00 uZr wrote: What do you mean by "name of an array will be converted to a pointer" ? Strictly speaking those two things are just the same: pointers. [...] Furthermore the "size of the array" is never stored anywhere in C. You can write it explicitly when allocating on the stack, but it will eventually get lost when compiled, and the compiler won't give you any warning if you access out of bounds entries. Here's an example:
The size of the array is "stored" in the source code you wrote, e.g. it is available to the compiler, hence the difference between sizeof(array) and sizeof((int*)array) and in C++11 the ability to use static arrays with range-based for (and STL algorithms by using begin()/end()). Then there's std::array as a wrapper around plain arrays, which should be preferable in most situations, even if I haven't gotten used to it myself yet. edit: does this still count as ninja'd? :S | ||
CecilSunkure
United States2829 Posts
On November 19 2012 00:18 moxley wrote: While C++ is absolutely favored for high performance platform-specific programs like games, you shouldn't dismiss java as a language for aspiring software engineers. Many people start out wanting to be a "game programmer" but when you look outside that narrow field you'll realize that java is huge in enterprise web applications which make up a large majority of the market for software engineering. Thank you for the comment. I don't mean to entirely dismiss Java outside of the field I've been writing about, but really just meant to express what I've learned in regards to it and game programming professionally. On November 19 2012 01:21 iamke55 wrote: What he means is something that will rarely ever come into effect, but nonetheless is true. To see the difference between an array name and a pointer to the first element, run this test program.
b should have a size of the number of characters plus the null at the end, while a's size is the number of bytes a pointer uses. If you pass the array name as a function argument, it is cast to a pointer. Thanks for explaining that ke. On November 19 2012 00:52 kYem wrote: I'm learning Java right, however i would love to learn c++ as well, just wondering how similar these to language are or how hard it's compared to Java. As moxley said, i do feel Java has a lot bigger market share, so it's very good investment as you can find a well paid job, while it would be very difficult to get one for c++ in a software company. Maybe someone did a switch from Java to c++ and can share their experiences. I wish I could tell you specifics, but I can just tell you sort of second hand experience I've had. I've used quite a few languages with garbage collection and no real sense of memory management. All in all, I feel with using languages like these you learn how the most basics of programming works. You can learn how to use abstract data types, can learn about algorithms and design patterns, can learn a little bit about how to write efficient code, but won't really truly understand what's going on under the hood. There's no concept of where in memory things are, how long things exist for, what sort of caching impact your memory access is incurring, or anything of the like. When using a higher level language you can learn about lower level details in theory, but with C or C++ (or even assembly if you have the luck of finding courses offered in it) you can learn first-hand directly about these things. This really is just shooting in the dark, but it feels like learning with Java in a lax curriculum compared to learning in C/C++ in a rigorous curriculum is like playing SC2 without learning how to make efficient use of your mouse and keyboard. Sure there's tons and tons of people in bronze up through low master who can "get by" and do fairly well without using more than one hotkey while flailing their mouse around widely. But the people who are really sought after are the ones who have mastered the fundamentals of their keyboard, mouse, and playing mechanics because these are the people that can really spend their time focusing on implementing strategies to defeat their opponents. Thanks to everyone else! Glad you all like the article | ||
uZr
20 Posts
On November 19 2012 01:21 iamke55 wrote: What he means is something that will rarely ever come into effect, but nonetheless is true. To see the difference between an array name and a pointer to the first element, run this test program. b should have a size of the number of characters plus the null at the end, while a's size is the number of bytes a pointer uses. If you pass the array name as a function argument, it is cast to a pointer. Thanks for the heads up, I had not thought about that particular case, when it indeed makes much more sense And that's indeed something I use with array of variable size once in a while (which does not work when you're forced to restrict to ANSI C for some work ^^). Never thought of it like it was phrased by OP though, but that's indeed probably the best way to write that. (English isn't the language in which I learnt programming at first, which sometimes cause me to misunderstand some specific terms). | ||
spinesheath
Germany8679 Posts
On November 19 2012 03:21 CecilSunkure wrote: This really is just shooting in the dark, but it feels like learning with Java in a lax curriculum compared to learning in C/C++ in a rigorous curriculum is like playing SC2 without learning how to make efficient use of your mouse and keyboard. Sure there's tons and tons of people in bronze up through low master who can "get by" and do fairly well without using more than one hotkey while flailing their mouse around widely. But the people who are really sought after are the ones who have mastered the fundamentals of their keyboard, mouse, and playing mechanics because these are the people that can really spend their time focusing on implementing strategies to defeat their opponents. It's the other way round. Starting with C++ is like starting with learning elaborate build orders, while starting with higher level languages is like learning how to control your units (how to use the existing units/classes, instead of how to produce these classes/units in detail). In programming, the people who are sought after are those who can finish a given task quickly using robust code, using whatever means is appropriate. Nobody cares if you know every single detail of all the machines your code might ever run on as long as your code solves the given task (that includes a certain level of performance), is produced quickly (= reduced cost) and robust (= reduced cost in the long run). Highly optimized C++ code is often fragile and costly to produce (especially if you aren't really(!) good with templates). That's why you use high level constructs in C++ pretty much everywhere except for the critical code parts. But since you do that anyways, you might as well start with something like C# instead, because it's very much like using high level constructs in C++, except easier and more robust. Oh and of course there is a concept of memory management in these languages. The general workings of these garbage collectors are no secrets. You should be roughly aware of how your garbage collector works. C++ doesn't force you to learn about the details of new/delete either (and the new algorithm can hardly be called simple, plus it's OS dependant). | ||
nimdil
Poland3746 Posts
On November 19 2012 00:52 kYem wrote: I'm learning Java right, however i would love to learn c++ as well, just wondering how similar these to language are or how hard it's compared to Java. As moxley said, i do feel Java has a lot bigger market share, so it's very good investment as you can find a well paid job, while it would be very difficult to get one for c++ in a software company. Maybe someone did a switch from Java to c++ and can share their experiences. Java is defeinitely the biggest language in business/enterprise/corporate environment. Unofrtunately Java is also bloated pain in the ass :/ I'd choose C# over Java anytime I can use Windows platform. | ||
Kerm
France467 Posts
On November 19 2012 07:05 spinesheath wrote: It's the other way round. Starting with C++ is like starting with learning elaborate build orders, while starting with higher level languages is like learning how to control your units (how to use the existing units/classes, instead of how to produce these classes/units in detail). In programming, the people who are sought after are those who can finish a given task quickly using robust code, using whatever means is appropriate. Nobody cares if you know every single detail of all the machines your code might ever run on as long as your code solves the given task (that includes a certain level of performance), is produced quickly (= reduced cost) and robust (= reduced cost in the long run). Highly optimized C++ code is often fragile and costly to produce (especially if you aren't really(!) good with templates). That's why you use high level constructs in C++ pretty much everywhere except for the critical code parts. But since you do that anyways, you might as well start with something like C# instead, because it's very much like using high level constructs in C++, except easier and more robust. Oh and of course there is a concept of memory management in these languages. The general workings of these garbage collectors are no secrets. You should be roughly aware of how your garbage collector works. C++ doesn't force you to learn about the details of new/delete either (and the new algorithm can hardly be called simple, plus it's OS dependant). Cecil is right. As far as game programming is concerned, at least for Console/PC high-end titles, C++ is the way to go. If you want to break into that part of the industry, you are wasting your time if you're not gearing toward being excellent at C++. What you are explaining probably makes sense for general sofware engineering, but game programming is different. | ||
spinesheath
Germany8679 Posts
On November 20 2012 01:38 Kerm wrote: Cecil is right. As far as game programming is concerned, at least for Console/PC high-end titles, C++ is the way to go. If you want to break into that part of the industry, you are wasting your time if you're not gearing toward being excellent at C++. What you are explaining probably makes sense for general sofware engineering, but game programming is different. I'm saying C# will teach you how to program properly in C++, except that you can focus on one aspect (algorithms, software engineering/architecture) without having to fight with all the problems C++ throws at beginners. The step from C# to C++ is rather easy assuming you learnt C# properly. You pick a book like The C++ Programming Language which covers all the technical language details and you're set. It's divide and conquer applied to learning C++. | ||
CecilSunkure
United States2829 Posts
On November 20 2012 05:43 spinesheath wrote: I'm saying C# will teach you how to program properly in C++, except that you can focus on one aspect (algorithms, software engineering/architecture) without having to fight with all the problems C++ throws at beginners. The step from C# to C++ is rather easy assuming you learnt C# properly. You pick a book like The C++ Programming Language which covers all the technical language details and you're set. It's divide and conquer applied to learning C++. Although it sounds like it would work theoretically, I don't really have any experience with anyone learning C++ by learning another language and I can't really judge it for myself. I do know that the people I'm around graduate and are very successful, and they learned C, then C++. | ||
spinesheath
Germany8679 Posts
On November 20 2012 05:49 CecilSunkure wrote: Although it sounds like it would work theoretically, I don't really have any experience with anyone learning C++ by learning another language and I can't really judge it for myself. I do know that the people I'm around graduate and are very successful, and they learned C, then C++. I have never seen anyone start with C/C++ and get good with it reasonably fast and without producing really awful code until some magical turning point. Me included. C++ is so deep, and if you don't even know how to properly design a program yet it's overwhelming. | ||
Sapp
Poland173 Posts
| ||
skorched
United States81 Posts
| ||
Tobberoth
Sweden6375 Posts
Thing is though, C/C++ development is becoming more and more of a niche. Like Cecil is saying, in progessional game development, for AAA titles etc, C/C++ is definitely the way to go. That's not to say you need to know C/C++ to work profesionally as a game programmer, pretty much all smartphone games and pretty much all Xbox Live Arcade games etc are coded using more highlevel languages like C#, Objective-C and Java. | ||
phar
United States1080 Posts
The point is, if you're just starting out in industry, your previous experience in a given language isn't going to even come close to preparing you for the volume of random weird shit that's going to come crawling out of the woodwork to bite you in the ass. You can only learn that stuff when you're hammering away at it for 50+ hours a week on the job. If you started with Java in Uni and are now doing enterprise c++, it's not that much different from starting with c++ in Uni and doing enterprise c++. The more important part is to be really enthusiastic about it, and be willing to learn whatever is thrown at you as quickly as possible. That's the really good part of the OP; it's something someone can easily use to get more excited about programming in general. | ||
| ||