Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (624)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
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 ... 35
1  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-13 22:14:10
JavaSound has worked pretty well for over 10 years when the direct device support was added. That's a generally solid low level API. I wouldn't recommend most people use it directly, like I wouldn't recommend most people on here use PortAudio directly, which is the low level library used in OpenAL-Soft. Likewise you wouldn't criticise PortAudio for not being as easy to use as OpenAL. Julian assumes that JavaSound based libraries are hard to use because JavaSound itself is.

Or another way, it's similar to what you said about it being possible to build JavaFX on top of LWJGL.
2  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-13 21:44:09
Therefore, I'll go on advising it and Paul Lamb Sound Library is a nice solution to use JOAL without having to write lots of code to do more or less the same than with JavaSound.

Oh, FFS do you delight in willful misunderstanding?! There are countless JavaSound libraries that would also allow you to play short sounds in minimal lines of code. Stop comparing apples and oranges.
3  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-13 10:56:16
Sometimes, it's not really JavaSound's fault but I'm happy to have a painless experience with JOAL.

Exactly, because the two libraries have different purposes!  You realise it would be possible to write an OpenAL-like library on top of JavaSound?!  OpenAL is great, but it's also the wrong tool for the job sometimes - eg. look at what @philfrei is currently working on.  OpenAL is a much higher level library.

Your problems with JavaSound all stem from a) using libraries that ignore the spec and b) using it in ways it wasn't designed for.  (OK, b is a bit dubious but the short sound bug is related to the way clips are specified - I wonder what JavaFX is like in this regard given their clips are implemented with a similar architecture ^^)

That's not to say I wouldn't be happy with a better low-level sound library - a decent binding* to PortAudio would be fantastic (incidentally AFAIK what the low-level bits of OpenAL-Soft use).

* for decent read not the one that's actually available!  Wink
4  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-13 09:39:25
I have no idea how the underlying code is implemented, if it is different from's or not.

AFAIK, as implied in my previous comment, it's implemented using the GStreamer based JavaFX media libraries, so yes different to JavaSound.  Not necessarily better though!  Found this bug report while checking this.  Doesn't bode well, not because the bug is necessarily still there, but because it implies that JavaFX clips are implemented in the same way as JavaSound - opening a sound pipeline for every play.  Perfectly suitable for a desktop application with occasional sound needs - terrible for a game where you want to play lots of sounds quickly.

Now that Java is on the move again, with definite positive developments, one hopes that the Open versions find a way to keep up!

