Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (686)
Games in Android Showcase (198)
games submitted by our members
Games in WIP (758)
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  Java Game APIs & Engines / OpenGL Development / Re: LWJGL instance in Javafx on: 2016-04-29 17:16:21
Take a look at this example: https://github.com/Spasi/LWJGL-FX
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: WebGL4J - Simple GWT based WebGL wrapper for Java on: 2016-04-09 13:58:13
Much appreciated as ever.

It's a very useful library btw. At first I tried to write in pure JS but then as ever the application got bigger than 3/4 files and JS began to become increasingly untenable so I thought to myself oh no I'm going to have to write the bridge between WebGL and GWT myself and it's going to be messy and horrible and then I remembered you posting about this and, as one of the most important marks of a good library, it just worked. So thank you.
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: WebGL4J - Simple GWT based WebGL wrapper for Java on: 2016-04-06 20:00:00
Hey @SHC, I found another little bug.

glGetUniformLocation() is supposed to return a "-1" if the uniform doesn't exist in regular OpenGL. Obviously WebGL returns a "null" instead but the WebGLObjectMap maps a null to a zero. I suppose technically not a bug but I'm thinking undesirable behaviour?
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: WebGL4J - Simple GWT based WebGL wrapper for Java on: 2016-03-30 21:11:00
Ah very good. Knew they existed for the extensions but just never thought to look on the core classes, sorry.
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: WebGL4J - Simple GWT based WebGL wrapper for Java on: 2016-03-29 14:55:03
Amazing. Thanks so much. One last thing, not a bug this time I promise, a suggestion. I was updating my graphics driver the other day and once it installed it messed around with already open Chrome and long and the short I notice that the default behaviour for your library if it cannot get a WebGL context is to blast you with an alert saying you don't have WebGL which then takes you to the get WebGL website.

