Hi !
Featured games (86)
games approved by the League of Dukes
Games in Showcase (649)
Games in Android Showcase (181)
games submitted by our members
Games in WIP (699)
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 ... 15
1  Game Development / Newbie & Debugging Questions / Re: AABB collision detection as a filter for SAT collision detection on: 2016-01-27 10:35:40
This often a very good idea. As @Opiop says definitely benchmark and if there's no need for it, don't bother, but this is called the broadphase collision - with very broad, simple and indefinite collision tests and the narrow phase collision - with exacting collision tests which can be as complex as they need to be.
2  Game Development / Newbie & Debugging Questions / Re: Modern OpenGL & Shaders on: 2016-01-23 16:05:48
Also check out JOML for doing the maths. Don't use it myself but seems to be pretty popular and certainly has all the features you'll be needing. I believe it even has it's own matrix stack implementation.
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [libGDX] Is the LibGDX bullet binding standalone? on: 2016-01-12 19:09:13
I never bothered to isolate it because I don't really know the framework well enough but the basics were: whenever you tried to test the collision between a kinematic character controller and a static plane collision shape, a class cast exception was thrown. It's not a showstopping bug because obviously static planes don't appear too much in most games but I just felt it was worth seeing if it was actually necessary to use an old version of the library.
4  Game Development / Newbie & Debugging Questions / Re: [libgdx] trouble understanding orthocam and viewport on: 2016-01-12 10:48:14
So the best way to understand this is by looking at the camera analogy:
Click to Play

So the camera is all of the viewing (putting the camera in place), modeling (putting the objects in place) and projection (choosing the lens). The viewport is developing the picture (putting the image somewhere on the paper, the paper be analogous to the window).

So glViewport() only controls where in the window the stuff is rendered. Do not use it to control what is rendered. For most use cases, you should call glViewport() when the window is resized to make sure that you are rendering to the entire window.

I'm not sure what you mean by "a viewport that would be suitable for any resolution without the bars of glClear color" What bars is glClear presenting? If you mean to control the aspect ratio of a particular resolution, that should be taken care of in the camera.

For zooming, think about the camera analogy. To zoom in with a camera, you can either change the lens or you can move the camera closer. Same for OpenGL, change the projection or the viewing. What you cannot do is zoom by developing the photo differently.

Hope I've answered some questions.
5  Java Game APIs & Engines / Engines, Libraries and Tools / [libGDX] Is the LibGDX bullet binding standalone? on: 2015-12-28 14:20:22
Wondering whether LibGDX Bullet bindings can be used without the rest of LibGDX? This topic in the LWJGL forums (last post, last paragraph) suggest yes but I've just been trying and it seems to depend on the LibGDX math packages which are part of core LibGDX. Am I missing something or has the situation changed or is that just wrong.

I've been using JBullet previously but after encountering a pretty serious bug, I've decided using an older version is just untenable as well as being a bit silly.

6  Java Game APIs & Engines / OpenGL Development / Re: Netbeans GLSL editing mode? on: 2015-12-14 16:09:31
There are plugins but for older versions. For example a syntax highlighter:

But if I were you I'd just edit your shaders in something like Notepad++.
7  Game Development / Newbie & Debugging Questions / Re: Inertia tensor of aggregate mass on: 2015-11-15 12:48:35
It's that one thing which you never need again until suddenly you need it again.
8  Game Development / Newbie & Debugging Questions / Re: Inertia tensor of aggregate mass on: 2015-11-14 11:23:08
What you're looking for is the "Parallel Axis Theorem." It lets you sum various inertias (second moment thereof) and it's quite simple.

Essentially you can shift the second moment of inertia in one direction (let's say the x, y and z axes) to a new reference point. Once all second moments of inertia are all in relation to the same point, they can be summed together. (Pretty poor source of info unless you're at a far, far higher level of understanding of mechanics than me but even I was able to get the basics.)
9  Game Development / Newbie & Debugging Questions / Re: 3D Maths and OpenGL -- how and where do I get started? on: 2015-11-13 10:28:10
When it comes to vector maths in the context of game dev, my absolute favourite is
10  Discussions / General Discussions / Re: WIP Publication Reel on: 2015-09-25 18:29:04
The publication reel is just this sub-forum. If you want to talk to people about your in development game.
11  Game Development / Newbie & Debugging Questions / Re: jBullet compiling issue with JStackAlloc on: 2015-09-11 13:11:47
OK so it just started working. As far as I can tell, the only difference between today and yesterday is

