Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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 ... 30
1  Game Development / Newbie & Debugging Questions / Re: Slow Thread for loading on: 2014-09-27 10:39:15
Generally I agree with @BurntPizza, but if you do really need to do this and are new to concurrency, I'd also start by looking at some of the higher level utilities in the JDK, such as ExecutorService and Future, rather than dealing with Threads directly.
2  Game Development / Newbie & Debugging Questions / Re: warning: [options] bootstrap class path not set in conjunction with -source 1.6 on: 2014-09-25 14:07:15
or use a newer JDK (the one javac uses).

Think you mean use an older JDK!  Wink

AFAIK this warning was introduced with the javac in 1.7 to warn you that even though you're specifying to compile as compatible with 1.6, if you compile against newer (1.7+) JDK classes your code may still not actually work on 1.6

Unless you're specifically targeting 1.6 (in which case set its JDK as the bootstrap class path) then I assume you're using an IDE where the project has the source level set.  If you set that to the same as your JDK, this warning should disappear.
3  Discussions / General Discussions / Re: Are Java applets really "dead" for indie developers? on: 2014-09-22 15:16:18
Processing also offers an approach to working in Java and deploying to JS, with 3D (WebGL) support -
4  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-22 14:39:21
Assuming you know the centre point of your entity, which should be x + halfWidth, y+ halfHeight.  You also need an array of your 4 white points - ie. float[8] {x1,y1,x2,y2, etc.

It should be something like (untested!) -

float[] pts = ...
AffineTransform at = new AffineTransform();
at.rotate(Math.radians(angle), centreX, centreY);
at.transform(pts, 0, pts, 0, 4);

After which the pts array will contain the transformed points.

I'm slightly wary of why you are having to flip the y-axis in the code you posted.  Undecided

5  Discussions / General Discussions / Re: Website Content Management on: 2014-09-22 10:54:24
IMO Wordpress or Drupal are probably the quickest, most flexible and future proof ways to go.

Choose the right tool for the task!   Wink

Drupal isn't the quickest way to get up and running - it IMO rightly positions itself as a content management platform  If you want the flexibility choose Drupal (I spend half my life at the moment developing with it), but if you need something quick and easy to run OOTB, choose WordPress.

Or any of numerous other options, just don't roll your own!  Grin
6  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-22 10:42:32
Thanks all. Solved it

Well, at least if you used AffineTransform you'd be using the right algorithm, and have something that still performs better than this!  Wink  You could also look and see if there's a utility in libGDX for applying matrices to a sequence of points.

Can probably be improved to work with rectangular shapes and not just squares.

Well, using halfHeight on y coordinates would be a start!

What do you mean rotate around (0,0)?  How am I suppose to calculate the position of the rotated point if I rotate around 0,0 instead of the entity┬┤s position?

I think you're missing the point.  The rotation code rotates around 0,0.  So, you need to effectively translate your entity so it's mid-point is at 0,0, apply the rotation, then translate it back to where it was.  Or just use something that handles all that for you until you understand what is going on.
7  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-21 18:38:44
Well, the most obvious thing is that you've taken me slightly too literally  Wink - you need to translate your midY coordinates in the same way so that you're rotating around 0,0!
8  Game Development / Newbie & Debugging Questions / Re: Get points of rotated rectangle? on: 2014-09-21 14:46:37
@Roquen - thanks, always good when people back up their "pile of junk" statements with the logical argument behind it.  Wink

Reading in the variable that specifies "what special case" from L1 cache to register takes 5 cycles of latency and everything goes massively downhill from there.  So that 4000 line class would be much faster if it were probably less than 200.

Bear in mind, though, that if you're transforming a series of points, that special case is only checked once, whether you're doing 1 point or 1000's.  I wonder how many it takes to actually be worth it!?  Smiley

The type tracking stuff is borderline useful at times too.
9  Game Development / Newbie & Debugging Questions / Re: Get points of rotated rectangle? on: 2014-09-20 17:46:29
Care to elaborate?  Wink
It's written to be reasonable on machines prior to the Pentium 3.  On newer machines than's doing it complete wrong.

Care to elaborate more?  Grin  Now you've got me really intrigued and confused.  What exactly is "wrong", and what would be the correct approach?

Its not really clear from Op's post whether he is using Java2D, another library or if he's implementing his own 2d renderer, therefore I suggested a generic answer rather than pointing him to a specific API like AffineTransform.

It's a pity it's under awt, along with all the geometry classes, as they're pretty toolkit agnostic really (assuming JDK and not Android).
10  Game Development / Newbie & Debugging Questions / Re: Get points of rotated rectangle? on: 2014-09-20 14:16:40
Notes:  AffineTransform is a pile of junk. 

Care to elaborate?  Wink  I've no doubt you have a valid reason, but an example of how you'd solve the OP's question would be good!  Tongue

The reason I suggested AffineTransform is that internally it's doing @kappa's suggestion, but could also handle the OP's question around translation to his coordinate system, and it should perform just as well (possibly better if you naively implement and don't cache the trig calls), and definitely faster than the other code posted above.  It's also simpler!  Unless it's actually a bottleneck, sometimes simpler is better.
11  Game Development / Newbie & Debugging Questions / Re: Get points of rotated rectangle? on: 2014-09-20 10:22:48
how do I apply that to my coordinate system?

