Archived

This topic is now archived and is closed to further replies.

hey 2 quick unrelated questions (java, porting console games)

This topic is 5587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok hey i have two questions obviously (im somewhat of a newb so bare with me) one: i got in an argument with some uber-geek looking kid today in the coffee shop (yeah, sounds stupid eh) who was advising his friend to learn java for games, not c/c++. i jumped in and told the other kid all about c/c++ and how much faster it is and the dorky kid was arguing with me telling me java is 100% optimized in every way, and tests show that java executes faster... i said theres no way an interpreted language can be faster than directly compiled languages and he said Java uses some "hotspot" technology which allows it to be much faster than c++...is this true? what is he talking about (ive never heard about it). am i wrong? is java actually faster? two: hwen a game company releases a game for say, ps2, then they decide to port it to gamecube/xbox/pc, what exactly do they have to do? what is the process of porting? do you simply copy and paste all of the original program code (lets say done in PS2), into a compiler you''d use for gamecube games, change all of the syntax so the compiler understands it, and recompile it? or is there a more complicated process. please just detail me as to how porting is done. thank ya all.

Share this post


Link to post
Share on other sites
one: he was talking out his arse. I just found out the other day that floating point operations in java are guaranteed to give the same results on any hardware... can u imagine the messing around and timehit that that incurs?

two: basically that is what you do, but I wouldn''t call it simple by any means A lot of trouble can be saved if it is known from the beginning that the code will need to be portable. I sometimes write command line utilities for linux and win32, and it''s usually easier to write both versions as I go.

Share this post


Link to post
Share on other sites
One: Java virtual machines aren''t straight interpreters, and haven''t been for about 5 years now. They employ many compile-on-the-fly (JIT) technologies, with many optimizations done in the more commonly executed code. Faster than C++? Only in very specific areas... Like allocating temporary objects in a tight loop. But in most areas, java isn''t more than 20% slower than C++. The big thing java is slow at is standard GUIs. And that''s only because the libraries are FAR from optimized. Between versions 1.3 and 1.4 of java, many GUI functions were sped up 2x just by fixing some bugs in the code. Of course, there''s still a long way to go with that.

That doesn''t mean other GUI toolkits are slow (take a look at SWT, for instance), or that all graphics functions in java are slow. Just the ones that give most people a bad impression.

Two: Porting is MUCH more complicated than that, usually. Usually, you have to deal with entirely different hardware, doing entirely different things. Many algorithms need to be re-written. Interface code needs to be entirely re-written (for most programs, anyway. Some are designed more intelligently, to make that a much faster process.)

And then hundreds of system-specific optimizations need to be implemented, for most kinds of programs.

I mean... Consider the port of Quake (whichever version it was) to the Gameboy advance. You''ve got to make the whole game fit into a much smaller amount of memory. That means the textures need to be smaller.. So they need to be resized. But that needs the artists to come in and make sure they''re resized well (automatic resizing is sub-optimal, to say the least.) The number of input options is severely decreased... So take out all the code for dealing with multiple input systems, to make it smaller.

And that''s just the beginning. Most ports are VERY non-trivial. PC to XBox and vice versa are probably the easiest ports, because their hardware is mostly the same. But the number of available optimizations on the XBox is much greater, because it''s a fixed platform... You know exactly what hardware is being used, so you can write the code to use the hardware at full efficiency. That''s not really possible on PCs, with their highly varied hardware.

And so on...

Share this post


Link to post
Share on other sites
quote:
Original post by zppz
I just found out the other day that floating point operations in java are guaranteed to give the same results on any hardware... can u imagine the messing around and timehit that that incurs?



Not much at all on most processors... The rules specified in Java were chosen because they are the most commonly implemented.

Share this post


Link to post
Share on other sites