Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I want to learn OOP
Index -> General Discussion
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mirhagk




PostPosted: Mon Jun 04, 2012 8:19 am   Post subject: RE:I want to learn OOP

Gandalf is correct. You never stop learning. I come across new features in C# nearly every day, and every single time I'm like "Why didn't I know this before, this is awesome and totally useful". Computer science is an ever expanding field, there are always new things to learn, and new things to explore. IT'S AWESOME!
Sponsor
Sponsor
Sponsor
sponsor
linuxp




PostPosted: Thu Jun 21, 2012 5:07 pm   Post subject: Re: I want to learn OOP

[quote=
Do not start with C++. It's an older language and is really only popular in embedded systems (even then variations of basic, or other languages are common). Most of the programming nowadays is with either mobile or web platforms, both of which C++ is useless for. While it's a great language to learn, and something useful to have under your belt, it's becoming less and less popular, and it's too difficult to start with.
[/quote]

LOL, do you know. More than 80% high performance game you played on X360 Ps3 PCs were made by C++? Like war3 wow cs cod bf.... etc. All the best game engine were write by c++ too. C++ will never over date. High performance = Difficult to start != less popular !!!
jr5000pwp




PostPosted: Thu Jun 21, 2012 5:57 pm   Post subject: RE:I want to learn OOP

You also realize that they can't put a C# or java game onto the major consoles. Making your point invalid because the companies didn't have a choice.
mirhagk




PostPosted: Thu Jun 21, 2012 6:34 pm   Post subject: RE:I want to learn OOP

@jr5000pwp that's actually incorrect. C# can be run on all the current generation consoles using mono. In fact C# can be run on most devices using mono (not sure about java on consoles though).

@linuxp C++ is used because most existing engines are written using C++. In fact CPU usage in games is very minimal (compared to GPU usage, or memory usage) so using a more inefficient language doesn't matter, it actually gives the developers more time to optimize (since the algorithm is more important than the language).

Also it's been shown that in several cases JIT languages can beat compiled languages in speed, particularly in the case of vastly different platforms (ie consoles) since the JIT compiler will know the platform and it's optimizations better than the programmer (since you can't possibly hope to maintain a different set of code for every platform).
DemonWasp




PostPosted: Thu Jun 21, 2012 7:00 pm   Post subject: RE:I want to learn OOP

As far as I know, Java doesn't appear much on game consoles. It appears a lot more frequently in the embedded markets -- the bit in the JRE installer about "Java is on 3 billion devices" is more or less true.

There are ARM chipsets that run JVM bytecode directly, though few devices that support that natively exist.

A big part of the reason that the triple-A games industry is all about C++ is because everyone who works in that industry knows C++ inside and out. This is similar to the reason why that industry is mostly DirectX-based. Neither is built for the beginner: start with a simpler, safer language and two dimensions: adding a third dimension complicates everything.
[Gandalf]




PostPosted: Thu Jun 21, 2012 8:14 pm   Post subject: Re: RE:I want to learn OOP

C++ isn't a good language to learn OOP with because it's riddled with complexity, choices, and paradigms that have nothing to do with OOP. Trying to learn OOP from C++ is like trying to learn English from someone who is speaking half English and half French (and another half Spanish, etc.). It'll be a lot easier to learn OOP using a purely object oriented language, and you'll get a clearer message on what OOP is all about and what it enables.

mirhagk @ 2012-06-21, 6:34 pm wrote:
In fact CPU usage in games is very minimal (compared to GPU usage, or memory usage)

This is not true in general. Many games don't leverage multiple cores as well as they could, but they'll happily eat up the entirety of your first and often your second cores. There is even a philosophy that goes something along the lines of "if you have spare CPU cycles, put them to use by making the game look even shinier or else you're wasting them."
mirhagk




PostPosted: Fri Jun 22, 2012 10:42 am   Post subject: RE:I want to learn OOP

Yeah but shinyness is handled by the GPU, and graphics is the main focus of major games these days. As a general rule of thumb, if your system can't run a game, upgrade your graphics card. It's unlikely the game actually requires a lot out of your CPU, and rarely do they take advantage of multiple cores, hyperthreading, and 64 bit systems.
[Gandalf]




PostPosted: Fri Jun 22, 2012 6:37 pm   Post subject: Re: RE:I want to learn OOP

mirhagk @ 2012-06-22, 10:42 am wrote:
It's unlikely the game actually requires a lot out of your CPU, and rarely do they take advantage of multiple cores, hyperthreading, and 64 bit systems.

It would be fair to say that most modern CPUs are plenty good enough for basically every game, however that doesn't mean a modern CPU isn't necessary for extra shininess. Just take a look at these benchmarks - http://www.anandtech.com/show/4083/the-sandy-bridge-review-intel-core-i7-2600k-i5-2500k-core-i3-2100-tested/20 - even among modern CPUs the difference can be huge. Where a better CPU provides benefits, so too would faster code*. A lot of things that make games look good, like lots of units shooting simultaneously are still very CPU bound.

*I have a feeling like this statement isn't as true as it seems on first glance. Prove me wrong!
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Mon Jun 25, 2012 10:25 am   Post subject: RE:I want to learn OOP

CPUs can be critical for game physics.
mirhagk




PostPosted: Thu Jun 28, 2012 8:43 am   Post subject: RE:I want to learn OOP

@wtd yes they can be, but ideally graphics shouldn't hog the graphics card so much, and physics can easily be calculated on that.

@Gandalf faster code would indeed be a benefit, but that language you use/tools you use are less important than the algorithm you use, and using a language that decreases development time increases the ability to spend time on better algorithms, or major optimizations (like graphics card based physics or AI)

for a very interesting example of why C# can actually be faster is here:
http://stackoverflow.com/questions/686483/c-sharp-vs-c-big-performance-difference/687741#687741
C#'s implementation of floating point math instructions is apparently closer to the FPU's implementation which means it can optimize the calls a lot better. It is worth noting that the same optimizations can be made in C++ if you know your way around compiler optimizing flags, or if you have a sufficiently aggressive compiler that compiles different binaries for each machine.

Basically C# can let you optimize without having to optimize, you can worry on your algorithms and let the JIT worry about the processor.
[Gandalf]




PostPosted: Thu Jun 28, 2012 9:39 pm   Post subject: RE:I want to learn OOP

mirhagk, that's part of the reason why I never explicilty said C++ is good for games because it's fast. Smile Nevertheless, well written C++ is on average faster than your typical high level managed language and provides the "convenience" of being near the hardware. However, I think the main reason it's used so much in games has more to do with familiarity and legacy code in that industry.

I'm not a game developer, but as far as I'm aware it's still true that CPU intensive tasks cannot "easily" be moved to GPUs because GPUs are only good at certain types of computations (i.e. massively parallelized vector calculations). While there has been some progress in that area, I haven't heard of many games that attempt to offload physics from the CPU (with the exception of PhysX, although I'm not sure how well that actually manages to utilize your graphics card). CPUs are still pretty important for gaming!

Thread - DERAILED
mirhagk




PostPosted: Fri Jun 29, 2012 7:12 am   Post subject: RE:I want to learn OOP

I like this discussion perhaps we can move some of these posts to another thread?
bl0ckeduser




PostPosted: Fri Jun 29, 2012 11:05 am   Post subject: Re: RE:I want to learn OOP

Gandalf @ Thu Jun 28, 2012 9:39 pm wrote:
mirhagk, that's part of the reason why I never explicilty said C++ is good for games because it's fast. Smile Nevertheless, well written C++ is on average faster than your typical high level managed language and provides the "convenience" of being near the hardware. However, I think the main reason it's used so much in games has more to do with familiarity and legacy code in that industry.


Yeah, and I believe they use C++ instead of the also-fast C because the built-in OOP facilities in C++ work well with the notion of game "objects".
For example, it seems having a set of methods (like "tick" and "collide") for each object class makes programming interactions simpler, and the use of classes promotes modularization.

Of course, OOP is not an absolute in game programming. In the early days of video games, assembly language was used. Even today, some independent developers, as well as many hobbyists, write in C or assembly, likely avoiding OOP altogether.

(Apologies for further derailing this thread).

EDIT: Quote formatting
Insectoid




PostPosted: Fri Jun 29, 2012 11:57 am   Post subject: RE:I want to learn OOP

Quote:
In fact CPU usage in games is very minimal (compared to GPU usage, or memory usage)


My system monitor disagrees.

Idling:
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Running Skyrim:
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Quote:
I believe they use C++ instead of the also-fast C because the built-in OOP facilities in C++ work well with the notion of game "objects".


Also because C++ is a superset of C, and proper OOP code lets you easily add and remove features and re-use massive chunks of code for later projects, which is a lot harder (though still possible) to do with purely procedural language.
mirhagk




PostPosted: Fri Jun 29, 2012 12:32 pm   Post subject: RE:I want to learn OOP

What kind of CPU do you have, I play skyrim constantly and the only thing running high is the graphics card. Regardless skyrim is one of those games that actually does utilize it, because of the amount of objects in the game world. Games like call of duty and halo and others don't use it well. (skyrim also makes use of other's libraries in many places, which is evident by their horrendous use of a volatile sorting algorithm in the inventory screen).

Most games use C++ because code gets reused constantly in the game world, and no-one wants to rewrite the entire engine from scratch in a new language. More and more indie games are starting to use things like C# and Java, because if you're writing the engine yourself anyways, might as well use a language that will decrease development time.
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 30 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: