Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (653)
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 ... 94
1  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 22:17:18
Thanks, I think I'll add this to LWJGL 3.
That would be great!
2  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 21:55:06
Yes I know; that was just a remark about floating point in general.
3  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 21:39:38
If anyone is interested, I've put the pre-compiled library here:
Sorry, windows only for now...

To enable flush-to-zero mode, call

to restore normal behaviour, call

The source code is there as well (as much as there is any); feel free to use it any way you like. If it's useful enough, maybe this should become a proper cross-platform library.
4  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 09:41:40
Heh, clever Smiley

Floating point never fails to surprise.
I mean, after learning that 1.0f + 1.0e-8f == 1.0f  Stare I basically stopped caring about denormal values having a purpose for correctness.
5  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 08:04:00
So the results are now like as follows, using this code
      float f = 1;

      for (int count = 0; count < 8; count++) {
         long start = System.nanoTime();
         for (int i = 10000000; i > 0; i--) {
            f *= 0.999998f;
         System.out.println(count + ": " + (System.nanoTime() - start) + "   " + f + " \t" + (f < Float.MIN_NORMAL));

Default behaviour:
0: 19782589   1.5903542E-9    false
1: 21886645   2.5291527E-18    false
2: 21601492   4.0223933E-27    false
3: 20395286   6.397437E-36    false
4: 384876680   3.45733E-40    true
5: 544109759   3.45733E-40    true
6: 544310570   3.45733E-40    true
7: 545460996   3.45733E-40    true

With flush-to-zero enabled:
0: 19982061   1.5903542E-9    false
1: 19439424   2.5291527E-18    false
2: 19738856   4.0223933E-27    false
3: 19458167   6.397437E-36    false
4: 19633095   0.0    true
5: 19759830   0.0    true
6: 19560804   0.0    true
7: 19418897   0.0    true

This will certainly make performance a lot more stable in my project, so I'm a happy camper Smiley

EDIT: I just tested it with my DSP project, and it absolutely works.
Even though I already prevented denormals in the most obvious cases, I didn't everywhere. As a result, where I get enormous performance spikes without enabling flush-to-zero, those spikes are all gone and generally performance is much better.
Result!  Cheesy
6  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-08-01 07:39:35
Thanks Roquen, that worked!
7  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-31 17:46:33
Shouldn't there be a library for this? It sounds like it'd be useful. Maybe someone feels obliged to make one? =P

If I could find one, I probably wouldn't be nerding around with JNI and C compilers right now Wink
So yes, if someone knows of a library that can do this, I'd happily use that!

In my benchmarks, hitting denormal floats means a performance degradation in the order of 25 times as slow as usual and up!
Obviously they are huge spikes that really hurt real-time applications.
Working around it by adding tests or adding an offset helps, but still degrades performance significantly in itself.
And those work-arounds need to be applied almost everywhere in my case, which not only makes everything noticeably slower, it's also a big pain in the behind to have to litter your code with all that stuff almost everywhere.
8  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-31 16:32:25
Because all FP computations while these modes are active are ignoring denormals. That's outside of the JVM's spec.  Additionally any routine that depends on the behavior of denormals will be effected.  The CPU and OS take care of limiting the mode changes to the thread(s) in question.

Ok I see.
There's just one thread where all these DSP calculations take place, but that's also the same thread as the Asio driver's, so to be safe I could enable the 'flush-to-zero' mode just before my DSP stuff takes place and re-enable the default 'denormal' mode afterwards.

I had some trouble getting it to work with MinGW (it seems it doesn't support '_controlfp_s'?), so I'm trying my luck with VS.
9  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-31 09:02:08
Can't you change the scale of your calculations?

That's what I'm often doing now, but it is a workaround that comes at a cost.
10  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-30 20:15:10
In what sense it is a no-no?
I mean I understand why floating point denormals exist and why they are a good thing, but I just want to change the behavior for my particular case.
11  Game Development / Performance Tuning / Re: Disabling floating point denormals on: 2015-07-30 18:54:36
Thanks for your reply! Smiley
That was exactly my understanding of it, but I wasn't sure if it would actually work in the context of a JVM.
12  Game Development / Performance Tuning / Disabling floating point denormals on: 2015-07-30 18:39:36
I'm working on a project where float denormals have a big impact on performance.
To clarify, float denormals are floating point numbers that are so close to 0 that its format isn't well supported by the CPU anymore, leading to incredibly slow performance.
Any floating point calculations that tend to gradually go towards 0 are potentially impacted. In my case, that's audio DSP stuff, but I can imagine that things like physics calculations are potentially affected too.
(For reference: and also the javadoc of Float.MIN_NORMAL).

Currently, I either add a small offset or add a check to 'nudge' these values to 0 (the latter is surprisingly often faster than adding an offset), but that is both impractical in a lot of cases and has a performance impact in itself.

It seems it's possible to disable float denormals on the CPU so that such numbers simply become 0 (the linked article touches upon this), so I'm thinking of creating a little dll and JNI library to do that in java.
I think it would help my project tremendously, and I guess it could be a nice exercise for me.

Now my question is: Is it actually possible, especially within the context of a JVM? I mean I'm quite out of the loop of native programming, so maybe I'm unaware of something that might make this a no-go?
Or maybe something like this already exists somewhere? (I've googled, but I couldn't find anything myself).
13  Discussions / General Discussions / Re: mame emulator in java (arcadeflex) on: 2014-07-31 18:20:34
That conversion stuff is interesting BTW.
A guy named Julien Frelat has done something similar in a project called 'JAPE' ( I think he's more into .net these days, but it might be worth it to hook up with him to exchange ideas on the subject. Very nice guy (I've worked with him on 'CottAge').
14  Discussions / General Discussions / Re: mame emulator in java (arcadeflex) on: 2014-07-31 18:05:29
I'll see what I can do about sound. The sound code in JEmu2 should be quite easily integrated in arcadeflex, I think (it has been reused before).

It was a bit tricky to add JavaSound support in JEmu2; not so much because JavaSound is that hard to use, but to make it work well (and across platforms).
My problem was to keep latency as low as possible and avoid buffer under-runs, since JavaSound doesn't provide any (reliable) way to measure how many bytes are in the queue. So I ended up timing everything and keep adjusting whenever there is a buffer under-run.
IIRC I had to rely on System.currentTimeMillis, so I suppose going to nanoTime will help there.

Anyway, if you have a use for the JEmu2 sources, just PM me; you can use it however you like as long its my own parts of the code (most of it is, but some parts were written by collaborators, for example the Out Run driver and the M68000 CPU emulator, so I can't be sure about those parts).
But I have to warn you, emulators were sort of my Java 'Hello World' getting out of hand, so things can get a bit messy in places Wink
15  Discussions / General Discussions / Re: mame emulator in java (arcadeflex) on: 2014-07-30 18:44:43
I just love emulation Smiley
I've made a few myself (with collaborators), probably most notably JEmu2. It emulates lots of arcade games (up to games like Galaxy Force 2, Rail Chase, After Burner and Outrun), and a few consoles and home computers (Sega Master System, MSX, MSX2, Spectrum) and it supports sound.

A few questions though:
Any reason why you're porting such an old MAME release? Is it because later releases started to depend on macros and such so much?

And why a direct port? I haven't looked at your code yet, but I found that following MAME to the letter will make the code very rigid and 'static'. In JEmu2 I would never have been able to implement things like 'VirtuArcade' (i.e. 20 arcades running in parallel in 3D) if JEmu2 was a straight MAME port.

If I were to write an emulator again, I'd not follow MAME too closely but just make some helper classes to make porting MAME drivers easier. MAME is a beautiful piece of code that despite its age is still quite well designed and is an invaluable treasure of knowledge. But IMHO it doesn't translate that well into java, especially if you want to take emulators further than MAME.

Anyway, I'll check out your project and see if I can merge some of my sound code in there.
16  Games Center / WIP games, tools & toy projects / Re: Jumproom on: 2014-07-07 18:25:03
It's a fun concept and it plays really well, as one would expect from you Smiley
It's like a concentrated mix of accessible one-button skill, and a puzzle element.

I played it on PC and used the keyboard, and found the level selection screen not obvious: It's not clear when you have selected the newly unlocked level, and my first instinct was to use space to start a level (which didn't work). When I found out that the Enter key works, it turned out that when I finished a level that the same level was selected instead of the next one.
But obviously this is meant for touch devices so probably not a big problem.

The arrows on the blocks that make you change direction are probably not clear enough. Maybe you should make it a bit more obvious; more contrast and maybe animate those blocks.

Maybe it's a an idea to add a time element to it. The mechanics really lend themselves for that. Like an extra prize or something if you finished a level in the best possible time.
17  Discussions / General Discussions / Re: Apple announces new graphics API: Metal on: 2014-06-16 19:34:29
Well, in your circles it may not be the case, but it is very much the general reality. iOS accounts for something like 70% of download revenue. iPhone users download fewer apps, but spend far more on them. Android users expect everything for free or extremely cheap, and they generally get it, to the detriment of developers.

While that may be true, it's a very broad statement that probably doesn't tell the whole story.
Android's target demographic is a lot wider than Apple's, so naturally the market is different in general.

But can we really say that app revenue is all that different if we focus on games and top-end phones for example? And do these stats include things like add revenue (still an important source of revenue)? Many Android devices don't even ship with Google Play; is content revenue from those devices counted in these stats?

It's difficult to directly compare Apple with Android when it comes to app revenue, so I have to say that I'm more interested in real life experiences there than general statistics.
18  Discussions / General Discussions / Re: Apple announces new graphics API: Metal on: 2014-06-09 11:00:02
Why didn't they just implement their Metal stuff within OpenGL?
That doesn't even make sense.  It would be purpose defeating.

Dev lock-in?  WTF?  How so?  All dev platforms have platform specific APIs.  Big deal.

tbh I don't know any details about Metal; I was sort of referencing Carmack who stated that Mantle could have been done as OpenGL extensions and on surface it looked like Metal was going for something similar as Mantle.

And yes, all platforms have specific APIs, and that is a big deal as that was an important reason for Java to exist in the first place.
Maybe Apple intends to make Metal an open standard, but realistically that won't really make a difference. It's not like Google or Microsoft will be in any hurry to support it.

The big game engines like UE and Unity will probably support it if Metal becomes successful, but I can't imagine many developers being overjoyed with the idea of having to deal with yet another API that does the same thing.
19  Discussions / General Discussions / Re: Apple announces new graphics API: Metal on: 2014-06-08 20:56:10
Having a better designed API is always a sucky excuse if it means changing everything for developers to become more locked into some platform.
Why didn't they just implement their Metal stuff within OpenGL?
20  Discussions / Miscellaneous Topics / Re: Watchdogs on: 2014-06-02 19:07:46
I was so aware it was just a game and had no reality to it, since it could never compare to the real situation, I honestly believe it had no effect whatsoever.

Sometimes I think the fact that a movie is not interactive might have more of an impact to viewers than an interactive video game. Perhaps the fact that something is obviously computer generated interactive content, controlled by a piece of plastic takes something away from the potential that one (especially a minor) perceives something as being real.
Maybe it would have made more of an impact if that Max Payne sequence was a movie with real actors?

But it's all a grey area.
Some people are affected by certain things, others aren't. I don't think there's anything you can do about that, and I don't think video games are somehow more hurtful there than other media like movies or books.
When people start getting out of control, making some form of media the culprit is like killing the messenger. The real reasons behind such things lie much deeper than that.

We've probably all been traumatized to some degree when we grow up and learn about the dark side of life through movies, books, videogames or otherwise. Usually that's not a bad thing.
21  Games Center / Featured Games / Re: Daedalus on: 2014-06-02 18:10:52
It looks really slick and good fun, so you'll have a sale from me at least Smiley
22  Discussions / General Discussions / Re: Give to charity, get a copy of Excelsior JET (commercial JVM with AOT compiler) on: 2014-06-02 18:03:28
Thanks for the opportunity!

If you don't need denormals I'd expect you could just use a JNI method to set the FP-control word per thread.
Sounds interesting, how would that work? Like calling a method once and the denormalization issue is gone, or calling a method at every point a denormalization issue could occur?
Currently I either add an offset or 'nudge towards zero', so if it's the latter than I'm not sure it'd be worth it.
23  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-28 20:37:55
JavaFX is supposedly the future, but so far it's a *tumbleweed* - who's making anything beyond trivial demos with it?

I would bet that any GUI application development companies currently using Swing will start using JavaFX for their new projects. Source: my job.

I can honestly say that I'm surprised that JavaFX is generating jobs today. Not unpleasantly surprised, but still surprised.
24  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-28 20:33:08
JavaFX is supposedly the future, but so far it's a *tumbleweed* - who's making anything beyond trivial demos with it?

Nail on the head.
Proven technology (or 'legacy' if you will) is worth more if the new alternative is both 'bleeding edge' and 'already irrelevant'.
25  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-25 17:17:39
JavaFX is basically a Swing competitor... It was publicized as a Web-centric RIA platform, which was a failure, but the technology itself isn't tied to the web in any way.
I know it's not tied to the web in any way, I just meant that it was mostly made to compete with popular RIA platforms.
My understanding is that it now sort of became the successor of Swing and that Swing won't get more attention than bug fixing.

I don't believe this at all.
Believe what you will, but I'm just telling you real-life on-the-job experience there.
JavaFX is great for most things, but we did run into performance issues when dealing with things like rich-text editing and really large documents where Swing still performed very well.
This was a few years ago, so things might have improved.

Swing and JavaFX are widget frameworks with data grids and buttons and checkboxes; that really doesn't make sense for the majority of games.

If you are making some odd game that uses lots of checkboxes and radio buttons and data app GUI stuff, then sure, go for it, but otherwise, you should use a more appropriate tool.
Oh I agree, and I wouldn't personally choose Swing or JavaFX for any game but I could imagine that there are some sorts of games where it could be usable. I suppose JavaFX would be useful for things like these typical free-to-play citybuilders and such, or football manager, that kind of thing. Games that are basically a traditional GUI dressed up with pretty graphics.

Anyway, I like JavaFX. I think it's nicely designed and more flexible than Swing with much less of the pitfalls.
Still I find myself usually going for Swing anyway. The things that JavaFX is particularly good at aren't important to me when making a desktop app.
26  Games Center / Featured Games / Re: Titan Attacks on: 2014-05-25 16:14:54
Cool, good to hear it's doing well.
27  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-23 19:10:23
I agree with the first half, but not the second half. Applications also have to be "engaging" and "intuitive", both of which roughly translate into "sexy".

I think we're debating semantics here.

I agree applications have to be engaging and intuitive most of all, but I took "sexy" to mean things like "cool graphics and animations".
"Engaging and intuitive" means something else to me (even if there is some overlap). To me that mostly means "going from idea to result as best as possible".
Cool graphics and animations isn't the most important thing there, but the feeling of having an application that is focused to enable your ideas is.
To me Swing (or SWT) just works better there on the desktop, but YMMV.
28  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-23 17:53:32
JavaFX is nice for that, but to be honest I don't think there's really a future for JavaFX.

JavaFX was originally designed for rich web applications, but there's really no point in going there anymore.
So both Swing and JavaFX are for desktop applications now, and while JavaFX has the potential to make things look very slick, being slick and sexy is usually not really what you want from a desktop GUI.

I've done a few projects with JavaFX, and there is a lot to say for it (I think it's quite well designed), but at the end of the day I still prefer Swing. 
And I even prefer Swing with plain Metal L&F (and I probably tested all 3rd party L&Fs). It's clean and fast, and can still look quite slick. Especially if you put a little effort in to set a nice font, remove the ugly borders, enable AA in custom components etc.
The main problem I had with JavaFX is that it might enable slick 'web-like' looking stuff relatively easily, but Swing always felt much more responsive in more complex GUIs.

Desktop applications typically need to be totally responsive, clean and productive, and I think being 'sexy' usually doesn't make a whole lot of sense there.
OTOH if you're making GUI-heavy game for the desktop (or some other desktop application that needs to look exotic) for whatever reason and you don't want to go OpenGL, JavaFX might still be a better option though.
29  Games Center / Featured Games / Re: Titan Attacks on: 2014-05-23 17:15:31
Hey Cas, any word on sales on PS consoles yet?
It would be interesting to know if this collaboration with Curve turns out to be a viable business case or not.
30  Discussions / Miscellaneous Topics / Re: Drinking Java on: 2014-05-13 19:36:02
You should try cà phê Chồn. It's a special Vietnamese coffee that tastes surprisingly smooth. Especially considering how it's made.
Pages: [1] 2 3 ... 94
SHC (26 views)
2015-08-01 03:58:20

Jesse (19 views)
2015-07-29 04:35:27

Riven (40 views)
2015-07-27 16:38:00

Riven (21 views)
2015-07-27 15:35:20

Riven (24 views)
2015-07-27 12:26:13

Riven (14 views)
2015-07-27 12:23:39

BurntPizza (36 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (30 views)
2015-07-24 06:06:53

NoxInc (37 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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!