Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
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  
  Java vs C++  (Read 7620 times)
0 Members and 1 Guest are viewing this topic.
Offline kfoong

Senior Newbie




umm... something...


« Posted 2003-07-28 07:12:37 »

I've just been trying to learn to do C++ Win32 programming using Visual C++, and I've given up on it because it was co complicated. I read somewhere that learning java beforehand makes learning C++ easier. I've looked at the java language and its way easier than Win32 C++ (in my opinion). So I was hoping for my Java skills to be a full path not just a step towards Win32 C++. But there's a problem. I've read in an article that Java is about 20 to 50 times slower than C++. But it also said it keeps getting upgraded to make it faster. Another thing that is bothering me in java is the buttons but im quite sure that you can change them.  Another thing is that I've never heard of a commercial game that is made from java. So can someone tell me more good points about java and the commercial games that were made by it?
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #1 - Posted 2003-07-28 07:24:00 »

Forget about the performance issue - C++ and Java are near to even in complex projects.

Forget about learning Java to get closer to C++. You will never be able to enjoy C++ if you've worked with Java once.

Commercial games with Java .... ok, thats difficult. There are only very small-scale examples .... you'd be the first....

But if you are dealing with buttons and try to learn a language, you really shouldn't bother about commercial games. There is still a long way to go and everything can happen on that way.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline kfoong

Senior Newbie




umm... something...


« Reply #2 - Posted 2003-07-28 09:40:24 »

so what do you think i should do then? Forget about java and learn C++?  Sad
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #3 - Posted 2003-07-28 10:12:13 »

What's your goal, and which goal is in reach?

I don't advice anybody to learn C++ the days. C++ is kind of the COBOL of this millenium. It's ugly and difficult.

But C++ IS the de facto gaming standard language today for mainstream games. No way around that.
So if you want to write a AAA, mainstream title NOW, use C++. But can you really do that? It's LONG way from learning a language to writing a AAA game. 5 years?

Much closer would be to write simple (or not so simple) applet games? Learn the principles of OO? Java is good for that.

As I mentioned, learning Java takes you far away from knowing C++. But maybe, in 5 years, C++ is no longer a must. I don't know wether Java will be the no.1 language that (to be honest, I doubt that), but I'm quite sure the one of the newer languages around (like Java, C#) will be the language of choice.

And - you can use you Java knowledge very good if you don't do games.....

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline princec

JGO Kernel


Medals: 362
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2003-07-28 10:36:33 »

Hey! We're commercial! Cool

Cas Smiley

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #5 - Posted 2003-07-28 10:45:14 »

Yes, sure, commercial, I know.

I hope it's no offense grouping AF under 'small-scale' - the scale ranges up to SplinterCell, HL2 and such.

(BTW, as soon as I get a new job, I will buy me an AF...  Wink )

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline kfoong

Senior Newbie




umm... something...


« Reply #6 - Posted 2003-07-28 11:03:01 »

My goal is to make a programming language  that makes games easily. Like Game Maker, 3D Game Studio, Dark Basic, and Blitz Basic 3D. Would Java be the 'appropriate' language to use?
Archimedes
Guest
« Reply #7 - Posted 2003-07-28 11:12:29 »

> so what do you think i should do then? Forget about java and learn C++?

I suggest to use Java. In contrast to C++ it's is a real high level language and not an macro assembler hacked for OO. It allows you to do your tasks faster and more robustly. Also its giant library lets you concentrate on your task, so no need to re-invent the wheel all day.
Compared to my C++ experience, Java is a real pleasure. I still don't understand many things, but the learning curve is much smaller and more fun, also because of the execellent documentation (javadoc rules!).

This all applies to "typical" applications.
So now it depends on what game you want to do. If you take a look at Alien-Flux ( http://www.puppygames.net/ ) you'll see it's well possible to do fast action games with cool graphic and sound effects in Java (with OpenGL).

For a "typical" game (not Doom3), like 3d/isometric real-time strategy games, there are two critical topics to consider.

1) The graphics output. Luckily today you can deligate most of the "pixel transfer" to OpenGL, so that you "just" need to know how to use the OpenGL API in the right way. To master this isn't easy at all, but it doesn't matter if you call the API from within Java or C++. Much more important is to reduce the amount of data which is sent to OpenGL. This mainly depends on clever choice of algorithms and data structures. I bet somebody who knows how to program Java in the right way can do this task nearly as efficient (90-95%?) in Java compared to C++.

2) Simulation/AI. Again the clever choice of algorithms and data structures is the absolute main point. Practically nobody programs a full price game's AI in a low level language like Assembler anymore (*), although from a "CPU cycle per second" view this would be faster. The right algorithms are the joker, while the choice of programmings language is minor (so use the one which helps you most: Java). Many of today's full price games use interpreter languages _inside_ their C++ to do the AI tasks, because so the developers reach their goals more efficiently (on the same time they laugh at Java because it's a interpreter language?). A few commercial games (like Sturmovic) used Java for their KI and other parts (the graphics engine has been in C++ - but this has been before Jogl's been there).
For many real-time strategy games the simulation/AI does take more CPU time than the graphics system. A ratio "AI to gfx" of 2:1 isn't unusual.

