• 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
stein102

C++ V.S Java for game programming.

32 posts in this topic

[quote name='medv4380' timestamp='1327443572' post='4905906']
C is best if you're going for speed.
C++ has many of the same slowdowns as Java does now. In fact today Java7 is about as fast as C++.[/quote]Uh,[color=#0000ff] [sup][citation needed][/sup][/color]
I'd like to see a benchmark proving this, where it wasn't simply because someone had written [url="http://macton.smugmug.com/gallery/8936708_T6zQX#!i=593426709&k=ZX4pZ"]crappy C++[/url] code.
You should be able to get the same assembly out of a C and C++ solution to a problem...
1

Share this post


Link to post
Share on other sites
[quote name='medv4380' timestamp='1327444141' post='4905917']
[quote name='alnite' timestamp='1327441512' post='4905894']
If Windows doesn't ship with a JRE, then that's Windows fault, which is obvious since they are promoting .NET.
[/quote]

No Microsoft is forbidden from bundling a Java Virtual Machine with Windows due to being caught being evil. [url="http://en.wikipedia.org/wiki/Microsoft_Java_Virtual_Machine"]http://en.wikipedia....Virtual_Machine[/url]
[/quote]

They are forbidden from bundling their own incompatible JVM, They could license Oracles (But they don't want to do that, as the court case showed they intentionally made their version incompatible in an attempt to make many Java applets non portable and thus reduce the threat of crossplatform applications)
0

Share this post


Link to post
Share on other sites
[quote name='medv4380' timestamp='1327444141' post='4905917']
[quote name='alnite' timestamp='1327441512' post='4905894']
If Windows doesn't ship with a JRE, then that's Windows fault, which is obvious since they are promoting .NET.
[/quote]

No Microsoft is forbidden from bundling a Java Virtual Machine with Windows due to being caught being evil. [url="http://en.wikipedia.org/wiki/Microsoft_Java_Virtual_Machine"]http://en.wikipedia....Virtual_Machine[/url]
[/quote]
Interesting, especially the embrace, extend, extinguish strategy.

Is there any anti-trust law that's preventing Microsoft from installing the same JRE that's provided by Sun/Oracle (rather than creating their own)?
0

Share this post


Link to post
Share on other sites
[quote name='Hodgman' timestamp='1327449108' post='4905935']
[quote name='medv4380' timestamp='1327443572' post='4905906']
C is best if you're going for speed.
C++ has many of the same slowdowns as Java does now. In fact today Java7 is about as fast as C++.[/quote]Uh,[color=#0000ff] [sup][citation needed][/sup][/color]
I'd like to see a benchmark proving this, where it wasn't simply because someone had written [url="http://macton.smugmug.com/gallery/8936708_T6zQX#!i=593426709&k=ZX4pZ"]crappy C++[/url] code.
You should be able to get the same assembly out of a C and C++ solution to a problem...
[/quote]

Here: [url="http://shootout.alioth.debian.org/"]http://shootout.alioth.debian.org/[/url]

If you don't like the crappy C++ code of any of the implementations, I think there are ways for you to submit a better one. But C and C++ are pretty much the same in that comparison.
0

Share this post


Link to post
Share on other sites
[quote name='alvaro' timestamp='1327455861' post='4905964']Here: [url="http://shootout.alioth.debian.org/"]http://shootout.alioth.debian.org/[/url]
If you don't like the crappy C++ code of any of the implementations, I think there are ways for you to submit a better one. But C and C++ are pretty much the same in that comparison.[/quote]Yeah the C/C++ ones are almost the same, and Java is generally much more RAM heavy...
However, I just picked the "binary trees" test at random to look at the [url="http://shootout.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gcc&id=7"]C[/url] and [url="http://shootout.alioth.debian.org/u64q/program.php?test=binarytrees&lang=gpp&id=6"]C++[/url] versions, and this isn't a benchmark of C vs C++ at all! It's actually a benchmark of [url="http://apr.apache.org/docs/apr/0.9/group__apr__pools.html"]Apache pools[/url] vs [url="http://www.boost.org/doc/libs/1_41_0/libs/pool/doc/interfaces/object_pool.html"]Boost pools[/url], seeing as the choice of memory pool API is the only significant difference between the two versions of the code.

You could say that APR is more idiomatic for C, and Boost is more idiomatic for C++ ([i]in which case, you're still benchmarking "idiomatic libraries" instead of benchmarking the actual languages[/i]), but both versions of the code are using malloc/free/sprintf, instead of their idiomatic equivalents... so this benchmark isn't at all valid as a way to compare languages, or even as a way to compare "typical" usage of languages!
0

Share this post


Link to post
Share on other sites
This should satisfy your benchmark source request, and it should give you an ample number of languages to do additional comparisons.
[url="http://shootout.alioth.debian.org/u32/java.php"]http://shootout.alio...rg/u32/java.php[/url]

First Java7 has vastly improved from Java6 but that's 5 years of updated given in 1 version.

Java 7 beats C++ and C in the the K-Nucliotide benchmark by 4 to 5 seconds.
[url="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=java&lang2=gcc"]http://shootout.alio...=java&lang2=gcc[/url]
Java 7 beats C++ in the fasta benchmark by ~1 second but loses to C by .1 seconds
[url="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=java&lang2=gpp"]http://shootout.alio...=java&lang2=gpp[/url]

C flat out wins or nearly ties vs C++ in everything except the K-Nucliotide test
[url="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=gcc&lang2=gpp"]http://shootout.alio...g=gcc&lang2=gpp[/url]

C when written properly beats C++ hands down.
The drawback of C is really that some more complex tasks are a pain to write without objects.

Java's main drawback is usually memory, but it's not as bad as most people think. Sure you have some where the Binary-Tree test ends up with Java taking nearly 5x the amount of memory C does, and on even small tests it still has to load a 10-15 meg virtual machine. However, somethings like the reverse complement test it takes nearly the same amount of memory as C does.

Java also attracted every programmer who was incapable of managing memory properly in C and C++ so there are a lot of bad memory structures out their in Java because at least it doesn't do the delayed crash thing C and C++ does when you mess with the memory the wrong way. Just because java has a garbage collector doesn't mean you can ignore memory, but that's what a lot of Java programmers do.
0

Share this post


Link to post
Share on other sites
For the love of all things holy,

[size=7]WHO CARES?[/size]

[size=3]You can't even benchmark a language. You can only benchmark a particular implementation of a language and a particular usage of that language, both of which are highly sensitive to change (use a different language implementation or a different programmer, and BAM! all the numbers change).[/size]

[size=3]Can we please, please let this thread die?[/size]
0

Share this post


Link to post
Share on other sites
[quote name='medv4380' timestamp='1327468097' post='4906005']
This should satisfy your benchmark source request, and it should give you an ample number of languages to do additional comparisons.
[url="http://shootout.alioth.debian.org/u32/java.php"]http://shootout.alio...rg/u32/java.php[/url]

First Java7 has vastly improved from Java6 but that's 5 years of updated given in 1 version.

Java 7 beats C++ and C in the the K-Nucliotide benchmark by 4 to 5 seconds.
[url="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=java&lang2=gcc"]http://shootout.alio...=java&lang2=gcc[/url]
Java 7 beats C++ in the fasta benchmark by ~1 second but loses to C by .1 seconds
[url="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=java&lang2=gpp"]http://shootout.alio...=java&lang2=gpp[/url]

C flat out wins or nearly ties vs C++ in everything except the K-Nucliotide test
[url="http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=gcc&lang2=gpp"]http://shootout.alio...g=gcc&lang2=gpp[/url]

C when written properly beats C++ hands down.
The drawback of C is really that some more complex tasks are a pain to write without objects.

Java's main drawback is usually memory, but it's not as bad as most people think. Sure you have some where the Binary-Tree test ends up with Java taking nearly 5x the amount of memory C does, and on even small tests it still has to load a 10-15 meg virtual machine. However, somethings like the reverse complement test it takes nearly the same amount of memory as C does.

Java also attracted every programmer who was incapable of managing memory properly in C and C++ so there are a lot of bad memory structures out their in Java because at least it doesn't do the delayed crash thing C and C++ does when you mess with the memory the wrong way. Just because java has a garbage collector doesn't mean you can ignore memory, but that's what a lot of Java programmers do.
[/quote]

You have to remember that it is still not a language benchmark, its a benchmark of various benchmark programs for a set of language implementations and while it does give you an idea of how fast something can be done with a specific implementation you really have to look at the code to see why the results are the way they are. (the C(GCC) implementation of binary trees for example uses OpenMP for parallell for loops while the Java implementation is singlethreaded.
For the K-Nucliotide benchmark both Java and C have multithreaded implementations but use fairly different approaches to the multithreading itself (Which has a huge impact, I'm guessing that the Java version wins simply due to the difference in threading methods used (Writing safe and well performing multithreaded code is alot easier in Java than it is in C))

C has both the fastest and the slowest implementations in alot of the tests, (CINT being the big loser and GCC usually the winner (both are C implementations)).

Performance have very little to do with the language (Allthough Javas fairly strict precision requirements does give it a disadvantage on platforms such as x86 and ARM for some operations), the code you write will always be the most important part followed by the quality of the compiler/VM/runtime you use to build/run the application.
1

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