Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  C++ vs Java  (Read 13884 times)
0 Members and 1 Guest are viewing this topic.
Offline max_x

Junior Newbie





« Posted 2006-07-27 21:21:25 »

I have looked at the Online Casino/Gaming downloadable games, and most seem to be have written in C++ / MFC.
Is this because of:
- Download speed: Is this because of the smaller size of application for downloading (about 5 MB), compared to 20+ MB for a similar Java application.
- Speed of execution: I know that Java is certainly catching up in terms of speed.

Anything else?

Thanks
max
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #1 - Posted 2006-07-27 21:44:13 »

- Ignorance

Offline woogley
« Reply #2 - Posted 2006-07-27 21:44:26 »

java games 20MB? I can think of 100+ java games that dont amount up to 20MB combined..
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online kevglass

JGO Kernel


Medals: 186
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #3 - Posted 2006-07-27 22:11:24 »

- experience I would guess also, there arn't that many professional java game developers out there (outside of the mobile market)
- cause everyone does it that way, new one tends to aswell - lack of risk takers.
- lack of visibility, some people still not aware that Java can do anything else other than those cute little applet things

Kev

Offline Martin Strand

Junior Duke





« Reply #4 - Posted 2006-07-27 22:14:00 »

They were probably written in C++/MFC because that's what the developers were used to (and therefore would be more productive with it). If you're familiar with both platforms I would say Java is easier and also has better tools.
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2006-07-28 02:56:04 »

Well, your also looking in a paotentially shadier part of the industry.

Not accusing anyone, but it is a ALOT easier to plant malware from C/C++ then from Java. 


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #6 - Posted 2006-07-29 11:48:10 »

I have looked at the Online Casino/Gaming downloadable games, and most seem to be have written in C++ / MFC.
Is this because of:

Nothing at all to do with either of those

Quote
Anything else?

Having spoken to a lot of the developers ... the primary reason, sad though it is is:

"Because Flash turned out to be too damn crap to do the job properly ... and by writing it in C++ we were able to avoid all the problems of Flash"

(or Shockwave, etc)

Really. These games tend to be written on such short timescales that there isn't much need to worry hugely about what language you're going to use, and so C++ has ended up being used as much as anything because it was "good enough to get the job done". Over time, you might well see more games move towards C# (if MS can get the massive .NET installed on enough PC's) or java (if Sun can get java installed on enough PC's and fix the webstart bugs that make it unusable for most commercial companies), because it saves dev time - but the major cost with casual and web games isn't dev time or code quality, it's game-polishing and marketing, so it's just not where people are concentrating their effort right now.

malloc will be first against the wall when the revolution comes...
Offline Amos Wenger

Senior Duke




Everything's possible, but not everything's fun...


« Reply #7 - Posted 2006-07-29 12:50:14 »

the webstart bugs that make it unusable for most commercial companies
Which are these ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Online Riven
Global Moderator

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2006-07-29 12:53:50 »

1. Using cached version when there are updated files uploaded
2. Appearantly random crashes, AKA "it worked the second time"

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2006-07-29 13:46:43 »

3. Apps looking like they've crashed because the broken desktop intergration has opened a pop-under blocking dialog.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Amos Wenger

Senior Duke




Everything's possible, but not everything's fun...


« Reply #10 - Posted 2006-07-29 13:53:51 »

Ah ok, Thanks.

2. Appearantly random crashes, AKA "it worked the second time"
I know this one  Grin Tiltilation works half the time at home ^^

But tell me how complicated it is to do an open-source replacement of WebStart ? Does it require some tricks only available to the big bad sun ?  Grin

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #11 - Posted 2006-07-29 14:24:05 »

But tell me how complicated it is to do an open-source replacement of WebStart ? Does it require some tricks only available to the big bad sun ?  Grin
I believe those already exist, I've seen at least one on sourcefourge. However the main draw with webstart is that it's pre-installed. If you're going to get the user to download and install a custom webstart then why not skip the middleman and just download and install the app directly?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Amos Wenger

Senior Duke




Everything's possible, but not everything's fun...


« Reply #12 - Posted 2006-07-29 14:56:39 »