Well, I'd say games which rely on CPU brute force (Doom3 because the CPU has to help the graphics card a very lot, etc) will be faster in C++ compared to Java.
However many other games could well be done in Java, if your target PC isn't an old 300 MHz without a 3d card. :-)  The Sims, Zoo Tycoon, Monkey Island 3, Runaway: A Road Adventure, and probably most of the other adventures, role playing games, and many real-time strategy games.


(*) The exception being the fantastic Roller Coaster Tycoon game from scottish braveheart Chris Sawyer. This game has been programmed entirely in Assembler, and it's for sure the fastest isometric strategy game I've ever seen. And it flies on a 200 Mhz PC with no 3d card. Ha! :-)
Offline kfoong

Senior Newbie




umm... something...


« Reply #8 - Posted 2003-07-28 11:29:08 »

What I mean as commercial games is like Starcraft, Counter Strike, and StarTrek Elite force. The games that you can find in your local gaming store.  Tongue

So it may be better for me to stay with java then, for now anyway.

P.S. whats OO? and whats JavaDoc? (Pardon my n00bness  Tongue )
Archimedes
Guest
« Reply #9 - Posted 2003-07-28 11:50:26 »

Quote
P.S. whats OO? and whats JavaDoc? (Pardon my n00bness  :P )

OO is short for "Object Orientated" programming. For example the difference between C and C++ is the OO part of C++.

Javadoc is a tool of the Java SDK and is used to generate nice HTML output of your codes's documentation which should use the Javadoc commands in its class and method comments.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html
If you watch the Java API documentation, for example here: file://localhost/i:/Sprachen/Java/Jdk1.4.2/api/overview-summary.html  all this is being produced with Javadoc from the original Java API sourcecode.
So: no seperate source code and documentation anymore, but both in one, so it's always up to date etc.

The last years we've used Doxygen for our C++ applications, which is a kind of "Javadoc for C++".
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tortoise

Junior Member




<3 Shmups


« Reply #10 - Posted 2003-07-28 18:47:09 »

You obviously wont find too much C++ love around here. It is a big bulky language, no doubt, but it's not exactly horrendous and definitely still has its place. (But don't be surprised to see languages like python, C# and of course Java continue to eat C++'s marketshare).

<misread original post>
What are you using to learn C++, I mean book/class/website wise? That can make all the difference. C++ definitely gets very complex as you go, but shouldn't be too bad to begin with. Maybe your approach needs reconsidering.

As for the 20-50 times slower, maybe in 1996 it was (if it was ever that slow). Java has come a loooong ways in speed, it's far closer to C++ nowadays.
Offline kfoong

Senior Newbie




umm... something...


« Reply #11 - Posted 2003-07-28 21:57:17 »

Most of the larger scale java programs seem alittle slower than C++. Like NetBeans and Alien Flux (But that game rocks!). And as for the clever Algorithms wouldnt it be the same speed increase if used for c++? So is making an interpreter in Java that makes games suitable? Or is using c++ better?
Offline nickdotjava

Junior Member




I have fallen to the dark side. &nbsp;I'm using DX9


« Reply #12 - Posted 2003-07-28 22:26:47 »

I will say that Java is much easier to learn algorithms/data structures with.  The Java2D also helps start you out with graphics.  The nicest thing is you don't have to worry about the Win32 API.

C++ is a very powerful language, but as my Professor says, "C++ is a huge language.  Most of the 'C++ Gurus' only touch a small part of it and are afraid to explore any farther."  And yes, I did learn C++ before I learned Java.  The transition was easy.  Going back to C++ when school started, on the other hand, wasn't quite as easy.  Damn pointers...

