Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 5
1  Game Development / Performance Tuning / Re: Performance of event driven vs polling on: 2005-04-04 11:03:57
Quote


Listeners alone can't cause memory leaks. At least I haven't had any.


Depends on how you define "alone". Each call to addListener can potentially cause a memory leak and should be reviewed carefully. Adding a listener to a locally referenced button is no problem, but in a more complex object structure you can run into problems.

Actually, to prevent memory leaks I would say all listeners should be weakly referenced. The object you're listening to should never prevent garbage collection and removal of the listener (it's really one way coupling). This would of course cause problems with listener objects not referenced anywhere else (typically anonymous inner classes), but that can be solved by keeping the listener reference in an object field.

Quote

I guess you can have an abstract entity class to implement this, add a single listener to detect if the version has changed and if a version has changed then send a message which would execute in your main game loop.

You're a genius. Smiley
I'm going to try that.
Thank you.


I'm not sure what your talking about here, but if it works for you that's great. Smiley
2  Java Game APIs & Engines / Tools Discussion / Re: XML editor on: 2005-04-04 08:17:38
Quote
jEdit is an excellent XML editor.
I use XML almost every day, and have developed several XML based application and regularly use XSL and i've never found a better tool than jEdit.
Yes, you need a few plugins - if you're interested let me know and i'll list them.

[size=1]warning - i am a jEdit evangelist :p[/size]


Can you debug XSLT's in jEdit? Oxygen and some other XML IDE's supports this and it helps a lot when writing XSL transforms.
3  Game Development / Performance Tuning / Re: Performance of event driven vs polling on: 2005-04-04 08:13:05
Updating the game world using events and listeners is definitely more complex than a periodic update process. Events can also cause performance problems if you don't watch out. For example, multiple events might be posted that each causes an update of an object when only one update would be sufficient. This causes a lot of unnecessary work to be performed.

If you use listeners you can easily run into memory leak problems. This is a problem in all more complex Swing applications. Weak references can help you here.

IMHO, a good solution for a game is to have versioned objects and some periodic update process. For example, let's say you have a model object and some graphical object that renders the model object state (typical Swing design). When the model object is changed it increases its version (a long int). The graphical object that needs to be updated then checks if the last used version is the same as the current model object version, and if that's not the case the graphical object is updated.
4  Game Development / Performance Tuning / Re: Escape Analysis on: 2005-03-28 09:23:10
Quote

First of all, note that Excelsior is revenue-funded, and providing support costs money. So we have to be careful about giving away stuff if we want to preserve the quality of our support.


Yes, I fully understand that (I work on a commercial Java product myself). I'm in no position to argue what licensing schemes you should have, but a suggestion would be that you provide a free, case-by-case, no-support license for open source projects. The license could require the projects to explicitly state that the binary was produced with Jet, giving you free publicity for your product. I think both parties could benefit from such a license.
5  Game Development / Performance Tuning / Re: Escape Analysis on: 2005-03-27 08:54:11
Quote
For those interested in trying out escape analysis in Java today, we have just released Excelsior JET 3.7, which has escape analysis much improved and object explosion implemented.

Download


Cool. You don't have any plans to offer a free license for open source projects?
6  Game Development / Performance Tuning / Re: floating performance on: 2005-03-26 09:08:05
There are two issues here:

- The definition of "open source". I assumed most people used the definition given on opensource.org. Apparently that's not the case. It seems your definition of open source is when you can see the source code and (optionally?) being able to submit patches (which might be rejected) to someone who mangage the code. Correct?

- If the Java source code should be released under a license that opensource.org can approve of. It seems you don't think that's necessary and that you are content with Sun's current licensing scheme.

We disagree on both accounts, so I don't see this discussion going anywhere.

Btw, RMS is talking about free software, not open source.
7  Game Development / Performance Tuning / Re: floating performance on: 2005-03-25 09:16:33
Ok, to highlight some problems with Sun's "open" license:

- Can you pick out parts of the JRE source code, build and distribute together with your product? Nope.

- Can you use the Java source code as base for creating a new improved Java library? Nope.

- If Sun wants to terminate Java, can you take the source code and continue to distribute the JRE? Nope.

That's not an open source license.
8  Game Development / Performance Tuning / Re: floating performance on: 2005-03-24 07:13:40
Quote


Who cares what http://www.opensource.org says?  I find their definition of "Open Source" include things that are very anti-corporation, anti-competition, anti-make-a-living, etc.  It's far too utopian.


Have you even the read the info that's available on the site? They have accepted a number of licenses made by corporations like IBM, Sun, Nokia etc.

Instead of rambling about they being anti-X etc., provide details about what's wrong with their definition of open source. Maybe you can provide an alternative open source definition?

Quote

As far as Java is concerned:
I can get the source. I can submit changes.  And thankfully there is a governing body (Sun) in place to make sure that not any dufus can screw everything up.  That fits my definition of open source 100%.

You can call it whatever you like, but to most people that's not open source.

Quote

Sun has Java 6.0 available on Java.net with all the source code.  And they have officially stated that they are accepting patches.  Since we all know that we are going to get Java 6.0 for free, including any accepted patches, I don't see any reason why those screaming for "Open Source" don't just contribute and shut up.


You might not have a problem contributing for free to a code base that is owned by a commercial company, but many people have (me included). That's the core issue of open source, noone shall own the source code and tell you what you can do with it.

If I find a bug or design error in th JRE, I much rather create some alternative, free solution than contribute to the JRE code base.
9  Game Development / Performance Tuning / Re: floating performance,  Take II on: 2005-03-23 15:22:55
Using SSE with floats can give you a huge performance boost by performing 4 float operations at once. When performing the same operations on a float array in memory, HotSpot could align the array in memory to even 16 bytes and auto-vectorize your code to make it several times faster using SSE.

GCC 4 will do auto vectorization of relatively simple loops, don't know about HotSpot plans though.

Btw, SSE2 allows the same optimizations on integer maths using 8, 16, 32 or 64 bit integers. And you can run MMX in parallell with SSE2 improving integer performance even further.
10  Game Development / Performance Tuning / Re: Escape Analysis on: 2005-03-22 06:45:42
There is some (very little) info about this in the HotSpot team chat transcript:

"Spiff: The memory overhead for small Java objects can be a killer for some applications. For example, a Triangle object which holds 3 Point3f's. Since HotSpot has an 8-byte per-object overhead plus 8-byte alignment, each of those Point3f's occupy 24 bytes, where they would occupy 12 bytes with C/C++. Are there any plans to perhaps inline (memory-wise) small objects, say if you can guarantee that you'll only refer to them through their containing parent object?

Ross Knippel: On the compiler side, we're planning on doing escape analysis, which may allow these objects to be scalarized and therefore never created. There are no current plans to inline one object into another. "

The full transcript is available at http://java.sun.com/developer/community/chat/JavaLive/2005/jl0315.html.

Btw, Spiff == princec ?  Grin
11  Game Development / Performance Tuning / Re: floating performance on: 2005-03-15 15:06:26
Java is not open source (see http://www.opensource.org). I can only speak for me personally, but I'm much more willing to contribute to an open source project than a project with some restrictive license like Sun's.
12  Game Development / Performance Tuning / Re: floating performance on: 2005-03-15 13:23:48
I'm not saying the JIT compiler would become faster if it was open sourced (maybe it would if IBM or the JRockit team helped out), but I'm pretty sure some parts of the JRE code would improve (less bugs and better performance).
13  Game Development / Performance Tuning / Re: floating performance on: 2005-03-15 09:50:30
Or you can open source the JRE...   :-/
14  Game Development / Performance Tuning / Re: floating performance on: 2005-03-14 06:45:54
Quote


GCC produces extremely poor code for Intel.  


Please provide some links. GCC 3 optimizes much better than the old GCC.

Quote

In fact last I heard Intel's own compiler was significantly better than what MS was offering, but that was in the VC6 days.

I'm not sure how vc7 stacks up to the Intel compiler, but with vc6 I knew some guys that did very performance sensitive image processing applications and all of their release builds were done with the Intel compiler because they got a significant boost.


From what I've read, Intel's compiler is the best (which makes sense), followed by MS and then GCC 3. I think the difference between MS and GCC is small though.
15  Game Development / Performance Tuning / Re: Recursion and Java on: 2005-03-08 10:55:24
Quote
So this doesn't apply to other forms of recursion?


Many solutions implemented using recursion can be very hard to translate into an iterative counterpart (for example, double recursion). A recursive solution is often less efficient than an iterative counterpart because of the additional stack handling required, but it all depends on the quality of the iterative solution.

Don't optimize prematurely and never without profiling data. A recursive solution is often much shorter, easier to read, implement and verify than an iterative counterpart, so start with a recusive solution if that fits for your problem.
16  Game Development / Performance Tuning / Re: floating performance on: 2005-03-08 08:11:34
Quote
Switching to a new compiler is not a simple task. Just consider the cost alone: we'd need to buy a license for everyone who compiles the code. That's a lot of people in our case.


There's always GCC + Eclipse Grin Works as well as VS in my opinion.
17  Discussions / General Discussions / Re: How do I prevent JSplitPane splitter from movi on: 2005-03-04 12:44:36
Why do you even use a JSplitPane if you don't want the split divider to be movable?
18  Game Development / Performance Tuning / Re: Recursion and Java on: 2005-03-04 06:31:02
Quote
With Java hotspot compiler inlining frequently used methods, does that mean recursion has the same efficiency as a loop?


Yes, if you do tail recursion it is as efficient as a iterative solution. See:

http://www-106.ibm.com/developerworks/java/library/j-diag8.html
19  Game Development / Performance Tuning / Re: floating performance on: 2005-03-03 07:05:14
Quote
Your benchmark gave these results on my Athlon 2200 on the server VM:
Float: 2230 iterations / s
Double: 941 iterations / s
Fixed point: 2553 iterations / s
2.9308171, 2.8822784, 2.9308173801885786

A slightly modified version of your benchmark gave these results (after some warm-up):
Float : 6690 iterations / s
Double : 3975 iterations / s
Fixed : 27322 iterations / s
2.9308171, 2.8822784, 2.9308173801885786

So whatever it's causing this difference, I don't know, but the only thing you can conclude from your benchmark is that JRockit optimizes it better (for whatever that's worth).


I was a bit confused why your code gave such a big speed improvement (10x faster fixed point), then I noticed that you use the 'count' variable both for iteration count and inner loop count. This is a bug, right?

Fixing the code I get the following results with Java 5 -server:

Float : 417 iterations / s
Double : 596 iterations / s
Fixed : 2253 iterations / s
2.9308171, 2.8822784, 2.9308173801885786

JRockit:

Float : 1697 iterations / s
Double : 1699 iterations / s
Fixed : 1940 iterations / s
2.9308174, 2.8822784, 2.9308173801885786

Now JRockit is 4 times faster than Hotspot on the float benchmark! Shocked Remember that this is a simple fmul, fadd loop. Something weird is happening here...
20  Game Development / Performance Tuning / Re: floating performance on: 2005-03-02 13:57:31
Ok, I've put together the entire benchmark into a single class (see below). On Java 5 -server I get:

Float: 776 iterations / s
Double: 642 iterations / s
Fixed point: 1793 iterations / s
2.9308171, 2.8822784, 2.9308173801885786

With JRockit I get:

Float: 1572 iterations / s
Double: 1575 iterations / s
Fixed point: 1800 iterations / s
2.9308174, 2.8822784, 2.9308173801885786

Note the 2x speed improvement in the float and double benchmarks. I get the same scores for a similar C test compiled with GCC or Visual Studio.

It's a VERY simple loop to optimize (fmul, fadd, jump in the assembler output from GCC), so it's really surprising that Hotspot can't optimize it properly. You're more than welcome to try to tweak the code to make it run fast in Hotspot.

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  
62  
63  
64  
65  
66  
67  
public class MathTest {
  private static final float x = 0.7456f;
  private static final float y = 0.97543f;
  private static final int count = 100000;
  private static float f1;
  private static float f2;
  private static double f3;

  private static void run(String text, Runnable runnable) {
    long time = System.currentTimeMillis();

    while (System.currentTimeMillis() - time < 10000) {
      runnable.run();
    }

    time = System.currentTimeMillis();
    long count = 0;

    while (System.currentTimeMillis() - time < 10000) {
      runnable.run();
      count++;
    }

    System.out.println(text + ": " + count * 1000L / (System.currentTimeMillis() - time) + " iterations / s");
  }

  public static void main(String[] args) {
    run("Float", new Runnable() {
      public void run() {
        float a = x;
        float b = y;

        for (int i=0; i<count; i++) {
          b = a * b + a;
        }

        f1 = b;
      }
    });
    run("Double", new Runnable() {
      public void run() {
        double a = x;
        double b = y;

        for (int i=0; i<count; i++) {
          b = a * b + a;
        }

        f3 = b;
      }
    });
    run("Fixed point", new Runnable() {
      public void run() {
        int a = (int) (x * 65536.0f);
        int b = (int) (y * 65536.0f);

        for (int i=0; i<count; i++) {
          b = (a >> 8) * (b >> 8) + a;
        }

        f2 = (float) b / 65536.0f;
      }
    });

    System.out.println(f1 + ", " + f2 + ", " + f3);
  }
}

21  Game Development / Performance Tuning / Re: floating performance on: 2005-03-02 13:26:19
Quote
100k iterations is very few. The overhead of compliling that into native code (if it even bothers doing so.. enable some profiling) will take up a large percentage of the total time spent in that loop.


point being:
It quite possibly already is compiling that loop into native code as fast as a c compiler, but your microbenchmark is broken.


It's not broken, on the contrary I'm quite certain that my benchmark is correct. The code I posted is the loop I'm benchmarking, it's not the entire benchmark application. I do 10 s warmup and 10 s benchmarking.

My tests seem to indicate that there is a flaw in the Hotspot optimizer.
22  Game Development / Performance Tuning / Re: floating performance on: 2005-03-02 11:32:44
I'm seeing some weird floating point benchmark results on my Athlon 1.4 GHz using Java 5 -server. I'm benchmarking a very simple loop using floats, doubles and fixed point. The fixed point loop is as fast as similar C code compiled with GCC or Visual Studio, but the floating point math is running at half the speed of similar C code. That is the same speed as when "Strict" floating point is turned on in Visual Studio. Here's the loop I'm benchmarking:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
private static final float x = 0.7456f;
private static final float y = 0.97543f;
private static final int count = 100000;
private static float f1;

void runTest() {
        float a = x;
        float b = y;

        for (int i=0; i<count; i++) {
          b = a * b + a;
        }

        f1 = b;
}

The same code using doubles is even slower. Running the benchmark in JRockit produces the same results as compiled C code = about twice as fast as Hotspot server. Why can't Hotspot optimize the Java code as well as a C compiler?
23  Discussions / General Discussions / Re: BEST GAME EVER on: 2005-02-16 08:54:44
I'm starting to feel old in this forum. There were some games released before year 2000 you know. Wink

I'm an RPG dude, so I'll list my favourite RPGs:

Dungeon Master (Atari ST), still very playable, download it for PC http://dmweb.free.fr/DMDownloads.htm#Dungeon%20Master%20for%20PC.
Ultima Underworld 1 & 2
System Shock 2, best atmosphere ever in a game, try replaying it with this patch: http://perso.wanadoo.fr/etienne.aubert/sshock/sshock_rebirth.htm
World of Warcraft, have only played for about 1 month but it's a brilliant game
24  Game Development / Performance Tuning / Re: New VM performance improvements on: 2005-02-03 07:15:53
Quote
New improvements?
Of course thats easy.

XCHNG instruction for swapping without using a temporally variable.
This means XCHNG int int
or XCHNG float, float
I think XCHNG Object, Object would work too, but let it be introduced on primitives first.


How do you know it's not already used?

Quote

GC impovements:
If I know I would call some method that would be a really object generation/throwing away intensive, it will be nice to give some hint to GC. Like GC.hint(SOR_EXPECTED, GC_FRAME, 1); //small object release
GC.hint(BIGGOR_EXPECTED, GC_FRAME, 1); //bigg object release
GC.hint(BIGGOR_EXPECTED, GC_NEXT_METHOD, CLEAN_INSIDE) //This means next method would create a lot of garbage and cleans before return would be much better than swapping it out.
And of course the favorite:
GC.clean(long) //Clean it now. If you want to do any cleaning, you'd have long nanosecond (int millisecond). Return imediately if not interested.


Worthless. Telling the GC what to do will not improve performance.

Quote

Releasing of memory.
It would be nice if JVM release some memory after 5 minutes when it had around 60 MB free, and unused for long time. Actually when you have allocated 800MB and swapped on 2GB swap it doesn't matter too much, but I might like be able to run 3 of these programs, just for testing, and then it could (will?) create problems.


I believe Java 5 can release memory back to the OS. Not sure though.
25  Discussions / General Discussions / Re: how to stop a thread safety ? on: 2005-02-03 07:06:16
It's stupid to recommend usage of Thread.stop() when Sun tells you not to use it. If Thread.interrupt() is not sufficient for your application I would say you have a bad design.
26  Java Game APIs & Engines / OpenGL Development / Re: Resizing the window on: 2005-02-02 07:10:26
I haven't even been able to set the location of the LWJGL window using Display.setLocation(). It doesn't work. Any comments about this?
27  Discussions / Miscellaneous Topics / Re: Sun's crappy generic implementation on: 2005-01-28 12:39:39
IBM has an interesting article about limitations of the generic type implementation:

http://www-106.ibm.com/developerworks/java/library/j-jtp01255.html

It's not pretty, but it works (most of the time) Wink
28  Discussions / General Discussions / Re: AgentFX 3D Engine on: 2005-01-27 06:54:22
Hmm, why don't you have any Web Start demos on your site? Or am I missing something...
29  Discussions / Miscellaneous Topics / Re: Do you listen to music when you code?  Wh on: 2005-01-20 15:29:25
Some good recommendations in this thread!  Smiley

My code music is mostly techno/electronica like Crystal Method, Prodigy, Adam F, Shpongle (weird and beautiful stuff!), Sven Väth (his old stuff), Hallucinogen, Covenant (vocals), Jarre, Jan Hammer (remember Miami Vice?), mixed trance (Lange, Sasha, Corsten etc.)

There are some decent rock/pop as well like K's Choice (some of their albums are excellent), Kent (Sweden's best band), Coldplay, Abba, Erasure, Def Leppard, Lighthouse family, The Knife (Sweden's second best band), Depeche, Lene Marlin
30  Game Development / Performance Tuning / Re: Walkaround suggestion to structs on: 2005-01-20 05:45:37
Ok, what about arrays?

1  
2  
3  
struct Data {
  char[5] chars; // ?
}


And you must be able to put a struct in a struct, right?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
struct Data1 {
  int x;
  int y;
}

struct Data2 {
  Data1 d;
}

Data2 d2 = new Data2();


Would that mean that the value of 'd2.d' is also an object that is allocated when d2 is allocated?
Pages: [1] 2 3 ... 5
 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

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

ctomni231 (48 views)
2014-07-18 06:55:21

Zero Volt (44 views)
2014-07-17 23:47:54

danieldean (35 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
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!