But tell me how complicated it is to do an open-source replacement of WebStart ? Does it require some tricks only available to the big bad sun ?  Grin
I believe those already exist, I've seen at least one on sourcefourge. However the main draw with webstart is that it's pre-installed. If you're going to get the user to download and install a custom webstart then why not skip the middleman and just download and install the app directly?
I agree with you. I never understood all the noise that was made about Java Web Start.. You can simply do the following :
- You deploy from a web site, from which you detect the platform (like on the Mozilla site) and suggest the right download, YET permitting to download another version if needed
- The user then have a nice .zip file which he then unpack and find :
  - An .exe file (Win) OR
  - An executable file (*nix)
  - Something else (Mac ^^)
- Then playing is a (double-)click away !
The major issue with that is that the user really don't know where to unpack its zip file.. in Program Files ? no it's not a program, it's "java"  Grin
However this style of distribution is really simple and efficient. Tiltilation is distributed this way on Linux and it "just works".
Otherwise, an installer (IzPack, Install4j) is perfectly viable, too.

(Whoops sorry this is not really in the topic).

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #13 - Posted 2006-07-29 18:09:09 »

The "Something Else" for Mac would be an "Application Bundle"

The thing that Web Start gives you is a system that will auto update and auto select the appropriate version of Java.  Though I've rarely seen issues with running things on the latest Java release, sometimes you just want the security of running on the same version that you've tested on.

Java Web Start is only good for very simply things though...  It's not quite what client-side developers want it to be in my opinion.  It's more like an applet cache that can do applications too.

But you are right when you say a simple ZIP file will do the trick in most cases.  Just pack everything neatly in a folder so that the application remains somewhat self-contained when unzipped.  You can always put some logic into your code to check JRE versions and stuff if you need to.  Or you can zip up a JRE with the app - which sort of sucks and is the main reason that Web Start could be better.. if only developers had more control of the application install.

Online kevglass

JGO Kernel


Medals: 186
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #14 - Posted 2006-07-29 18:21:35 »

The main benefit of java webstart for games developers is the callback to get updates  - for online games designers this is has got to be a boon. I think thats pretty useful - though writing your own updater (or using one posted in Shared Code) isn't really that tricky.

If you're obsessed with using the latest and greatest VM then the ability of java webstart to get the user the next VM is useful - but they of course had to get through the initial java download/install in the first place.

JNLP as a tech is pretty nice - Webstart as an implementation is the problem.

Kev

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #15 - Posted 2006-07-29 21:27:55 »

IMHO the best thing about webstart is that apps start to behave closer to a native app - just a single click to launch, no messing around with zip files (which most users don't know what to do with), no messing with installers (that work, but are an extra few clicks) and no getting the user to run a .jar (which may have had it's extension pinched by winzip or winrar anyway).

However as Kev said the current implementation is pretty bad. Theres a whole load of bugs, and users just don't know where to find the app when they run it again (app / applet cache is a pretty good summary of the current state of play).

I'm toying with the idea of a webstart 'installer' - a webstart app which does little more than prompt the user for an install dir and copy the app into it. You still need a JRE + webstart, but it makes the whole thing a little closer to a native app (probably with a .exe stub for windows users too). You'd loose the auto update for the app itself, but you could always use an existing 3rd party lib for that.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline paulohap

Innocent Bystander




Java games rock!


« Reply #16 - Posted 2006-11-09 20:20:36 »

Star wars galaxies is a good example of a java Game.
Offline SluX

Junior Duke





« Reply #17 - Posted 2006-11-10 07:57:56 »

Star wars galaxies is a good example of a java Game.
Is it pure java?

"Intelligence is the most beautiful gift and the greatest temptation which one life can receive from the gods."Me Cheesy
Play strategic football
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #18 - Posted 2006-11-11 02:34:36 »

Star wars galaxies is a good example of a java Game.

In that ... it's not written in Java?

Seriously.

malloc will be first against the wall when the revolution comes...
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #19 - Posted 2006-11-12 05:06:56 »

It's a funny thing to hear these things. But tiresome.

Quote
- Speed of execution: I know that Java is certainly catching up in terms of speed.

Why do people always focus on speed? Speed is so trivial compared to other factors, such as: reliability, standardization, orthogonality, writability and readability.

C++ does poorly in all those categories I mentioned.