The speeds of C++ and Java are very comparable.  And Cas can correct me if I'm wrong, but AlienFlux was compiled to native code using JET, right?  So then the fact that it's written in Java should not make any noticable difference.

An interpreter for games in java is possible, particularly because Java has a built in regular expressions class.  However, what I would advise is to learn the theories and use Java as a tool to use what you have learned.  When you're ready for a game interpreter, then pick a language that is good for parsing.

-Nick

"Oh ya, that's trivial.  I should have it done in an hour."
Archimedes
Guest
« Reply #13 - Posted 2003-07-29 04:04:09 »

Quote
And as for the clever Algorithms wouldnt it be the same speed increase if used for c++?

Sure; however what I tried to say was that to select the correct algorithms and data structures is by far more important than the programming language you use to implement it.
With C you can be faster than with C++ because you've got more direct control of what the compiler produces. Same applies to assembler.
Still, hardly anybody uses plain C or assembler for a game's simulation/KI part anymore (has been different 10 years ago), because 1.) if you got the algorithms right, the very minimal spead increase you could gain with a more "low level language" isn't worth the hassle (and compared to Java C++ is more low level). And 2.) you'll reach your goals faster and more efficient with a high level language. Time/effort is a very big factor in (games) industry.

Quote
So is making an interpreter in Java that makes games suitable? Or is using c++ better?

Using an interpreter in an interpreter language is more straightforward. :-)
There are several easy to use script approaches for games with nice interpreter languages. A previous poster mentioned regular expessions (in Java since ... Java 1.3 or 1.4 ?) which indeed is a big pro for parsing scripts and implementing an own simple script engine.
The point is: since many C++ games run their AI in an interpreted way anyway, interpreter languages are used actually in many games.
Offline princec

JGO Kernel


Medals: 362
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #14 - Posted 2003-07-29 07:50:59 »

Yes, AF is available as a Jet-compiled EXE... I'd be interested to know which bit of AF is "slower than C++" though seeing as there's nothing to compare it to... that and the fact the bottleneck is in the graphics card fill rate and bus bandwidth... (run task manager and note the CPU usage)

Cas Smiley

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #15 - Posted 2003-07-29 08:34:15 »

I personally never got good results with JET, but esp. AF runs absolutely smooth even from a WebStart launch and I guess the CPU is nearly idle. So I don't think there would be any benefit for C++ here.


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #16 - Posted 2003-07-29 08:39:42 »

Ah, many of today games a GPU bound.

Even our 3D flight sim runs with 50% CPU on a decent machine with some 10s of enemies in the air. Not CPU bound. So faster code wouldn't help neither.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline tortoise

Junior Member




<3 Shmups


« Reply #17 - Posted 2003-07-29 12:06:10 »

Quote
Most of the larger scale java programs seem alittle slower than C++. Like NetBeans


NetBeans is slow, but NetBeans uses Swing extensively. That's more a Swing problem than a Java problem. Look at Eclipse, written in Java, just as big (if not bigger) as NetBeans, and is blazing fast.

Speed is not always attributable to the language or environment. Poorly written code or code that makes certain compromises could be slow, regardless of what language it's written in.
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #18 - Posted 2003-07-29 12:23:21 »

Quote

NetBeans is slow, but NetBeans uses Swing extensively. That's more a Swing problem than a Java problem. Look at Eclipse, written in Java, just as big (if not bigger) as NetBeans, and is blazing fast.

Speed is not always attributable to the language or environment. Poorly written code or code that makes certain compromises could be slow, regardless of what language it's written in.


How very true!  However, you have to apply your second comment to the first to be fair - you can write blazingly fast Swing interfaces, the real problem with NetBeans is the way they've used Swing. Wink

Hellomynameis Charlie Dobbie.
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #19 - Posted 2003-07-29 14:01:44 »

I back that up - I worked on a big Swing app with lots of zooming, transparency, animation and interaction - more than just buttons.
Performance hasn't been an issue.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #20 - Posted 2003-07-29 14:08:31 »

<OT rant>
Uhm, being both a user of Netbeans & Eclipse I can certainly say that Eclipse isn't always as fast as most belive (sure the common case of 10 files makes it seem fast).

Generally Netbeans is *slower* than Eclipse, because it is SO much more feature packed! And is a lot more extensible than Eclipse!

Try working everyday with both programs. You will quickly realize that Eclipse is faster to open files and whatnot. But in terms of actually producing stuff, Netbeans is far better.

The perception of performance is very subjective!
I have a relatively fast computer - so both run fast. Thus I only care about what makes it easier for me to develop in.