A) My computer and the IDE (NetBeans) have been off and on again.
B) I've used JStackAlloc in another completely separate project.

I can only assume that one of these things have fixed the issue as I haven't touched the original project otherwise.
12  Game Development / Newbie & Debugging Questions / Re: jBullet compiling issue with JStackAlloc on: 2015-09-11 13:07:38
Tested out this theory just now by implementing my own little project testing out JStackAlloc. Took quite some figuring out the build script but managed to get it working allocating Vector3f and my own classes, both final and not. Only wish it could have been that simple.

13  Game Development / Newbie & Debugging Questions / Re: 2D - Smooth lighting with shadows for a tile-based game on: 2015-09-11 12:55:23
You might want to take a look at this tutorial. It isn't quite what you want but I think could easily be adapted., it isn't the easiest but would probably look the best in the end. (disclaimer: I've never actually implemented anything in this tutorial, just read it a while back out of interest).

If nothing else, give it a read and it'll give you an idea of how shadows are more commonly implemented.
14  Game Development / Newbie & Debugging Questions / jBullet compiling issue with JStackAlloc [SOLVED] on: 2015-09-10 19:59:41
So downloaded latest jBullet (Release 20101010) and I've been trying to get it to compile but I'm stuck on this error:

java.lang.IllegalStateException: first parameter of Stack.alloc(Class) must be constant (in class com.bulletphysics.collision.dispatch.ConvexConcaveCollisionAlgorithm, method processCollision)

It occurs during JStackAlloc's instrumentation phase of the compile, processing this snippet (I assume, that's the only calls to that method in the named method):

Now it seems to me that the first parameter IS constant and the instrumentation source code is a bit beyond my knowledge so I'm at something of a loss.

Thanks for any help you can give.

EDIT: The problem sort of resolved itself - see the 4th post for detail.
15  Game Development / Newbie & Debugging Questions / Re: Newbie Game Development Starting Point? on: 2015-09-03 16:07:21
Just to let you know, if you want to really start "from the bottom" then you do have to use an external library like LWJGL or JOGL and use OpenGL. That's the core graphics API that Swing is using under the hood.

