Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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  
  Why You Might Want To Consider Java For Your Next Project  (Read 5775 times)
0 Members and 1 Guest are viewing this topic.
Offline avm1979
« Reply #30 - Posted 2011-07-11 03:22:00 »

Thank you for explaining. As before, extremely informative Smiley

The bit about handles makes sense - sounds like mapped objects are essentially a nice way to do that with what looks like regular java code.

Offline delt0r

JGO Knight


Medals: 26
Exp: 18 years


Computers can do that?


« Reply #31 - Posted 2011-07-11 11:11:30 »

Some of this Data orientated programing still feels like premature optimization to me. Packing things into floats? Perhaps --*after* profiling.

Also you don't need the JVM to layout objects in memory perfectly. Just pretty well. It may not do that. But from some of my tests it must be mostly doing it. I get too close to optimal performance to be cache thrashing that much. 

Also you can see cache trashing in action by iterating though a large array randomly and compare with linear access. IIRC i get about a 5x speed difference.


I have no special talents. I am only passionately curious.--Albert Einstein
Offline Spasi
« Reply #32 - Posted 2011-07-11 20:28:05 »

Some of this Data orientated programing still feels like premature optimization to me. Packing things into floats? Perhaps --*after* profiling.

Also you don't need the JVM to layout objects in memory perfectly. Just pretty well. It may not do that. But from some of my tests it must be mostly doing it. I get too close to optimal performance to be cache thrashing that much.

Packing is mostly useful when you want easy interaction with GL/CL. You don't have a choice there, if you want to do something on the GPU you need to pack your data. If you want your code to look nice and be easy to refactor, you either work on POJOs and do a copy or pack/unpack step (paying the performance and memory penalty), or you use mapped objects.

For normal stuff, DOP is still useful without packing data. A loop on a continuously allocated Vector3f[]? Of course, that will be very fast in Java. Assuming the objects have matured altogether, 4 byte overhead per object, 2 MB cache per CPU core, 128 byte cache lines, you only "waste" 1 cache line every 32 objects compared to doing the same with packed data. Doing the same on an array of objects that look like this?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
class Unit {
   Vector3f localPos;
   Matrix4f globalTransform;
   Vector3f globalPos;
}

for ( int i = 0; i < units.length; i++ ) {
   Vector3f pos = units[i].localPos;
   // do something with pos
}


That's when you have problems.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline fletchergames

Senior Member





« Reply #33 - Posted 2011-07-14 19:39:21 »

I used to try to program games in C++.  I scorned Java because it was an interpreted language.  I viewed it as a language for sissies.

There was a problem with the games I programmed in C++: by and large, I couldn't get them to work.  I programmed some garbage for DOS in high school, but DOS was already becoming obsolete by that point.  When I switched to Windows programming, I was wholly baffled.  I kept trying to make a game, when I really needed to figure out the basics of Windows programming first.

Then I was forced to learn Java in a programming class.  I tried to program a game in Java because I was fed up with C++.  It sort of worked.

So, in short, I use Java because I can make games that actually work in Java.

Knowing what I know now, I could probably buy some books about C++ game programming and figure out how to write games in C++ instead.  But how would that help me?  I don't have performance problems or know of anything I could do with C++ that I can't do with Java.  I don't see the point in using C++ to do what I'm doing, though it would probably be instructive to do more exploration with using other programming languages.

Edit: I mean that using other languages would probably help enhance my programming skills in general, not that I expect to find out that some other language is superior to Java.
Offline Spasi
« Reply #34 - Posted 2011-07-15 12:37:08 »

A perfect example of how you can apply DOP to completely destroy one of the best data structures in the JDK, in both throughput and latency:

Disruptor: High performance alternative to bounded queues

Note how the resulting API and implementation is 100% object oriented. DOP has nothing to do with how you write code, it's only about applying an optimal data structure and memory access design that produces the best CPU/cache utilization.

Unrelated to my point but very interesting nonetheless, in paragraph 4.1 they basically make a case for Riven's mapped objects.
Online princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #35 - Posted 2011-07-15 14:46:10 »

Amazing how long ago I whinged to Sun about mapped objects to address precisely this sort of crap and after all these years it's just taken our resident genius a few days to just basically hack it all together perfectly on his own in more or less precisely the way I envisaged it working. Unbelievable how slow Sun were at addressing this issue. Another awesome strike for LWJGL as well - Riven you are truly one of a kind.

And yet... STILL NO BASTARD iOS PORT. GRR. Riiiiiiivvvvvvveeeeeennnnn!!!!.....

Cas Smiley

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.

Riven (18 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (30 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (41 views)
2014-07-23 21:16:32

Riven (27 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!