Hey. I have a quick question. [Will it be extremely hard to learn C++ on my own]

Discussion in 'Indie Basics' started by Mashew, May 16, 2007.

  1. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Leaving aside your distaste for microbenchmarks, do you have an example of a high performance 3d game written in Java? If you don't, then I'd say you're blowing smoke based on a theory.

    Nobody disputes that low performance 3d games can be written in any language you like.
     
  2. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Only one on release I can think of right now is Tribal Trouble, which runs on the most pathetic and lowly of systems. On my 4yr old rig (Windows XP with a 2GHz Athlon, Geforce 6800GT and a gig of RAM) it's using 80MB of RAM and 50% CPU at maximum resolution (1280x1024) and detail settings to maximum, and it's running at 75Hz.

    Newer stuff with fancier effects is coming (here's a video of some of it).

    And Quake2/3 engines written in Java have been around for years, have a look at Undead Arena - runs at around 800fps on my system.

    Supreme Commander doesn't appear to be doing anything different than any other 3D RTS - I should think that it'd run at nearly the same speed if it were written in Java too: looks like it's pretty much purely graphically bottlenecked.

    It's the "nearly" that counts - there's simply no need to gain another 10fps when you're already running at 100fps on your target systems. C++ programmers are so guilty of optimising stuff that just doesn't need to be optimised. I even do it in Java for no reason at all too but that's because I sometimes like to be perfect ;)

    Cas :)
     
    #82 princec, Aug 1, 2007
    Last edited: Aug 2, 2007
  3. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Supreme Commander: doable, nothing special about it CPU wise.

    Consoles: definitely not doable, Java's Achilles' Heel. Sun dropped the ball here. There is some vague hope for PS3. But I'm not holding my breath.

    Cas :)
     
  4. Klaim

    Original Member

    Joined:
    May 30, 2006
    Messages:
    48
    Likes Received:
    0

    O___o?


    With Total Annihilation, it's the only RTS game i know that manage combat physically, that mean that each bullet, cannon ball etc is managed by the physic engine of the game. Try the game please, at least TA, in big battle, it's easy to overload the cpu. Physics ban be a cpu problem without heavy optimisation, in every language. AI can too (look at pathfinders in Baldur's Gate for example).

    What you don't say about java games is that, yes it can be high speed but to get this you need more mastery of java and optimisation than in most other languages. It's because java focuses on the ease of define concept, then it's easy to build, say, a tool with it.

    Again, it's true that in most cases you can use java or C# to make games( i like C# most), but saying that you can achieve the same efficiency in speed and production than C++ for all games is just lying. That's why C++ is a standard in the industry (i'm not talking about indie world here). (and the fact that it don't run on a virtual machine; try to port a pc java game on console without switching to c++... ).

    If you don't trust me, try it yourself once.

    And a game that can run on low end machine, i did something like that before and it didn't need any optimization or anything (i did'nt know enough about c++ that time) as the game is not heavy. A game like Tribal Trouble is at least not heavy.

    Anyway, discussing about that is pointless, only experience and practice will tell you if i'm wrong or not. :) If you do a great game, we don't care if it's done in java or not, isn't it? :D
     
  5. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Er, precisely. The choice of algorithm is more important than the choice of development tools. The AI in Tribal Trouble is exceedingly clever.

    Well, let's face it, you can't write these kinds of games without some serious mastery of your tools can you? :)

    Cas :)
     
  6. Klaim

    Original Member

    Joined:
    May 30, 2006
    Messages:
    48
    Likes Received:
    0
    Well, not sure, as i did some verry efficient code in my first C++ programs, that i look at today to remember to never do that again (the code, not the game). :D
    But a bigger project than what i did before (it was a...strange RTS, you can say it was big for a first project) require weapon mastery that's right.

    It's simply faster to access efficiency when the language have been made in this optic first, that is not the case of Java in first instance. It have been more efficient in those last years and it's a good thing, like for C#, at least for PC game devs.

    But simply don't speak about myth when it's about the game industry, C++ is there for good reasons, it's not a fanboy caprice :)
     
  7. Mashew

    Mashew New Member

    Joined:
    May 14, 2007
    Messages:
    53
    Likes Received:
    0
    I am only in 10th grade so, I am sure that C++ will die out (to a degree) by the time I am out of college. But, I will probably still learn C++ eventually.
     
  8. electronicStar

    Original Member

    Joined:
    Feb 28, 2005
    Messages:
    2,068
    Likes Received:
    0
    That's not true, I managed to build a complete 2D in 3D framework moving thousands of huge sprites on screen at 100+ FPS and I did it in two month, learning ogl on the go and always using high level concepts.

    I don't think that C++ will ever disappear because it's the primary language making a bridge between high level programming and machine code, so it will probably remain for a long long time as a standard for hardware critical applications, but people are starting to realize that high levels of abstractions found in java are starting to become as efficient as C/C++ code, even more efficient because of the facilitated coding (which is a part of the overall performance rating).
     
  9. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    >A game like Tribal Trouble is at least not heavy.

    Oh really? It's pretty much the maximum you can do with a small team. I would also say that 99% of the current indie games would require less cpu and gpu power if they were (equally well) written in Java.

    Seriously, Java's performance is sufficient for pretty much everything you can do as an indie.

    A few years down the road even interpreted languages will be fast enough. Hardware is build to last 6 years and it's usually replaced way sooner.

    Productivity also seems to improve continuously, but at a slower rate. Thats why the speed of the language will become less important.

    Yes, it's as simple as that. Set the target specs and reach that goal with the smallest possible effort. If you chose your target wisely, it will pay off. That's all there is to it.
     
  10. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    That's only 6 years from now. The next rev of C++ is supposed to have some kind of garbage collection available, so I wouldn't count on C++ going bye-bye.
     
  11. Klaim

    Original Member

    Joined:
    May 30, 2006
    Messages:
    48
    Likes Received:
    0
    Ok, then on wich machine , in wich resolution and was there any game code behind?
    It's a serious question, i'd like to know what is exactly possible wich tools out there.


    I don't think that it's the best you can do with a small team. I'll try to prove it myself, let me some time, let say one more year XD Look at what the Introspection Software guys did with Darwinia.

    That's exactly what i said twice (if not more) ;)
    There are good reasons why C++ is widely used in industry, but it don't apply on indie gaming.

    Personnally, i choosed to use C++ in my indie wannabe project because it's the language in wich i'm experienced. I use C# for the editor. Ok i don't use c++ ONLY because it's what i know the most, but it's the main reason :D
     
  12. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Also, Sony intends for the PS3 to be a platform for the next 10 years. So if the PS3 survives its introduction, and if consoles remain C++ centric, then that will keep C++ going awhile even if it falls out of favor on the PC.
     
  13. Klaim

    Original Member

    Joined:
    May 30, 2006
    Messages:
    48
    Likes Received:
    0
    Yeah, and the most interesting feature of this garbage collector is that it is totally optional. That way, you'll have to use it only if you really need it. That is a good thing as nothing is forced, and you're in control....if you can manage your project code that is getting bigger bigger etc.
     
  14. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    But this makes the unwarranted assumption that your indie game development work really is independent. Like, you're profitable shipping your own products and you don't care what anyone else uses because you have no reason to interface or deal with anyone else's concerns. If you really are in that position, Java certainly isn't your only choice. My exotic programming language foray led me to the Chicken Scheme-to-C compiler for instance.

    Let's say instead that you're not quite independent yet, and you invest in skills partially to pay the bills. Then you have a question whether you will:
    • make your money in the game industry
    • make your money outside the game industry

    If you think you're going to want / need to do it in the game industry, you'd be well advised to consider C++, since it's the dominant language. If you're not going to do the game industry, then you need to consider how your non-game investments are going to overlap with your game investments. I don't use C++ out of any love for it, I use it because 3d companies will pay me for that skill. Now maybe your schtick will be Java and web servers, whatever, but you'd do well to decide what your strategy is going to be before blowing stuff off. Do you really want to write web servers? Does that turn you on?
     
  15. HairyTroll

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    582
    Likes Received:
    0
    There's a ton of support software that does not have to be written in C++. If writing part of the toolchain in Python or C# gets the job done in 25% of the time, then why use C++?
     
  16. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Go look at the number of jobs where people are actually requesting Python or C# as the primary skill they're interested in. I think Python still doesn't get any respect in most places, it's just "a nice plus" skill. That means if you knew a language they considered essential, and you didn't know Python, they'd just have you learn Python on the job. C# on the other hand, yes there is some call for tools experts who know a lot of C#. It's taken seriously. But, there aren't nearly as many of those C# jobs out there as C++ jobs, at least not right now.
     
  17. Fabio

    Original Member

    Joined:
    Sep 30, 2005
    Messages:
    499
    Likes Received:
    0
    The problem with JAVA IMHO is that it's not a "real language", but a language aimed at non-experts. If one looks for a language which tries to be near the humans and distant from the machine, then why not Ruby?

    If you answer on the line of "best compromise", then for me it's C++, not Java.

    Java has its merits but I also see it as a plague that is bloating the world, and has made smartphones inusable when they could have been usable if they were just coded e.g. in C++ as standard, with something like OpenGL/ES or a standard created for the purpose. Even apps like OpenOffice are full of Java now, and that's very sad. Another sad thing is .NET.. if one is scared of real programming and "just wants the job done" there are LOGO, Python, Ruby, and other languages. Now even Ruby has got a just in time "compiler"!

    Java may have the merit of being between the two worlds, or you can see it as being a big de-merit. I think on the latter line, it's neither fish nor flesh for me. Want performance? C++ + ASM. Want ease of programming? Ruby and Co.

    If you think C++ is less productive than Java then you haven't realized that real programmers don't like standard libraries and have to roll their own. When you do, even if it costs you years of work, you're certainly more productive than that Java toy, and you start to see all its (big) limits.

    I think you'll get old someday and still defend that Java toy, argh. ;)

    C++ is full of defects and imperfections, I'm the first and foremost to say it, but at least it's a real programming language (it even has inline asm as standard). :D
     
    #97 Fabio, Aug 2, 2007
    Last edited: Aug 2, 2007
  18. Fabio

    Original Member

    Joined:
    Sep 30, 2005
    Messages:
    499
    Likes Received:
    0
    "available" is good, "compulsory" (like in Java) is VERY bad.

    A lot of C++ things which are "available" thanks God aren't "compulsory", otherwise the language would be truly crap (e.g. EH, RTTI and other lead balls).

    The advantage of C++ is that it can be very low-level (and even supports inline asm) or can be extremely (even too much) high level, it's all in the fingers of the programmer.

    Whatever one may accuse C++ of being unproductive of, it's the programmer that is guilty, not the language. Its lack of standard libraries for certain tasks is due to the fact that real programmers are hard to easily agree on standard libraries, but if you write your own, C++ certainly becomes more productive than Java.
     
  19. Fabio

    Original Member

    Joined:
    Sep 30, 2005
    Messages:
    499
    Likes Received:
    0
    In fact.

    i.e. absolutely never. I would rephrase it as "if you really want it" (which is legitimate).

    Real programmers are programmers who are in control of the computer, thus real programmers need real languages. C++, with all its defects, is a real language. Java is a toy, whatever is the hate that my statament can bring me, it's the truth. :)

    If one wants a toy, he should try Ruby, not Java!
     
  20. dewitters

    Original Member

    Joined:
    Dec 19, 2005
    Messages:
    128
    Likes Received:
    0
    I just have to respond to this one. So C++ is more productive than Java but it will cost you a few years of writing your own library? Are you saying that when you start working with Java you're already years ahead of C++ ;)?

    Use the right tool for the right job, and the good thing about being indie is that you can choose yourself what that tool is :).
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer