Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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
1  Java Game APIs & Engines / Java 2D / Re: Invisible cursor and X 11 on: 2004-10-10 23:05:59

Actually what surprised me is that the same code worked with JDK 1.4.2 (Windows). I guess something has changed in the JDK 1.5 that now exposes my misuse of the hotspot.
2  Java Game APIs & Engines / Java 2D / Invisible cursor and X 11 on: 2004-10-09 23:00:58
Trying to hide the cursor with JDK1.5.0 on linux, I get

Exception in thread "main" java.lang.ExceptionInInitializerError
       at apollo.Surface.<init>(
       at test.TestLevel.main(
Caused by: java.lang.IndexOutOfBoundsException: invalid hotSpot
       at sun.awt.CustomCursor.<init>(
       at sun.awt.X11CustomCursor.<init>(
       at sun.awt.X11.XCustomCursor.<init>(
       at sun.awt.X11.XToolkit.createCustomCursor(
       at apollo.CursorManager.createInvisibleCursor(
       at apollo.CursorManager.<clinit>(
       ... 3 more

The code looks like this:
private static Cursor createInvisibleCursor()
   // Create the invisible cursor
   MemoryImageSource memIm = new MemoryImageSource(1, 1, new int[] { 0 }, 0, 1);
   Component c = new Component() { };
   Image im = c.createImage(memIm);
   Point spot = new Point(1, 1);
   return c.getToolkit().createCustomCursor(im, spot, INVISIBLE_CURSOR_NAME);

Has anybody experienced the same problem ? Any solution ?
3  Game Development / Performance Tuning / Re: Enhanced loop in Tiger on: 2004-02-22 17:54:54
There mere fact that both code versions actually differ is already food for thought IMO (that was not obvious from the documentation I read about 1.5).

I do not think so, this syntax is used in lots of places in java source files. At worst it does not optimize anything but I would be surprised if it slows down the test.

Did you wait for the warmup to finish as Jeff suggested ?

This kind of micro benchmarks can easily go wrong but they are interesting when they mimick the hot spots of your program (small loops called zillions of time to process audio/video data for instance).

Are you saying that the hotspot JVM is 'smart' enough to remove array bound checkings before 1.5 ? (I thought bound checkings could be only removed by a flag) It means it is able to analyze that the index is not modified inside of the loop code, that the increment is contant (maybe it _must_ be 1 in order to remove bound cheks). If so, then it is not obvious there is any gain at all, otherwise, the loops with the new syntax should be faster.
4  Game Development / Performance Tuning / Enhanced loop in Tiger on: 2004-02-21 22:48:11
I have just downloaded 1.5 and started playing with it.
I made a small test with the new enhanced loops. So far I  thought it was just a syntax improvment. I did not realize it can help improve the performance of loops also. Isn't that cool or did I just wake up after everybody ?

Before 1.5, one would write (some stupid test) like this:

// array is int[]

               for (int i=0, n=array.length; i<n; i++)
                     int p = array;

in 1.5, it becomes:

             for (int p : array)

There is no penalty access to the elements of the array and my first tests show it is actually faster (and yes it is a micro benchmark however it have some audio processing code with tight loops goobling most of the processing time). I wonder if the JVM also can optimize the bound checks since it 'knows' that the whole array is going to be scanned ?

5  Game Development / Performance Tuning / Re: JAVA IS SLOW! on: 2003-12-16 04:21:19
In my case, the tests show that roughly 75% is due to the node creation, not the insertion per se.
If pre-creating the nodes is an option, then you will see a big increase in speed.
6  Game Development / Performance Tuning / Re: JAVA IS SLOW! on: 2003-12-11 18:57:08
Actually I do not know if Toby's figures include node creation or not. But, if you include the creation of the nodes, most of the time is spent in there and not in the insert() method.
7  Game Development / Performance Tuning / Re: JAVA IS SLOW! on: 2003-12-11 18:30:19
You are measuring also the creation of 1000000 node objects, you should move the creation of those nodes (and the associated strings) out of the insert() loop.
Also, my understanding is that the heaps remain small but yours grows to 1M nodes.
Have you tried the profiler (-Xrunhprof:cpu=times) to measure the time spent in your methods ?
With my Ahtlon 1.4Ghz and JVM 1.4.2-beta-b19, I get (no optimization options) :

CPU TIME (ms) BEGIN (total = 36706) Thu Dec 11 13:15:37 2003
rank   self  accum   count trace method
  1 13.62% 13.62%       1    27 test.IntFibonacciHeap.main
  2 11.45% 25.07%  700000    30 java.lang.String.concat
  3  9.96% 35.03% 1400000    22 java.lang.String.getChars
  4  9.58% 44.61%  700000     3 test.IntFibonacciHeap.insert
That means an insert around 5 microsec on my box.
With a longer test and Princec's JVM options, it is around 4.8 microsec.
8  Game Development / Performance Tuning / Re: JAVA IS SLOW! on: 2003-12-11 06:19:27
How did you measure exactly ?
1 Million times insert/extract or 1 Million times
for ( int i = 0; i < ints.length; ++i )
while ( heap.size() > 0 )
or something else ?
The results seem to be pretty slow indeed. Did you try without the generics because the generics prototype may be slowing down everything ? There is nothing suspect in the code AFAIK.
9  Java Game APIs & Engines / JInput / Re: newbie question on: 2003-12-04 23:42:52
You nailed it guys !

When I copy the controller directory to the level I am running from, it works (and only in this case).
I had no luck with -Djinput.plugins (any ":" in the path makes the program fail with class not found or something).

I don't know about you but I think it is a weird behavior and I do not see the rationale so far. Any user running a program using JInput needs to copy the controller dir to the installation dir ?

Thanks anyway.

10  Java Game APIs & Engines / JInput / Re: newbie question on: 2003-12-04 18:30:09
Thanks, but no luck so far. I will do more tests later.
To say the least the packaging is 'creative': when I install JInput from the zip file, I get
jinput.jat both under coreAPI/bin and plugin/DX8/lib
jutils.jar both under coreAPI/lib and plugin/DX8/lib
dxinput.dll is both under coreAPI/src/tests/controller and plugin/DX8/bin
dxinput.jar is both under coreAPI/src/tests/controller and plugin/DX8/bin
So far, I did not know I needed to include the controller dir under tests or create a controller directory.
I created a jinput dir in my working dir and put jutils.jar and jinput.jar in there. Then I created a controller dir under jinput and copied dxinput.jar and dxinput.dll in there.
Then I tried to run my test (if it basically a wrapper around ControllerReadTest)
java -cp .;./jinput;./jinput/jinput.jar;./jinput/jutils.jar;./test/classes;./classes test.testJInput
Same result: no error but only 1 empty window because no controller is detected.
11  Java Game APIs & Engines / JInput / newbie question on: 2003-12-04 02:46:41
I have been trying to test JInput lately. I downloaded the latest lib/bin, compiled and ran the tests programs.
On my config (WinXP, athlon, no joystick) I was expecting to see a mouse and keyboard in the list of controllers but I get nothing. I wrote some code also to list the controllers and I get nothing.
So I tried the webstart based test at newdawnsoftware and I see my controllers.
I guess I must be trying to do something stupid. Also I am confused about why there are several libs with the same name in both coreAPI and plugins (which ones should be used ?). What is the difference between these libraries.
12  Java Game APIs & Engines / Java 2D / Re: Null pointer in JTree rendering on: 2003-11-07 23:49:03
you are right. The rendering problems occurs probably outside of the renderer. However I do not think that traversing the tree in an instable state should lead to a crash.
After looking at the code involved, it looks more like a test is missing to check if the currentCellRenderer is null in javax.swing.plaf.basic.BasicTreeUI.paintRow (the check is made in other places in the same class).
Maybe it is possible to the synchronize on the getTreeLock() of the tree during model updates to block any painting.
13  Java Game APIs & Engines / Java 2D / Re: Null pointer in JTree rendering on: 2003-11-07 05:13:01
What about having your own renderer for the nodes and disable the painting in the renderer while you are re-creating the tree ?
14  Game Development / Performance Tuning / Re: Good sort algorithms on: 2003-10-24 05:11:10
Correct me if I am wrong but accessing or inserting an element in a balanced (red-black) tree is O(log n). So, using a SortedMap is still faster than using a radix sort. The only advantage of the radix sort (or others) I can see is when basic (non object) types are managed (then again it is possible to write a class that would manage such types).
15  Java Game APIs & Engines / Java Sound & OpenAL / Re: Managing hundreds and hundreds of sounds... on: 2003-08-19 18:48:21
Take a look at the apollo sound library (see appropriate thread also under javasound), there are mechanisms to play sounds in parallel and optimize resource consumption of audio clips through caching.
Now, the real question is no so much how many you have but how many sounds you want to play at once.
16  Java Game APIs & Engines / Java Sound & OpenAL / Re: Apollo Sound Library on: 2003-08-15 00:29:41
The correct syntax is jar -tvf <FILE>.jar.

17  Java Game APIs & Engines / Java Sound & OpenAL / Apollo Sound Library on: 2003-08-12 00:08:13
Check out this sound library; it is all you need to play sounds in a game:

18  Discussions / Business and Project Management Discussions / Re: why java business will hardly start... on: 2003-07-22 01:50:44
I just re-read my last sentence (of course after clicking on post).
Man ! It is time for a break ... or a translator !
19  Discussions / Business and Project Management Discussions / Re: why java business will hardly start... on: 2003-07-22 01:48:11
At least the good old Albert was doing something interesting while being a clerk at the patent office. Fortunalety he forgot to patent relativity  Grin
Let us hope there is another Albert who is doing something valuable beside granting a patent for the 1 click buy !

As for the definition of a patent, it is nice. Maybe we should send it to these patent offices ...

PS: AndersDahlberg, we have you are name and you address ... we are coming ...
20  Discussions / Miscellaneous Topics / Re: JavaOne on: 2003-06-04 23:52:12
Also check out this link :

I guess one of the members of this forum is going to be proud ... AlienFlux is listed !

You 've got to deliver now  Wink
21  Discussions / Community & Volunteer Projects / Re: hmm... another ambitious project on: 2003-06-02 00:57:43
Just a few final comments on EP ... Tongue
At least it is interesting to hear about somebody having a good experience with keyboard sharing. I am still doubtful that in works in average though, maybe the pairs have to be 'special'  Wink
misterX, I agree with you. The only thing to remember from Extreme Programming IMO is the "test as often as you can" idea.
OK.. back to the topic. I did not mean to hijack the thread. Start small ... start with easy games.
22  Discussions / Community & Volunteer Projects / Re: hmm... another ambitious project on: 2003-06-01 18:52:31
Personally, I see Extreme Programming as a new marketing buzz word and not a real work process (come on, share a keyboard among 2 people !). Sure there are a lot of guys making money with E.P. books, seminars and other blah blah. As PrinceC wrote, some people were already working like that before the marketing buzz fell from the sky.

I understand that some people may feel at ease with the do-now-rework-later kind of process but from my experience, it is more costly (at least in big projects) than a usual design-now-implement-later process.

And yes, I have been writing real programs for real customers in a real company for (too) many years.

Now, for small projects and/or less experienced people, it can make sense.
23  Game Development / Performance Tuning / Re: Micro benchmarks on: 2003-05-31 00:15:57
Unlike previous results, the results on the P3/NT would be enough to ban floats (or remove this platform from the targets). You did not give the version of the JVM though (upgrading could help improve the score).

Consider a game heavily using floats: it would fly on the Mac and the fast P4s (with XP) but would be implayable with a 'slow' PC with NT. Less so with integers.

"Write once run anywhere" seems really not to be an easy task as far as performance is concerned ...
24  Game Development / Performance Tuning / Re: Micro benchmarks on: 2003-05-24 23:19:34

I did not make myself clear.
" Your results are puzzling because in the end 'we' do not know what to shoot for ".

I meant that it is not obvious from your results what to target to achieve the best speed : use floats or integers ? It depends on the platform (hardware, JVM, OS).  Alias / not alias ? it all depends on the code inside of the loop AND the platform.

25  Game Development / Performance Tuning / Re: Micro benchmarks on: 2003-05-24 18:23:55

On Mac, the floats are somewhat slower than the ints, but all in all, the JVM/Max Os X/G4 combunation kicks butts !!!


micro-optimizations may be a waste of time but benchmarking them is not IMO : you are always safe with aliasing int arrays, the floats are 'usually' pretty fast (at least on the 3 config that have been tested so far).

The -server option seems to decrease dramatically the speed (unless the micro benchmark was too short for the JVM optimizations to kick in).

I would not have bet on these facts before.
26  Game Development / Performance Tuning / Re: Micro benchmarks on: 2003-05-24 03:57:54
Geeeeee !
Your results are puzzling because in the end you do not know what to shoot for.
With both integers and floats,  the values span (roughly) from 2 to 9 ! And the floats can be faster or slower that the ints.
I note than with the new JVM, the floats 'can be' REALLY fast ...
How can you be sure that the optimizations you made on your platform are relevant at all ?
The only constant thing for sure is that aliased integers are always faster than non aliased.

Food for thought, people ...
27  Game Development / Performance Tuning / Micro benchmarks on: 2003-05-24 00:15:07
Hi guys,

I was trying to make speed improvements in some code and got unexpected results. First look at some code:

     int[] iv = new int[1000];
     iv[0] = 8;
     iv[1] = 9;

     long before = System.currentTimeMillis();

     for (int ii=0; ii<100000; ii++)
       for (int i=2; i<iv.length; i++)
         iv = (5 * iv[i-1] - 10 * iv[i-2]) / 3;
         iv *= iv;

     long after = System.currentTimeMillis();

     before = System.currentTimeMillis();

     for (int ii=0; ii<100000; ii++)
       int previous = iv[1];

       for (int i=2; i<iv.length; i++)
         int v = (5 * previous - 10 * iv[i-2]) / 3;
         v *= v;
         iv = v;
         previous = v;

     after = System.currentTimeMillis();

     float[] fv = new float[1000];
     fv[0] = 8.0f;
     fv[1] = 9.0f;

     before = System.currentTimeMillis();

     for (int ii=0; ii<100000; ii++)
       for (int i=2; i<fv.length; i++)
         fv = (5.0f * fv[i-1] - 10.0f * fv[i-2]) * 0.333333333f;
         fv *= fv;

     after = System.currentTimeMillis();

     before = System.currentTimeMillis();

     for (int ii=0; ii<100000; ii++)
       float previous = fv[1];

       for (int i=2; i<fv.length; i++)
         float f = (5.0f * previous - 10.0f * fv[i-2]) * 0.333333333f;
         f *= f;
         fv = f;
         previous = f;

     after = System.currentTimeMillis();

OK, basically it is some math computation inside loops.
I ran these tests several times in the same process and got the following results:

int : 5203
int aliased : 4750
float : 4172
float aliased : 5031

The absolute values by themselves are not really important but they reveal a pattern.

First conclusion: the floats are faster that the ints on my platform (WinXP, Athlon XP, Java 1.4.2beta) !!! Incredible isn't it ?

Naively, I thought otherwise. I guess the SSE2 instructions now used by the JVM kick in to boost dramatically the float performance. It would be interesting to see the results on other platforms (SSE or no SSE). That is good news for Open GL Java ;-)

Second conclusion: aliasing is always better with ints but counter productive with floats which also was not obvious to me.

I am perfectly aware that these results should be taken with a grain of salt (if you slightly modify the code inside the loop you may end up with other conclusions).

The bottom line: it is going very difficult to optimize code since the optimization on one platform may end up decreasing perf on another platform. The only way to know is to test !

I'd be interesting in other people testing with other hardware, OS and JVM versions.
28  Discussions / Miscellaneous Topics / Re: Let's Have Some Fun on: 2003-05-23 23:27:17
One of the sessions of the coming JavaOne:

"Advanced OpenGLĀ® for the JavaTM Platform TS-2125"

29  Discussions / Miscellaneous Topics / Re: Disabling the garbage collector on: 2003-05-23 23:17:56
Disabling the GC is a very bad idea: if you do not create objects anyway, the gain would be small.
The question is : are you sure you are not calling APIs that DO create objects. In this case, the GC is your insurance against ever increasing memory ...
30  Discussions / Miscellaneous Topics / Re: Let's Have Some Fun on: 2003-05-22 23:44:52
Well, it is already official that Sun will show a new development tool aimed at Visual Basic programmers and the likes.
We also know that this forum will be revamped.
We can easily extrapolate that the JDK 1.4 will be delivered as a final version.
My guess is Sun is going to show an OpenGL java library and there will be a deal announced with a company like Sony or Nokia to support java games on their platform (?).
Place your bets.
Pages: [1] 2
hadezbladez (290 views)
2018-11-16 13:46:03

hadezbladez (158 views)
2018-11-16 13:41:33

hadezbladez (291 views)
2018-11-16 13:35:35

hadezbladez (72 views)
2018-11-16 13:32:03

EgonOlsen (2151 views)
2018-06-10 19:43:48

EgonOlsen (2177 views)
2018-06-10 19:43:44

EgonOlsen (1365 views)
2018-06-10 19:43:20

DesertCoockie (1984 views)
2018-05-13 18:23:11

nelsongames (1626 views)
2018-04-24 18:15:36

nelsongames (2273 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!