You'd have to translate all your points to put the centre of the rectangle at the origin, rotate, then translate back.

eg. x = x - midX; x = rotate(x); x = x + midX;

I stick by my question / suggestion above.  Why not use AffineTransform?  You set up the transform to rotate around the centre of your rectangle then pass in an array (float or double) of your points as a series [x1, y1, x2, y2, ...] and get back an array of transformed points in the same configuration.  Internally IIRC it's pretty much doing what @kappa is suggesting, though caching various values.
12  Game Development / Newbie & Debugging Questions / Re: Get points of rotated rectangle? on: 2014-09-19 18:04:22
What's wrong with using AffineTransform?  persecutioncomplex
13  Game Development / Performance Tuning / Re: Check for null or check for implementation? on: 2014-09-15 09:16:05
Short answer.  Classes only have a single parent and interfaces are a potentially arbitrary list per class, so in general more searching is required in the interface case.

None answer??  Tongue  I'm not sure where the list is relevant, unless we're talking about the actual bytecode required (which I didn't think you were?)

Choose the exactly right type can be problematic if you rework the type hierarchy and all relevant instanceof checks will require change.

This is where an interface would seem to make more sense, not less.  If you treat the interface as a capability you're filtering for, you can change your type hierarchy and implementation as much as you want - a good reason to choose an interface over a concrete type, no?

I'm not advocating it as a general approach, but it does make sense occasionally, particularly when (as per previous post) the alternative involves methods throwing exceptions.

Another alternative I like, though not going to perform quite as well, is something like the Lookup.Provider API in the NetBeans platform where you make the entity responsible for providing its own capabilities - something like

Drawable d = entity.getLookup().lookup(Drawable.class);
if (d != null) {
14  Game Development / Performance Tuning / Re: Check for null or check for implementation? on: 2014-09-15 08:20:54
Generally using instanceof is an explicit type query which in general requires walking lists and requires selecting the exactly right type.  And the situation is worse if the type is an interface type.

Huh? Why? IMO, using with interfaces makes the most sense as it's effectively using instanceof as has-capability-to.

Quite often that leads to the perfectly reasonable design of having a phat base class full of abstract methods (or, more usefully, an interface).

That depends.  Having no-op methods isn't too bad, but take something like the List interface - having an API where half the methods are defined to throw exceptions when they're not supported is IMO even more daft than having a sub-interface and using instanceof to check if it supports modification.

Then I move on to more actually difficult problems Wink

+1  Grin
15  Game Development / Performance Tuning / Re: Check for null or check for implementation? on: 2014-09-14 09:33:30
Class.isInstance and Class.isAssignableFrom are as cheap as instanceof bytecodes when the operands are constants,

Note the emphasis though!  Wink

First review your program design - the need to cast or use instanceof is often a warning the design could be cleaner. ... I usually put a function in the base class like boolean isDrawableInMainEntityLoop() or whatever.

So you replace a wart with a tumour?  Grin  IMO people sometimes try too hard to remove instanceof and replace it with something many times more complicated or worse performing.  I think it has its place, particularly considering Java lacks double dispatch.  I think using it to search for objects with a certain capability (ie. implements Drawable) is OK, as long as you're only looking for a single capability at a time - if you have a chain of 'if instanceof else if instanceof' then you do have a problem.
16  Game Development / Performance Tuning / Re: Check for null or check for implementation? on: 2014-09-13 16:21:19
Null checks are very fast, reflection is generally slow.

Not sure that counts as reflection, but anyway not sure why the OP's second example isn't

if (entity instanceof Drawable) 

And even then it's the wrong way around

if ( Drawable.class.isAssignableFrom(entity.getClass()) )

And be wary of either - have an overridden method in your entity if possible, even if that's a no-op.
17  Java Game APIs & Engines / OpenGL Development / Re: Shader blend modes - glCopyTexSubImage or FBO bind? on: 2014-09-12 09:27:09
it will be faster then copyTexImage, but if you're better with a single FBO or multiple, i don't know.

Thanks @basil_  My inclination was to try the FBO re-bind option first, as it's the easiest to implement given what I've already got.  You've put my mind at rest a bit that this should be the right approach.

I'll be using multiple FBOs because v2 of Praxis LIVE is built on top of the Processing OpenGL renderer.  I've hacked it enough already - trying to get it to use a single FBO is probably a step further than I want to go.  My switch (from v1) is to attempt to reduce the amount of low-level GL code I have to manage!  Wink

depends on how often you change the render target per frame. if you have something like 2-5 FBO's, don't bother to optimise them.

That's all going to be user dependant - could be 2, could be 20, could be 200 - when their machine judders to a halt they'll know they've gone too far!   Grin
18  Game Development / Newbie & Debugging Questions / Re: Is it Possible to use Java and send sounds through the microphone? on: 2014-09-12 09:14:37
It's probably not going to help in this particular case, but you could make use of JACK.  However, it's designed for pro-audio so on Windows it will only work with software using ASIO.  On OSX it should do this job fine - software like SoundPimp uses it for a similar purpose in Java.  Works on Linux too, though PulseAudio (so JavaSound) also allows this for "consumer" software.

I'm the author of the Java bindings for JACK.  If you're interested you can find them at along with a range of other audio libraries.  More info about JACK, Java and the JAudioLibs audioservers at

That is what I was thinking when I wrote that. It's not entirely far-fetched as a possibility. I think a couple others also noted that the microphone can be made to vibrate and make a signal,

Not far-fetched at all - see  You can also do the reverse.
19  Java Game APIs & Engines / OpenGL Development / Re: Shader blend modes - glCopyTexSubImage or FBO bind? on: 2014-09-11 11:15:12
@basil_ thanks for the input  Smiley

i think blitting into a fbo is fastestest.

OK, option 3!  Or 2.5.  I thought blit should be faster, but had discounted it because I then read some things online that suggested it wasn't faster than RTT and sometimes slower, depending on the hardware / driver.  I think this was down to RTT being more common and therefore more optimised.  Confused!  Clueless

it's something like :

glTexSubImage < RTT < blit

I assumed glCopyTexSubImage would be a slower operation in itself, but aren't FBO binds also slow?  Using the former would allow to keep the same FBO bound throughout.  Taking the need to bind an FBO twice, will RTT or blit still be faster?

if you want to access the default-frame-buffer, just use id 0.

In my particular case, this will be always be working with texture-backed FBO's.  Not sure if that will make a difference to the "right" answer.
20  Java Game APIs & Engines / OpenGL Development / Re: Shader blend modes - glCopyTexSubImage or FBO bind? on: 2014-09-11 09:37:18
hmm .. surely someone on here has had to do this!?  persecutioncomplex

TL;DR - Which way of getting the current framebuffer into a texture is likely to work faster across different machines - using glCopyTexSubImage or using render-to-texture (bind texture FBO, draw quad, re-bind previous FBO)?
21  Java Game APIs & Engines / OpenGL Development / Shader blend modes - glCopyTexSubImage or FBO bind? on: 2014-09-10 13:22:42
I'm currently looking at implementing some of the additional blend modes in Praxis LIVE within the OpenGL pipeline - ones like DIFFERENCE which need to be implemented in a shader using multiple textures.  I'm hoping to get some advice on the best way to achieve this.

All surfaces within the pipeline use texture-backed FBO's, which are cached and reused - so doing this on a full image should be quite easy - render two surfaces on to a third.  However, I'm not sure what to do in the case the user wants to render into a sub-region of a surface.  Now I probably need to get a part of the destination surface into one of the source surfaces, and I'm not sure of the best approach -

  • Bind first source texture FBO, draw destination region into it, bind destination FBO and blend textures.
  • Bind destination FBO and first source texture, use glCopyTexSubImage to get destination region into source texture, then blend textures.
  • Bind new destination FBO (like full-screen), draw areas of original destination around sub-region, then blend sub-region.
  • AN other suggestion??

I'm inclined away from option 3 as it seems to involve a lot of unnecessary rendering.  So, what's likely to be the best performing way of getting the destination FBO into another texture - option 1 involving two FBO binds, or option 2 using glCopyTexSubImage?  Or am I missing an obvious alternative?

Hope that makes sense, and thanks in advance, Neil
22  Discussions / Miscellaneous Topics / Re: Problem with patterns in java on: 2014-09-09 15:02:16
and I can't understand why group 4 isn't null like group 2

Because it's like group 1.  Group 5 is like group 2 (null).  Check the documentation of groupCount() - it doesn't include group 0.  If you use a for loop you need to use <=

I also tried altering your regex a little bit - not sure if it's better  Undecided

        String text = "[testBefore,2014-09-09 19:00:00,testAfter]";
        String regex = "\\[((.*),)?(\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2})(,(.*))?\\]";
        Matcher m = Pattern.compile(regex).matcher(text);
        if (m.matches()) {
            for (int i=0; i<=m.groupCount(); i++) {
                System.out.println(i +":";
        } else {
            System.out.println("No match");
        text = "[2014-09-09 19:00:00]";
        m = Pattern.compile(regex).matcher(text);
        if (m.matches()) {
            for (int i=0; i<=m.groupCount(); i++) {
                System.out.println(i +":";
        } else {
            System.out.println("No match");

Output is

0:[testBefore,2014-09-09 19:00:00,testAfter]
3:2014-09-09 19:00:00
0:[2014-09-09 19:00:00]
3:2014-09-09 19:00:00

Nice little challenge for the afternoon.  Wink
23  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env - request for testing / comment on: 2014-09-07 15:37:03
Just released a minor bug-fix update that addresses a couple of issues with correct saving of custom code in the last snapshot.

Praxis LIVE v2 snapshot build:140905 Download | Release notes

We can mention your application in the homepage of JOGL if you want.

Thanks, that would be great!  Smiley You'll probably want to make sure that it refers to v2 though - the current stable v1 release is still using LWJGL.  I've just edited some links on the site to explicitly refer to v1 & v2 to avoid any confusion.
24  Discussions / General Discussions / Re: Can a Single Developer Create a Big Game? on: 2014-09-07 11:28:11
Minecraft?  Wink
25  Game Development / Newbie & Debugging Questions / Re: Paulscode - Soundsystem - Load from bytebutter? on: 2014-09-05 20:50:28
The reason I switched to an OpenAL sound library was because JavaSound wouldn't cut it.

I wasn't suggesting you change library (though personally, I'd much rather use JavaSound - just most people use it wrong!).  The AudioInputStream is JavaSound - I'm suggesting you make sure that JavaSound can play that stream - then you'll know whether the problem is the stream implementation or how Paul's library is using it.  For that matter, are you sure that Paul's library implements playing a JavaSound stream through OpenAL?
26  Game Development / Newbie & Debugging Questions / Re: Paulscode - Soundsystem - Load from bytebutter? on: 2014-09-05 17:54:58
The sound loads into the sound system with no error, however it doesn't seem to make a sound when played.

Have you tried it with plain JavaSound?  I'd rule out issues with the sound library to start with.

Thanks for the idea with the bytebuffer - input stream Smiley

No problem.  Like I said, I keep meaning to play with this - this way you test it out for me!  Grin
27  Game Development / Newbie & Debugging Questions / Re: Paulscode - Soundsystem - Load from bytebutter? on: 2014-09-04 19:21:27
I still haven't figured this out, however. I do not want to have to create a temporary file just to load a sound; there has to be a way to use Pauls soundsystem to load a sound from a bytebuffer Sad

I keep meaning to try wrapping a ByteBuffer in an InputStream (and wrapping in eg. AudioInputStream) Something like this might help you on your way -  That of course depends on whether Pauls system has a way to provide an input stream directly.
28  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env - request for testing / comment on: 2014-09-02 09:10:23
Aha! cool, yep the examples work now that I open them as projects. The video input and blob examples were cool, they grabbed the video from my laptop camera just fine. How did you do that? What java lib can get access to the video camera so easily?

That's GStreamer with the GStreamer-Java bindings.  There's an old thread on here somewhere with code to use GStreamer with LWJGL (GstLwjgl) - you appear to have appreciated it at the time!  Wink

I couldn't figure out how to edit the code in the 'live coding project', there wasn't any button next to the properties of the code element.

Ah, that's a change in this alpha release - to edit code now you need to right-click on the component (header) in the graph window and choose Edit code from the popup menu.  You can edit shader code the same way.  The code will open in a separate editor tab - every time you save the code file it will be re-compiled.  Quite a few of the components in the new examples can have code edited in that way - eventually it will be possible to edit the code of most of the built-in components.

You can also double-click components to open properties in a separate window, if you haven't found that yet - useful to keep them accessible while editing code.

The GLSL example just showed a blank window, but I couldn't turn on the openGL pipeline since only the 'Software Renderer' was available in Tools/Options/Video.

Another change in v2.  There should be a message showing at the bottom of that option window.  Renderer setting has been moved into the 'root' settings for the video patch.  Open that project, click build (you can't change renderer while it's running), open the video.pxr file in the graph, click the button next to play in the editor toolbar to open the 'root' properties, and change the renderer there.

New Custom and Smoky 3D were good. Would be nice to see a demo with an animation of flashing lights or something which is sync'ed with the bass of a song.

Yes, I'll put something together  - in fact, the logo and splash screen are stills from a project that does pretty much that.  The audio sequencer example is doing animation based on audio levels too, though it's only drawing shapes.

This video is quite fun - done by a VJ from Australia.  It's using an external FFT program to control a shader in Praxis LIVE via MIDI.  At some point I'll get around to adding in an FFT component.

You may also want to check out the Praxis LIVE video playlist -  - they're a bit old now, though - I'll get some more up-to-date videos done soon.
29  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env - request for testing / comment on: 2014-09-01 16:46:09
I downloaded the latest test build and it worked well.

Great, thanks, good to know.

Would be good if it came pre-loaded with a cool demo project that would play some music and make a video with GLSL just to show off the features.

Agreed(ish).  Some more up-to-date and more exciting examples are definitely needed.  I'm less sure about packaging them in the install unless I can make some without many resources - the installer for the new version will be big enough already.

I presume you tried the New Custom and Smoky 3D examples on the Resources page?

Impressive for how you were able to borrow some code from netbeans. Was it difficult to integrate? I've also experimented with the swing code editor JSyntaxPane but found it to be unreliable and always wanted to know how hard it would be to borrow the editor from netbeans or eclipse.

Praxis LIVE is based on the NetBeans platform (in fact, it's in the showcase) so integrating the editor wasn't too difficult, though connecting everything up so that it treats the in-memory class body as an actual Java file was fun!  persecutioncomplex  If you're not building on top of the NetBeans RCP, I'm not sure I'd even attempt to use the editor - there used to be a separate library available but not for some time.  Not sure how usable the Eclipse editor is outside its platform either.

In the depths of time I used JSyntaxPane too, but for the last few years the editor in Praxis LIVE was RSyntaxTextArea. I'd recommend it if you're looking for a lightweight code editor component, and it has some additional code completion support (though not as good as a full IDE editor, hence my switch).

PS: The older version 131206 didn't work when I started it. Just an opening splash screen and then it died ... Windows 7, intel i7.

But I bet not Java 7!  Wink  Unfortunately 131206 is not compatible with Java 8.  Not my fault - there's a bug in NetBeans platform 7.2 - that version of the IDE doesn't work with Java 8 either.  I'll be glad when I can consider Praxis LIVE v2 stable enough to remove the 131206 download.

Also I tried downloading the example zip file (examples but couldn't figure out how to load it.

After unzipping externally it should recognise all the subfolders (01 Hello World, etc.) as projects which can be opened.  Huh  Also, in case you got this far, remember to restart the hub (red circular arrow) between trying to run each example.

The project zip / unzip menu items are from the underlying platform, and may be more trouble than they're worth at the moment.  I'll do some testing with them prior to the next release, and if they're not proving that useful will hide them.

Thanks for your input, Neil
30  Games Center / WIP games, tools & toy projects / Re: Praxis LIVE v2 - live visual / coding env - request for testing / comment on: 2014-09-01 08:01:30
Saw this and just thought it looked awesome . Definitely going to use this.

Thanks! Cheesy Let me know how you get on.  I didn't publicise the first alpha beyond some known users, so be interesting to hear back on what does or doesn't work for you, or what feels confusing.  There is a manual for v1, but it's not been updated for v2 yet - should still help get you started.
Pages: [1] 2 3 ... 30

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

The first screenshot will be displayed as a thumbnail.

Pippogeek (38 views)
2014-09-24 16:13:29

Pippogeek (29 views)
2014-09-24 16:12:22

Pippogeek (18 views)
2014-09-24 16:12:06

Grunnt (42 views)
2014-09-23 14:38:19

radar3301 (24 views)
2014-09-21 23:33:17

BurntPizza (61 views)
2014-09-21 02:42:18

BurntPizza (31 views)
2014-09-21 01:30:30

moogie (36 views)
2014-09-21 00:26:15

UprightPath (49 views)
2014-09-20 20:14:06

BurntPizza (53 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08 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!