If speed was really so important we would all be writing in assembly today, but you know what, speed is not a big factor when it comes to application performance!

And even so, Java is performing *nearly* as good as C++ anyway. I've seen some benchmark comparisons, and they are all promising for Java.

So, why would ANYONE choose a language that performs worse in all categories, except maybe one where the differences are so trivial it doesn't matter?


Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Online Riven
Global Moderator

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #20 - Posted 2006-11-12 11:37:18 »

In 3d games it's all about raw speed. Same for realtime simulation-software.

For GUI and (not too busy) webservers, a difference of factor 2 would hardly be noticed.

That doesn't mean performance is a trivial argument, because Java is used on busy webservers and is now also more and more being used in realtime simulation and 3d games (ok, a few).

Still native SSE beats the the crap out of array/vector-math inside the JVM with over 30-50% faster execution. (>400% for sqrt) We desperately need some native math library that's not attached to some other (commercial) project.

The latest hardware seems to make everything 'fast enough' to be interactive, but in the 3d-game-world, it's about getting all possible performance out of the hardware, which is never 'fast enough'. I remember in some wicked Sony interview about performance on the PS3 where an artist said: "in the old days, we had to put a lot of effort in optimizing the engine, with the hardware of the PS3, we can do everything without worrying about performance!" - don't you just love those idiotic marketing talk?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #21 - Posted 2006-11-12 13:44:42 »

we originally planned a vector math lib for lwjgl, but no one was experienced enough to handle it - and especially on multiple platforms.

Online Riven
Global Moderator

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #22 - Posted 2006-11-12 14:14:12 »

I have an API that converts mathematical expressions like:

"FloatBuffer a, float b, FloatBuffer c"
"c = a * b;"

(this is the simplest expression ofcourse)

into 3 types of output:
Java FloatBuffers (explicit unrolled loops+ finalizer loop)
Java Unsafe (explicit unrolled loops+ finalizer loop)
Native C (using SSE) + Java side binding


So far it only does win32, though.

The problem is, I can't get it to compile because my C-compiler borks at the instrincs, but Darkprophet got it to work with his compiler, and walked away with it for Volatile-Engine.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #23 - Posted 2006-11-12 14:21:10 »

[...]I remember in some wicked Sony interview about performance on the PS3 where an artist said: "in the old days, we had to put a lot of effort in optimizing the engine, with the hardware of the PS3, we can do everything without worrying about performance!" - don't you just love those idiotic marketing talk?

Haha. Well, that time will come. One day you'll be able to simulate a complex world, photorealistic graphics... and all that written in interpreted basic. Then you really dont need to worry about performance anymore.

Regarding java and the present... I dont worry about java's performance anymore. I can do the stuff I always wanted on 6 year old hardware and that with a fraction of the coding time.

弾幕 ☆ @mahonnaiseblog
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Reply #24 - Posted 2006-11-12 15:25:59 »

Quote
The problem is, I can't get it to compile because my C-compiler borks at the instrincs, but Darkprophet got it to work with his compiler, and walked away with it for Volatile-Engine.

Errr, that never happened. And if my memory serves me right, you were a developer for a short time on VE too. And second of all, I didn't *just* compile the thing...i wrote it with you. The only reason we didn't release that is because we had a personality clash...

I still have the code lying around if you would like to continue the project peacefully Smiley

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Online Riven
Global Moderator

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #25 - Posted 2006-11-12 15:47:18 »

I didn't say 'ran away, looking back trying not to get caught', i said 'walked away with it', you used it, nothing more, nothing less, maybe poor phrasing.

Let's not get into an argument about who did what, as we both know it.

The only condition I'd want to continue on it, would be to have it not contain any reference to VE, like it has now (the package-name that you changed).

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Reply #26 - Posted 2006-11-12 18:30:25 »

Thats fine with me, as long as the community gets something from it, im happy Smiley. You know my email...

Maybe Volatile-Math Grin (joke)