That shouldn't be too hard given that development happens in the Open*** repositories!  Wink  Remember that OpenJDK is the reference implementation of Java SE and Oracle's build is based on it.  The problem has been with Linux distributions not shipping up-to-date packages (to be fair, Java's release schedule couldn't be worse for Ubuntu's LTS schedule)

Therefore, his demand of pureness is a bit contradictory anyway.

Surely it's more about not relying on native code outside of the JRE.

JavaSound is terrible  Clueless Long life to OpenAL Cheesy

That's like saying Java NIO terrible, long live nginx - it makes no sense!

 Emo I can't be bothered explaining the difference again - every time I think you get it you prove me wrong!  Tongue

Both do their job well when you understand where to use them and how they work.

5  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-12 15:00:31
'ang on a minute... I know I probably suddenly sound even more like a broken record than usual but doesn't JavaFX have a completely revamped API for sound? Which should satisfy the OP's requirement for "pureness".

Hadn't thought about that.  Mind you, seem to recall you didn't have much positive to say about GStreamer once upon a time!  Tongue

Not "pure" for me on Ubuntu until OpenJFX hits an LTS either!  Wink

6  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-12 12:23:43
I advise you to use Paul Lamb Sound library, it's more capable than TinySound but still simple to use and it doesn't force you to use JavaSound (i.e you can work around its bugs and limitations).

Except the OP mentioned wanting to use pure Java and Paul Lamb's JavaSound backend is terrible!  Wink

There are a few other libraries other than TinySound that might be worth a look.  Two libraries often used with Processing but usable from plain Java are Beads and Minim.  Beads is probably a bit advanced (and there's a bug on Windows with the current download), but Minim is probably worth a look.
7  Game Development / Newbie & Debugging Questions / Re: Advantages of games created with JAVAFX on: 2015-10-12 08:18:08
JavaFX is still not supported in OpenJDK

It's in OpenJFX, which will finally be included in the next LTS of Ubuntu, so I may actually start playing with it then.  Roll Eyes

performance will be lower than in case of OpenGL-based libraries

No idea on performance, but isn't JavaFX OpenGL-based too?

I thought JavaFX was dead. In fact I'm not entirely convinced it isn't.

Hardly!  I think it's going to be part of the JavaSE spec from Java 9. 
8  Game Development / Newbie & Debugging Questions / Re: Best Way to Implement Music and Effects in Java 2D Game on: 2015-10-11 19:38:41
thanks , i've tried that library but i could'nt make it work,

In what way?  What happened / failed?

The code you posted above is about the worst possible way to handle this!  Wink

by the way, when i play the WAV sounds, in console i have a message:

2015-10-11 07:15:18.302 java[41802:1457138] 07:15:18.302 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.

Bizarrely there's a conversation going on on the PortAudio mailing list about the very same issue.  Looks like both they and Java are using an API that is being phased out.  Will follow up if there's any useful info, but if it works right now you can probably ignore it (note being phased out) - not something you can work around anyway.
9  Games Center / WIP games, tools & toy projects / Re: Audio library demos on: 2015-10-05 09:45:52
Just had a first play with this, and really love it as a sound toy.  Reminds me a bit of stuff I saw years ago by Tonne (  Take that as a big compliment from me!  Smiley

I'm not a very good code reader and am not sure about what I am looking for in the example you linked. Is your code counting frames or elapsed time and then putting itself to sleep? How should that help, theoretically? Or, is this needed because you are not using java sound and thus don't have a blocking line of any sort between your processing and the native playback?
In both Java and Android, these write methods use blocking lines. I let them handle the rate at which their respective audio systems process the audio data.

This is the JavaSound server, so yes it's got the same blocking lines.  Wink  The server supports either blocking mode (like you are doing) or two modes that don't block on the output line.  Instead it opens the line with a much larger buffer on the soundcard, and manages the timing itself using either nanoTime or the frame position.  Frame position would be the most suitable, but doesn't work on Windows because the reported value isn't very accurate.  The code does a mix of sleeping and busy looping until the next frame is due.  It's similar to some code on here for game loops.

This is not my technique originally, it's been suggested by various Java audio people in the past, but I've hacked it around quite a bit.  You're bypassing certain unknowns in how the underlying JavaSound code / native driver is blocking and rescheduling your audio thread, which is sometimes not as fast as you might want it to be.
10  Games Center / Showcase / Re: Christ on: 2015-10-02 09:01:33
Of course, by helping them be more dead again  Grin

Yes, because Jesus is the one and only true zombie.  Wink
11  Games Center / WIP games, tools & toy projects / Re: Audio library demos on: 2015-10-02 08:58:12
One thing I haven't tried yet is setting the priority of the busy audio thread to high. This has been suggested by some on other posts on audio questions. Theoretically, it should work, because I think the audio thread is in a blocked most of the time.

Absolutely!  The audio thread should have maximum priority.  It's not when it's blocked that's important, it's when it isn't!  Wink  I can think of at least one Java audio project that goes as far as using native bindings to increase the thread priority above what can be achieved normally.  My bindings to JACK also have that, although the thread in question is created externally to the VM.

Incidentally, you don't have to block on the audio write either - you can use a larger buffer and write smaller amounts to it based on System.nanoTime() or line.getLongFramePosition() - see here.
12  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env on: 2015-09-30 10:04:35
Thanks @Riven

I've updated the top post with the current state of the project (which is out of alpha now and on v2.1-150808)

Added links to some recent screencasts, which as mentioned above are better watched fullscreen on YouTube itself if you want to see what's going on - they're all 1080p

Next version in the works will update the OpenGL renderer to work on top of Processing v3, which offers more stability and finally ditches AWT for NEWT!  Grin

It will also have optional support for using GStreamer 1.x instead of 0.10 - had to take the plunge myself and work on updating the GStreamer-Java bindings - source for them is up at

13  Discussions / General Discussions / Re: Transitioning from Windows to Linux on: 2015-09-30 09:15:52
I've used Linux as my primary platform for over a decade, and these days don't find anything I need to use Windows for except the occasional testing.  I've been using Ubuntu LTS for the last 4 years, mainly because I got fed up of faffing, and in general it just works.  Unity is worth persevering with - it's actually a really productive keyboard focused UI.  Mind you, elementary OS does look nice, and is Ubuntu based.

I would definitely pick an LTS (long term support) edition though unless you like installing your OS every few months.  I used to use Mint for a few years, but switched away because found their approach to LTS was more like long-term unsupported.

What Mint probably has and Ubuntu doesn't are the libraries needed to install Google Chrome.

That sounds odd.  Are you sure they were the same Ubuntu version?  Mind you I use Ubuntu Software Centre for one thing, and that's installing Synaptic to replace it!  Wink

Try Mint out. It won't be faster than Windows 10 though.

Is Win 10 that much of a speed increase?!  On my last 3 laptops Ubuntu has massively outpaced Win 7 or 8 for performance.  Would love it if they finally have something that performs decently!  Smiley

like the famous multiple sound processing backends for Linux ("Let the user choose in which manner their sound will be broken").

2008 called and wants their bug report back!  You are aware that Windows has at least as many audio backends, right?  Tongue

14  Game Development / Newbie & Debugging Questions / Re: Are people overreacting in the negative performance of GC? on: 2015-09-26 09:23:37

page 31 is funnier!  Grin
15  Game Development / Newbie & Debugging Questions / Re: Are people overreacting in the negative performance of GC? on: 2015-09-26 08:42:48
Do you have any example of high performance open source Java software using object pooling extensively?

Not a direct example, but I've had some interesting conversations at conferences with people doing low-latency Java work in the financial sector, with whom I bizarrely seem to have most in common.  That's definitely one of the tricks in use.  Just found this link from 2013 which is a quite interesting read, Q5 in particular.  Obviously noting the "The worst thing you can do is prematurely optimize this area of your applications without knowing whether it is actually a problem or not"!  Wink

Because I do low-latency audio coding, which has tighter latency constraints than graphics (60fps vs 600fps), not to mention that audio 'frame' drops are a hell of a lot more noticeable, Praxis LIVE actually supports the ability to run the audio in a separate VM to the UI.  This is an interesting approach which is probably overkill for most usages, but has a demonstrable performance improvement for my use simply from reducing GC in performance critical code. 
16  Discussions / General Discussions / Re: Simple to use sound in Java games on: 2015-09-25 20:39:40
OpenAL-Soft seems to work better than JavaSound, what's the point of using the latter except the fear of using a third party library?

Lots, because I actually understand the difference.  OpenAL-Soft is an audio library that builds on top of various native audio backends.  JavaSound is a low-level API that abstracts those native audio backends.  I'm not in any way suggesting people don't use third-party libraries, whether OpenAL or TinySound or something else.  Leave library writers to deal with the low-level stuff.  JavaSound generally works fine when the library authors have actually read and understood the spec, just like the OpenAL-Soft authors have to understand the specs of the various low-level libraries they use.

Or in other words, use the library that best suits your application.  If OpenAL gives you what you need, use it.  If something else does, use that.

btw Julien, have you actually ever tried TinySound or are you basing your opinion on other libraries that weren't well written?  I've not used it myself (I have my own library), but various people around here seem to like it.
17  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-25 11:14:33
RE: here is the line in your init method...
this.og = this.OffscreenImage.getGraphics();
right after you create a BufferedImage for OffscreenImage ... It's not clear at which point, re: JDK 6/7/8, BufferedImages get accelerated more or what exactly is the promotion strategy or how translucent images are handled.


You've kind of side-stepped the point there - that graphics object is not, never was and never will be accelerated!  It would break the BufferedImage API.  That offscreen image needs to be a VolatileImage if you want to speed up rendering to it.

And if you're drawing into a BufferedImage every frame, then it's never going to be promoted to a managed image either because you're constantly invalidating any cached copy.
18  Discussions / General Discussions / Re: Simple to use sound in Java games on: 2015-09-24 13:38:36
I don't think that many end users will have the patience to fix the problems with their OS to make Java Sound work correctly anew.

Neither do I, but then if you use a library that actually does JavaSound right then that won't be an issue!  (that incidentally does not include Paul's library unless it's been rewritten since I last looked at it)

I have found no such device but I can find a device whose "best" Java Sound mixer claims not to support this audio format. That's one of the reasons that forced me to abandon Java Sound.

You still on about that damn webcam?!  Tongue  There used to be issues on Linux due to deprecated use of ALSA (and a bug in ALSA).  There's a whole new JavaSound implementation for Linux these days.
19  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-24 10:07:36
er .. did you read what I wrote above (read-only vs read-write!)  Pointing
Aye, just adding a +1 as it were!

Except we were not saying the same thing!  Wink  You said to never touch VolatileImage.  I'm saying if you ever call getGraphics() on a BufferedImage as part of your rendering loop, you should be switching to a VolatileImage.  Quite a lot of people seem to misinterpret managed images as meaning that the graphics of a BufferedImage is hardware accelerated - it isn't!

Where I'll +1 you back is, if you're at all bothered about the performance of your rendering loop, you shouldn't be using Java2D!  Grin
20  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-24 09:48:52
Is the idea to use BufferedImage's for the sprites and VolatileImage's for the sea and sky?

That depends!  What are you drawing the sea and sky on to?  Where is that Graphics object from?  If you're getting the graphics object from a BufferedImage then all rendering is in software - you could potentially get a big speed up from switching to VolatileImages.  OTOH, if you're drawing into a Graphics provided by the screen or a component then that should already be backed by a VolatileImage or otherwise accelerated.

However, if you're using -Dsun.java2d.noddraw=true you're going to switch off most of the acceleration capability anyway.  You need to work out what's going on there first!  I vaguely recall a similar issue with FSEM.  Try getting it all working in a windowed version first, and possibly consider faking full screen on Windows.
21  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-24 09:37:40
Don't touch VolatileImage. Just stick to BufferedImage as it will automatically promote itself behind the scenes into a VolatileImage-alike if it figures out that's how you're using it.

er .. did you read what I wrote above (read-only vs read-write!)  Pointing

... or just forget all this crap and use JavaFX. Srsly.

I'm looking forward to when JavaFX (or Java 8 for that matter!) becomes officially included in an Ubuntu LTS - woot, only 6 more months!  Emo
22  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-24 07:49:51
I don't think VolatileImage is much better than BufferedImage these days.

These are not the same things, and it pays to understand the difference.  In OpenGL terminology it's loosely equivalent to the difference between a texture and an FBO (which IIRC is how the GL pipeline backs them).  There's not much point in using a VolatileImage for sprites, etc. as you'll just be trying to replicate the caching layer already built into BufferedImage.

On the other hand, as @Catharsis says, use a VolatileImage for a back buffer, or use BufferStrategy to manage one for you.  Never use a BufferedImage as a backing buffer - rendering into a BufferedImage is never accelerated.

TL;DR use a BufferedImage for assets, use a VolatileImage where you need an off-screen accelerated render target.
23  Discussions / General Discussions / Re: Make Android Apps with Java SE coding !!! on: 2015-09-23 16:25:56
Er... I already can do that? Coz, like, Android is completely based on Java SE 7?

Well, not quite.  Maybe he's planning on implementing all of Java2D, AWT and Swing for Android.  Roll Eyes  In which case, I'm looking forward to attempting to code in NetBeans with the swipe keyboard on my trusty old Moto G!  Grin
24  Games Center / WIP games, tools & toy projects / Re: Seas of Neptune on: 2015-09-23 16:17:27
If you're on Linux then you'll need to enter a command:
java.exe -jar -Dsun.java2d.noddraw=true neptune.jar

java -jar neptune.jar
.  Us Linux users have already taken a far more drastic method of disabling Direct3D!  Grin
25  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-22 12:01:48
Sound is otherwise already threaded behind the scenes,

ish ... that depends on what library and what API you're using.  Lower-level bits, including of JavaSound, are blocking (although there's usually some other threading stuff going on natively).  All depends what exactly @mike_bike_kite is actually using?  A third-party library?
26  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-21 13:26:51
  • ...
  • Thread four: sound

Thread two is very light and mostly is just waiting for stuff to happen. Should I mix in threads 3 and 4 into thread 2?

Never mix actual sound processing in a thread with anything else.  But that depends what you mean by "sound".  If you just mean sending events to a sound library, then that's probably fine as the library should have a dedicated thread for driving the audio.  OTOH, if you're using a blocking API such as the lower-level bits of JavaSound, then always use a dedicated thread.
27  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-21 11:24:02
Sure, this is possible, thanks! I somewhat always avoid using file I/O in a simple library, though Smiley I would prefer a solution with a system function call.

Or we can replace 5 lines of Java with a complex JNI interface to read those files instead!  Tongue  Personally I prefer the way Linux presents this information.

However, @Spasi's solution with hwloc is really great, we should wait for that. Smiley

Absolutely agree with you, since that provides far more information, and I'm generally in favour of libraries that -

  • Work cross-platform
  • Work on the basis of a Somebody Else's Problem field  Wink
28  Discussions / General Discussions / Re: Threads, games and running on all CPU's on: 2015-09-21 08:36:46
Ideally, would do without any third-party library, and under Windows there is at least GetLogicalProcessorInformation, however apparently no such easy equivalent under Linux.

btw, can't you get that information quite easily on Linux without JNI by just reading and parsing /proc/cpuinfo ?  Quick Google found this which includes a getNumberOfCores() method.
29  Discussions / General Discussions / Re: Simple to use sound in Java games on: 2015-09-20 22:31:08
Well, personally I disagree with you, but the one thing I'd question -

As it stores all audio as 16-bit, 44.1kHz, 2-channel, linear PCM data, if there is no supported mixer on a computer for these settings, the end user won't hear anything.

Are you seriously saying you've found a device that doesn't support CD format audio?!  Shocked
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-09-20 17:53:56
Realised if Praxis LIVE is going to have GStreamer 1.x video support I'm going to have to take the bull by the horns and fix up the existing bindings .. first push of gst1-java-core made to GitHub today  Working on Linux, no idea about Windows / OSX yet ...

Hello JGO! Webcam in Swing window (yes I know, dull compared to  Wink
Pages: [1] 2 3 ... 35
KaiHH (15 views)
2015-10-11 14:10:14

KaiHH (15 views)
2015-10-11 13:26:18

BurntPizza (45 views)
2015-10-08 03:11:46

BurntPizza (21 views)
2015-10-08 00:30:40

BurntPizza (26 views)
2015-10-07 17:15:53

BurntPizza (42 views)
2015-10-07 02:11:23

KaiHH (47 views)
2015-10-06 20:22:20

KaiHH (22 views)
2015-10-06 19:41:59

BurntPizza (38 views)
2015-10-06 19:04:48

basil_ (52 views)
2015-09-30 17:04:40
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 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!