Not saying you should, just letting you know.
16  Game Development / Newbie & Debugging Questions / Re: [LibGdx/LWJGL] What does this do? on: 2015-08-04 21:30:49
It shouldn't really be being called every frame. You should be reusing buffers, not reinitializing them every frame. I know LibGDX is managing this for you but perhaps you're using the wrong rendering method for this use case. (If you're interested)
17  Game Development / Newbie & Debugging Questions / Re: Simple Stupid Funnel Algorithm on: 2015-07-30 21:06:55
I know the feeling. I try to keep a bookmark to any resource I use for anything longer than half an hour and still I completely lose good resources all the time. Thanks for the link.

If anyone does have a definitive answer to the simplified version however, I'd still like to hear it just for completeness.
18  Game Development / Newbie & Debugging Questions / Re: Check to see if Triangle intersects Rectangle on: 2015-07-30 12:39:15
+1 on @BurntPizza but of course bearing in mind the cases that the triangle is completely contained within the rectangle or that the rectangle is completely contained within the triangle. For both of these cases there will be no line intersections. The test would be is one (only need to test one) of the triangle's vertices inside the rectangle and is one of the rectangle's vertices inside the triangle.
19  Game Development / Newbie & Debugging Questions / Re: Simple Stupid Funnel Algorithm on: 2015-07-30 12:33:33
Thanks for the reply.

However, just in case you haven't seen it, there's a comment on the blog post you linked to (fourth from the end) where someone questions whether the simplified version will guarantee correct results.

I hadn't actually thanks. I can't really understand what he's saying there though, seems to me the funnel does cut through portals. But it is reassuring (if a little annoying) to know that there may be flaws. The comment for others reading btw is:

Quote from: Sean@Blogspot
So, I've been working on my own implementation of the funnel algorithm and I realized what sacrifice you're making with this (as you called it) "simple stupid funnel algorithm". The "sleeve" you've shown in the illustration is clearly taken from the Lee and Preparata paper. However, it works because the funnel's extents get contracted by each successive portal/edge. Your funnel doesn't cut through the center of portals. If it were to, you'd get an unhappy path. It is for these cases that the whole double-ended queue is used. Did you want to comment on that at all?

And apparently no one did want to comment at all.

If this is where the extra path vertex would be added, it makes sense it would be missed. So, that would appear to be a flaw either in the algorithm or in the implementation. (I imagine you've already tried stepping through in the debugger, but it seems the reason for the missing step could probably be determined that way.)

Certainly that would appear to be the reason, but like I say, what happens is as far as I can see, what is supposed to happen. The image I posted is a collection of screenshots from my actual implementation (implemented it step-wise for debugging in the end). So what you see is what you get.

I think what I will do in the end is just implement the original funnel (aka "string pulling" I think) algorithm - wouldn't mind if this produced suboptimal paths but illegal paths I can't be dealing with, still like to know what is going on here though. There seemed to be suggestion of using this version as a heuristic in the A* algorithm so maybe try that out so the work hasn't been a complete waste. If you have any good links for the non-simplified algorithm you could recommend, it'd be much appreciated.

Thanks again.
20  Game Development / Newbie & Debugging Questions / Simple Stupid Funnel Algorithm on: 2015-07-29 18:11:04
So I have a question about the Simple Stupid Funnel Algorithm (, is the only time you add a new point to the path when either the new left edge crosses the funnel's right edge or when the new right edge crosses the funnel's left edge? That seems to be what all the descriptions I can find say and what all the examples show but there would seem to be many cases where this does not work.

In the below:
  • Blue lines are the edges of the triangle mesh.
  • Green lines are the unoptimized path.
  • The red line is the left edge of the funnel.
  • The cyan line is the right edge of the funnel.
  • The yellow line is the current portal.
  • The magenta line is the current "optimized" path.

Now the first row works well. The second row is the exact same with the last triangle removed and produces an illegal path.

(Direct Link:

Now as far as my understanding of the algorithm goes, my implementation is working other than that it produces an illegal result. So do I not understand the algorithm correctly, or have I missed something going wrong or is the algorithm itself just flawed?

Thanks in advance for any help.
21  Game Development / Newbie & Debugging Questions / Re: How to find memory leaks? on: 2015-07-14 11:00:34
You can't really have memory leaks in Java since the JRE manages the memory itself via the gc.

Is there somthing else that could cause it except memory leak?

Just something that is generally computationally expensive.

And the answer to how to find it is to run it through a profiler and see which bits are taking the longest. Any good IDE will have a decent profiler built in.
22  Game Development / Performance Tuning / Re: How to improve LibGDX 3D rendering performance? on: 2015-07-12 15:31:08

Just got back from implementing this one quick: it works great! It was easy to get the forward vector of the camera as it rotated, and the occlusion culling is seamless and gained me about 10 FPS. I'm really interested in hearing more about deferred rendering.

Right assumed you'd be rotating the sphere and keeping the camera constant but now I think about it your way round is better on so many levels. And I didn't actually realize there was a second picture, turns out I don't know how Imgur works.

As for deferred rendering, had a quick look through the LibGDX api (it was very sane) and it seems to me that the Mesh class is the one you want to be using to render this without batching up every frame. I might be wrong of course. Making the mesh, I assume that is fairly consistent as with the batching API so shouldn't pose too much of a problem. And rendering, I think the render() method of Mesh is all you need.

Now the problem with doing this. If you have a different Mesh for each tile it will not be terribly efficient (I'd guess round about your current level). Certainly try it out because it might be fine like that and would be a lot easier, but if it doesn't then you'll have to group tiles together into the same Mesh. You mentioned you have already split the sphere up into 12 (?) sections so if you were to have a single Mesh for each section that would be very good. But that brings another problem with the occlusion testing. (what follows might be very patronizing for you considering how easily you implemented it last time. If so I apologize).

Essentially you can't just use the centre of the section because even if that is facing away, some tiles might not be (since the section is not flat like the tiles). The naive way to solve this would be to test each tile around the edge of the section and if any of them are facing toward the camera then render the whole section. But there is another way (performance gain will be negligible so I'd do whichever is simpler). I assume that each section will cover a certain sector (probably wrong term) of the sphere, if so then the test dot "can you cull" can be "is the dot product positive AND is the angle between the camera's forward vector and the section's average normal (direction from centre to centre of section) greater than 90 degrees minus half the angle covered by the section." So a bit of psuedo code because writing that confused me:

float angleCovered = ...;
Vector3 cameraForward = ...;
Vector3 sectionNormal = ...;
float dot = dot(cameraForward, sectionNormal);
//less than or equal to now, again since the section is no longer flat.
if(dot <= 0) {
} else {
    //This line is unnecessary if you normalize the two normals.
    float normalDot = dot / (cameraForward .magnitude() * sectionNormal .magnitude());
    float angle = acos(normalDot);
    if(angle > (PI / 2) - (angleCovered  / 2)) {

And there is an optimization you can do there by precomputing the cos of "(PI / 2) - (angleCovered  / 2)" and then you don't need to use arccos.

I hope that made some sense. Feel free to question / criticise.
23  Game Development / Performance Tuning / Re: How to improve LibGDX 3D rendering performance? on: 2015-07-11 23:01:20
First thing with optimization, is make sure you are optimizing the right thing. Have you run the game through a profiler?  If you haven't it is very simple and most IDE's will have a nice big "profile" button that will do everything for you and give you the results in a nice easy to read format. So if you haven't, make sure you do and check that it is your rendering methods that are taking the most time (if there is any sanity to LibGDX it'll be spending most time in the batcher's render() and end() methods). Anyway...

What immediately jumps to mind is to use deferred rendering directly rather than batching every frame. This would mean creating one or more OpenGL buffers at initialization time containing all the data and only when there is a change updating / recreating them. This would make the drawing much quicker (at the cost of a little video memory of course). But I don't use LibGDX and have no idea how to go about doing this in the LibGDX framework.

Occlusion culling would be very good in this case and very efficient too for the case of a simple sphere however, in your picture you have the tiles on the far side of the sphere being rendered and you can see them. With occlusion culling this would not be the case so you'd have to decide whether or not you want this.

If you do want to cull them then the test is as I say very simple, a single dot product between the tile's normal (a vector pointing from the centre of the circle to the centre of the rotated tile) and the camera's forward vector (as long as you aren't moving the camera, this is just [0, -1, 0] or potentially [0, 1, 0] depending on how your matrices are set up...). If the result is greater than or equal to zero then the tile is on the far side of the sphere and can be culled.
24  Game Development / Newbie & Debugging Questions / Re: Won't render quad no matter what I do in OpenGL3+, what am I doing wrong? on: 2015-07-09 19:15:30
Protip. Check for GL Errors. You should be calling glGetError() every now and again otherwise if there is an error it will completely pass you by.

My advice before you go looking for bugs is to stick this at the end of your initialization code and at the end of each loop. See what that turns up with.

int err = glGetError();
if(err != GL_NO_ERROR) {
    throw new RuntimeException("GL Error: " + err);
25  Game Development / Game Mechanics / Re: (Ending Discussion to other Thread) How do Vbo Textures work? on: 2015-07-07 16:13:00
The texture that will be drawn is the texture that is bound at the time you call glDrawArrays(). So...

glBindTexture(GL_TEXTURE_2D, texture.getTextureID());

Put this line somewhere in your updateVBO() method (confusingly named method by the way when what it does is draw the contents of the VBO) BEFORE the call to glDrawArrays().
26  Game Development / Newbie & Debugging Questions / Re: How to implement scripting correctly? on: 2015-07-05 18:49:39
Short answer - whatever's easiest. The whole point of scripts in games is to make something that would take a long time in your core language take less time by "outsourcing" it to a scripting language. It means things are quicker (in the long run), more organized (easier to find / modify specific things) and generally more modifiable and less problem prone. So just jump into it, make an implementation. If you think it could be made easier to use, make it so.
27  Discussions / Miscellaneous Topics / Re: How to Learn Web Development for Java Programmers on: 2015-06-29 13:03:03
As far as I'm concerned, the only place you need to go to learn about web development is w3 schools. Literally that website, look at the menu down the left hand side. HTML, CSS, JavaScript (Including JQuery, AJAX and Angular and Bootstrap if you're interested in such things) and then goes onto all kinds of server side and more core technologies. And that's just the tutorials it shows there. There are plenty more on pretty much anything you'd ever need to know about developing anything for the web. The tutorials are great and they've even got interactive examples. Look no further.

This makes me cringe a bit, but maybe the site has improved over the past few years? Full disclosure I haven't touched the site in years. w3schools is, or at the very least, used to be notorious for misinformation and a good cause of major beginner web dev headaches. They're not in any way affiliated with w3c btw. See

Even so the Mozilla Developer Network (MDN) is a good place for accurate information

If you're more into a classroom approach is a good choice imho.

As with many tutorials, it is not a covers all solution. For beginners I think it is very good and will certainly start you off well and point you in the right direction but I completely agree that for advanced topics and as a reference it is at best not very good and at worse completely useless. But speaking as someone who has never relied on it as a source of information I can't say it has ever misinformed me.

Didn't realize it wasn't affiliated with w3c though. Thanks for that shout.
28  Game Development / Newbie & Debugging Questions / Re: Fatal Exception - What'd I do? on: 2015-06-29 12:57:59
Essentially this is the equivalent of an IndexOutOfBoundsException in Java. You get it when one of the pointers you have set up tries to access some data outside of the OpenGL Buffer. Because there is no check to ensure it is in bounds, the program tries anyway and the os doesn't let it because it doesn't have access to that portion of memory and instead causes and access violation error.

So check your pointers. Post any calls to glVertexAttribPointer(), any calls to glBufferData() any calls to glDrawXXX().
29  Discussions / Miscellaneous Topics / Re: How to Learn Web Development for Java Programmers on: 2015-06-28 19:37:58
As far as I'm concerned, the only place you need to go to learn about web development is w3 schools. Literally that website, look at the menu down the left hand side. HTML, CSS, JavaScript (Including JQuery, AJAX and Angular and Bootstrap if you're interested in such things) and then goes onto all kinds of server side and more core technologies. And that's just the tutorials it shows there. There are plenty more on pretty much anything you'd ever need to know about developing anything for the web. The tutorials are great and they've even got interactive examples. Look no further.
30  Game Development / Game Mechanics / Re: Collision between different maps (2d lwjgl) on: 2015-06-12 22:04:18
...since I can't pass the arraylist by reference in java... but only by value (I think)...

Nope. Java is pass by value but the values it passes are references to objects not the objects themselves. So it is essentially pass by reference. But study this example carefully and understand why what happens happens. It is somewhat important.

public class Foo {
    public int x;

    public Foo(int x) {
        this.x = x;

    public static void bar1(Foo foo, int x) {
        foo.x = x;

    public static void bar2(Foo foo, int x) {
        foo = new Foo(x);

    public static void main(String[] args) {
        System.out.println("Example 1: Accessing Reference");
        Foo f1 = new Foo(10);
        bar1(f1, 20);

        System.out.println("Example 2: Reassigning Reference");
        Foo f2 = new Foo(10);
        bar2(f2, 20);

The output of this code would be:
Example 1: Accessing Reference
Example 2: Reassigning Reference
Pages: [1] 2 3 ... 15
KaiHH (65 views)
2016-01-31 23:15:29

sci4me (92 views)
2016-01-23 21:47:05

sci4me (78 views)
2016-01-23 21:46:58

KaiHH (112 views)
2016-01-19 13:26:42

theagentd (193 views)
2016-01-05 17:10:00

ClaasJG (212 views)
2016-01-03 16:58:36

chrisdalke (200 views)
2015-12-28 06:31:21

Guerra2442 (230 views)
2015-12-25 03:42:55

Guerra2442 (227 views)
2015-12-25 03:27:21

theagentd (262 views)
2015-12-21 14:43:24
List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48 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!