PS. I have linux to compile things on too, so cross platfromness should be easy (hope the macs aren't going to be a problem...although my university does have a mac lying around)

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline SluX

Junior Duke





« Reply #27 - Posted 2006-11-13 09:41:27 »

I have an API that converts mathematical expressions like:

Can i get a glimpse on your api?

Smiley

I agree with u regarding raw speed, but not all games require maxed performance.....and they can still earn cash.

"Intelligence is the most beautiful gift and the greatest temptation which one life can receive from the gods."Me Cheesy
Play strategic football
Online Riven
Global Moderator

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #28 - Posted 2006-11-13 10:56:06 »

The sourcecode is kinda blackmagic, but here is some input/output:


Input settings:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
Declarations:
FB a;
f b;
FB d;
* e;

Statements: (for a lerp function)
e=b-a
e=e*c
d=e+a



Generated C code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
// e=b-a; e=e*c; d=e+a
JNIEXPORT void JNICALL JNICALL Java_com.eyeriv.simd_PerfMath_lerp0(JNIEnv * env, jclass clazz, jobject aBuf, jint aPos, jobject bBuf, jint bPos, jfloat cVal, jobject dBuf, jint dPos, jint elements) {
   
   int fastLoops = elements / 4;
   int slowLoops = elements % 4;
   
   long* aAddr = (long*) env->GetDirectBufferAddress(aBuf);
   long* bAddr = (long*) env->GetDirectBufferAddress(bBuf);
   long* dAddr = (long*) env->GetDirectBufferAddress(dBuf);
   
   float* aData = ((float*) aAddr) + aPos;
   float* bData = ((float*) bAddr) + bPos;
   float* dData = ((float*) dAddr) + dPos;
   
   __m128* aPnt = (__m128*) aData;
   __m128* bPnt = (__m128*) bData;
   __m128  cPnt = _mm_set_ps1(cVal);
   __m128* dPnt = (__m128*) dData;
   __m128  ePnt = _mm_set_ps1(0.0f);
   
   float eTmp;
   
   
   int shift = fastLoops * 4;
   aData += shift;
   bData += shift;
   dData += shift;
   
   for (int i = 0; i < fastLoops; i++) {
       ePnt = _mm_sub_ps(*bPnt, *aPnt);
       ePnt = _mm_mul_ps( ePnt,  cPnt);
      *dPnt = _mm_add_ps( ePnt, *aPnt);
      aPnt++; bPnt++; dPnt++;
   }
   for (int i=0; i < slowLoops; i++) {
       eTmp = (*bData) - (*aData);
       eTmp =  eTmp *  cVal;
      *dData =  eTmp + (*aData);
      aData++; bData++; dData++;
   }
}



Generated Java code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
   /**
    * e=b-a; e=e*c; d=e+a
    */

   public final void lerp(FloatBuffer a, FloatBuffer b, float c, FloatBuffer d) {
     
      checkBuffers(a, b, d);
     
      int elements = a.remaining();
     
      float e;
     
      boolean fast = (a.position() | b.position() | d.position()) == 0;
      int fastLoops = fast ? (elements / 8) : 0;
      int fastFinish = fastLoops * 8;
     
      int aPos = a.position() + fastFinish;
      int bPos = b.position() + fastFinish;
      int dPos = d.position() + fastFinish;
     
      for (int pntr = 0; pntr < fastFinish;) {
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
   
         e = b.get(pntr) - a.get(pntr);
         e = e * c;
         d.put(pntr, e + a.get(pntr)); pntr++;
      }
     
      for (int i = fastFinish; i < elements; i++) {
         e = b.get(bPos) - a.get(aPos);
         e = e * c;
         d.put(dPos, e + a.get(aPos));
         
         aPos++; bPos++; dPos++;
      }
   }

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #29 - Posted 2006-11-13 11:40:47 »

In 3d games it's all about raw speed. Same for realtime simulation-software.

For GUI and (not too busy) webservers, a difference of factor 2 would hardly be noticed.

IMHO, that's not true at all. A factor of 2 performance is ALWAYS noticed. For instance, if the webserver runs twice as fast, you can use much cheaper hardware (hosting companies always have "old" servers lieing around not being used that they'll rent to you cheaper).

Quote
I remember in some wicked Sony interview about performance on the PS3 where an artist said: "in the old days, we had to put a lot of effort in optimizing the engine, with the hardware of the PS3, we can do everything without worrying about performance!" - don't you just love those idiotic marketing talk?

Just going by the publicly available info on the PS3, that's blatantly not true Smiley.

malloc will be first against the wall when the revolution comes...
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!