Generally for simpler projects, Eclipse is better - but for J2EE and other complex stuff - NB is quite a bit better.

My main gripe with Eclipse:
Even a simple thing as cvs over ssh using plink (source forge projects, typically) doesn't work using Eclipse! You need to use they're "special" cvs thingy, rendering commandline unusable. Supposedly working on this though...

Ohh and not forgetting:
SWT is *much* faster than GTK2, Motif or Photon. This also has to be evaluated when selecting an IDE.
</OT rant>

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #21 - Posted 2003-07-29 14:11:00 »

Bringing us back to the topic: you can use NetBeans to write C++ code Smiley

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #22 - Posted 2003-07-29 20:05:16 »

Netbeans lack refactoring tools. Sad  That's the main reason I use Eclipse.  (And I HATe the Netbeans UI structure - it's near impossible to configure the dang thing.)

In general (staying on topic) the tools for Java are better than for C++ I find.. sure Visual Studio .NET is nice.. but ti lack refactoring tools as well.  The reflection information in Java class files makes some advanced tool development much easier in Java.  Like auto code completion of methods for which you don't have the source code etc..

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #23 - Posted 2003-07-29 20:20:10 »

I use NetBeans together with RefactorIt as a plugin Smiley
Very nice! But off topic again....

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #24 - Posted 2003-07-29 20:23:08 »

ah, and, talking about IDEs.... for C++, there is Studio.NET.

For Java, there is NetBeans, Eclipse, JBuilder, IntelliJ, JCreator, CodeGuide, Together .............................  and you can all use them on the same project!! Choose your personal IDE of the day!

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline GergisKhan

Junior Member




&quot;C8 H10 N4 O2&quot;


« Reply #25 - Posted 2003-07-30 00:28:24 »

IDEA! IDEA! IDEA! IDEA!  Grin

That is all.

------

Sorry for the above silliness....

Moving BACK to the original topic of this post, I would like to ask you folks WHY this issue of Java versus C++ keeps coming up (aside from the obvious answer of new people who just become aware that this is a seven year old debate)?  From a market perspective, is this REALLY such a big deal?  

I'm very aware the number of commercially available Java-based games can probably be counted without taking off my shoes.  Wink  Nevertheless, does Java still have the stigma amongst developers (not the users, they haven't a clue - no disrespect meant) that it's not usable for games?

gK

"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Offline Breakfast

Senior Member




for great justice!


« Reply #26 - Posted 2003-07-30 07:35:41 »

It's all well and good having an idea but it doesn't help if you don't tell us what it is Tongue

I think the java + games stigma is caused partly by applets and partly by the fact that no-one has written any mainstream large scale games in Java yet. I'm fairly sure they will, though.
Offline princec

JGO Kernel


Medals: 362
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #27 - Posted 2003-07-30 09:44:19 »

Not until, I suspect, we get a few much wanteded features in the language and JVM, these being: static import (so code looks natural and uncluttered to migrating C/C++ programmers); generic types, for the same reasons; and structs, to enable efficient buffer manipulation. All three of these things are effectively "missing" from Java currently, and to any sensible C++ programmer, you'd simply be taking a big step backwards to do without them.

Cas Smiley

Archimedes
Guest
« Reply #28 - Posted 2003-07-30 10:25:48 »

Quote


NetBeans is slow, but NetBeans uses Swing extensively. That's more a Swing problem than a Java problem.

I think the very nice text editor Jedit (www.jedit.org) is pretty fast, too. And it uses Swing. :-)
Usually when I showed it to new colleagues who didn't like Java they didn't even notice it's been Java. :-)  (on a 700 MHz PC.)
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #29 - Posted 2003-07-30 10:49:13 »

naa, I don't think specific Java features are the reason.

Gaming industry has a successful history with C++! There are the people, the tools, the know-how. C++ is proven to work and there are lots of best-practise examples. Why change? Not just bc. a poor developer says he likes one language more than another.

'Its possible to do that in Java, too' is no sufficient reason to change. There has to be a clear and BIG benefit!

'Its easier to code' helps the coder a bit, but not the customer. And the business looks at the customer!!

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
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.

atombrot (26 views)
2014-08-19 09:29:53

Tekkerue (24 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (14 views)
2014-08-16 06:20:21

Tekkerue (20 views)
2014-08-16 06:12:11

Rayexar (59 views)
2014-08-11 02:49:23

BurntPizza (38 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!