A lot of the time this is desirable behaviour but not always. For example WebGL might only be a section of the page and the other stuff is still useful even if the WebGL isn't working in which case it's pretty annoying if you keep getting redirected whenever you tried to load it up. Also redirecting with alerts like that can screw up the back button on some browsers I think (because you can't go back twice since you keep getting redirected). So perhaps A) include a function to test if WebGL is supported (also turns out you can test whether it is the browser not supporting WebGL or the hardware) and B) make the popup behaviour default but optional for the developer?

Anyway here is a quick function I wrote to test for WebGL support:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
/**
 * Returns null is WebGL is supported otherwise a String giving the reason why not.
 */

private static native String isWebGLSupported() /*-{
    var canvas = $doc.createElement("canvas");
    var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
    if(gl && gl instanceof $wnd.WebGLRenderingContext) {
        return null;
    } else {
        if($wnd.WebGLRenderingContext ) {
            return "Hardware does not support WebGL";
        } else {
            return "Browser does not support WebGL";
        }
    }
}-*/
;

I think there are a few reasons you might not be able to create a WebGL context if the browser supports it but I'm pretty sure I'm getting this from the WebGL spec on MDN so seems fairly legit. Also not 100% on the creating an offscreen canvas and canvas just to test for support but this is apparently the established method according to MDN again. Also if you incorporate this into the actual context creation then it's a non-problem.

Obviously just my penny's worth but what do you think?
6  Games Center / Showcase / Re: Cross Platform MMORPG: Little War Online on: 2016-03-29 14:37:03
Very pretty website but watch out cos there are a few typos. The ones I noticed:

Quote
The mission of the Draxian Paladin is to protect his foes
I presume that should be "protect his allies" unless I'm missing something.

Quote
These voracious spellcasters summon mystical minions to fight beside them and are experts sorcerer's
Should be "expert sorcerers"

Quote
they are the fastest and more agile warriors of the world
"and most agile"

So maybe it is worth a quick once over? Sorry to be picky it's just it really is a very pretty website but stuff like that just spoils things (certainly for me).
7  Java Game APIs & Engines / Engines, Libraries and Tools / Re: WebGL4J - Simple GWT based WebGL wrapper for Java on: 2016-03-27 12:28:28
Thanks very much. I actually just found something else as well.

For glBufferSubData(), it's spec is,
1  
void bufferSubData(enum target, long offset, Object data)

but WebGL4J has a prototype like the desktop GL version with a size parameter: "glBufferSubData(int target, int offset, long size, ArrayBufferView data)" which causes a crash when you try to use it "No function was found that matched the signature provided."
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: WebGL4J - Simple GWT based WebGL wrapper for Java on: 2016-03-26 19:17:20
Hey @SHC
Just started using WebGL4J (literally few hours ago so might be missing something) but I think you're missing a function.

In WebGL there is a variant of glBufferData() which takes a long for initializing an empty buffer of a certain size.
1  
void bufferData(enum target, long size, enum usage)

That's its definition on the WebGL quick reference card.

Anyway it certainly works for me using WebGL straight from JS but doesn't seem to exist in WebGL4J. Obviously easily worked around but just letting you know.
9  Game Development / Newbie & Debugging Questions / Re: Array Of Sub-Classes on: 2016-03-23 09:57:16

...
Note: this will get you some unchecked warnings
...

Protip: you can cheat Java into letting you create generic arrays without any ugly, unnecessary (from the pov of the programmer) casts or annoying warnings by using a generic, varags method.

1  
2  
3  
public static <T> T[] genericArray(T... arr) {
    return arr;
}


use like this:

1  
2  
3  
4  
public static final Class<? extends GameItem>[] items = genericArray(
    Hammer.class,
    Nail.class
);


Java even infers the generic type when used like this so it's a very clean method. You can even create empty arrays of programmable lengths by using the Array.copyOf method as well:

1  
2  
3  
public static <T> T[] genericArrayEmpty(int n, T... foo) {
    return Arrays.copyOf(foo, n);
}


Where "foo" is a dummy parameter. You can use it like this:

1  
public static final Class<? extends GameItem>[] items2 = genericArrayEmpty(5);


Helps if you're a fan of pretty code.
10  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.
11  Game Development / Newbie & Debugging Questions / Re: Modern OpenGL & Shaders on: 2016-01-23 16:05:48
Also check out JOML https://github.com/JOML-CI 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.
12  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.
13  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.
14  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 http://forum.lwjgl.org/index.php?topic=5409.msg28691#msg28691 (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.

Thanks.
15  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: http://plugins.netbeans.org/plugin/46515/glsl-syntax-highlighter.

But if I were you I'd just edit your shaders in something like Notepad++.
16  Game Development / Newbie & Debugging Questions / Re: Inertia tensor of aggregate mass on: 2015-11-15 12:48:35
Ditto.
It's that one thing which you never need again until suddenly you need it again.
17  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.

https://en.wikipedia.org/wiki/Moment_of_inertia#Parallel_axis_theorem (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.)
18  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 http://www.wildbunny.co.uk/blog/vector-maths-a-primer-for-games-programmers/.
19  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.
http://www.java-gaming.org/boards/wip-games-tools-toy-projects/78/view.html
20  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.
21  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.

22  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. https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows, 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.
23  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:

Quote
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):
1  
2  
3  
4  
concaveShape.processAllTriangles(
        btConvexTriangleCallback,
        btConvexTriangleCallback.getAabbMin(Stack.alloc(Vector3f.class)),
        btConvexTriangleCallback.getAabbMax(Stack.alloc(Vector3f.class)));


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.
24  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.
25  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)
26  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.
27  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.
28  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.
29  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 (http://digestingduck.blogspot.co.uk/2010/03/simple-stupid-funnel-algorithm.html), 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: http://i62.tinypic.com/2eq73t2.png)

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.
30  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.
Pages: [1] 2 3 ... 15
 
roseslayer (398 views)
2016-08-06 11:43:29

roseslayer (364 views)
2016-08-06 09:43:11

xTheGamerCodes (438 views)
2016-08-04 15:40:59

xTheGamerCodes (432 views)
2016-08-04 15:40:24

orrenravid (783 views)
2016-07-16 03:57:23

theagentd (858 views)
2016-07-11 14:28:54

Hydroque (957 views)
2016-07-06 05:56:57

Hydroque (983 views)
2016-07-03 08:52:54

GrandCastle (796 views)
2016-07-01 09:13:47

GrandCastle (635 views)
2016-07-01 09:09:45
Rendering resources
by Roquen
2016-08-08 05:55:21

Rendering resources
by Roquen
2016-08-08 05:52:42

Rendering resources
by Roquen
2016-08-08 05:50:38

Rendering resources
by Roquen
2016-08-08 05:49:53

Rendering resources
by Roquen
2016-08-08 05:32:39

Making a Dynamic Plugin System
by Hydroque
2016-06-25 00:13:25

Java Data structures
by BinaryMonkL
2016-06-13 21:22:09

Java Data structures
by BinaryMonkL
2016-06-13 21:20:42
java-gaming.org 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‑gaming.org
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!