Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (715)
Games in Android Showcase (214)
games submitted by our members
Games in WIP (788)
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 ... 11
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2016-10-03 05:02:46
I created an extension to TWL for LWJGL3:

I had to pull out the LWJGL2 code into its own library as well.
2  Discussions / General Discussions / Design advice for a library I'm working on. on: 2014-06-06 12:33:59
I've been working on this steering behavior library for a while, and recently I've made substantial progress however I'm starting to feel more and more uneasy about my design as I start making example games/simulations using the library.

I have these 3 different concepts: SpatialEntity, SteerSubject, & Target (my Vector class implements Target).

Issues arise when I want to use one in place of another, since they're so similar (all have a position, 2 have a radius, one has velocity, direction & acceleration). For example I have a TargetClosest which given a SteerSubject will return the closest SpatialEntity. I have steering behaviors which take targets like this and determine whether to stay away from, steer to, steer around, hide from, etc. It returns a SpatialEntity (which SteerSubject implements BTW) because I didn't want to say all spatial entities (which can be added to spatial databases) have a velocity, acceleration, etc...

My options as I currently see it:
* Add a super interface to everything, it has: position, spatialGroups, spatialCollisionGroups, isStatic, isInert, direction, velocity, maximum velocity, acceleration, maximum acceleration. The defaults are 0 (or vectors at the origin), except position is required. This would mean 13 methods would be implemented, but in some cases (like Vector) it would only return one useful value. I think this is useful however, since maybe I want the unit to guard a Vector opposed to another unit, or the future position of a unit.
* Add a lightweight component system, so that the super interface has get[Float|Vector](SpatialProperty) where SpatialProperty is an enum and each implementation would instead have a switch statement on the enum which would be fairly fast.
* Add an interface for each concept, like Spatial{isStatic,isInert,spatialGroups,spatialCollisionGroups}, HasPosition{position}, HasVelocity{velocity, maximum velocity}, and HasAcceleration{acceleration,maximum acceleration}. This will result in some very verbose code in the library, I will have generics like <T extends HasPosition & HasVelocity> and I don't know whether that explicitness is a nice thing or not.

Another dilemma I'm working on is whether instead of having a radius, I can have a shape (which I have shapes implemented already: Segment, Plane, Bounds, Sphere). I liked radius initially because that keeps things super simple and fast. But I don't know whether someone would maybe wan't something else. Decisions...

If anyone could shed any light on this... I've had this exact same problem many times and I've always just picked one but I've always had bits of regret and I was hoping maybe someone can talk me into using one method or another so I don't have to make these decisions.
3  Game Development / Shared Code / Re: OpenGL font without textures on: 2014-01-20 00:53:43
When I use ':' or ';' inside a string it prints a symbol like '\\'. What can be the problem ?

That's very odd, can you show me an example of a String you're trying to print?
4  Discussions / General Discussions / Re: Did you ever cut corners to solve a problem? on: 2013-12-09 14:18:49
Nope, never.
5  Game Development / Game Mechanics / Re: plane intersection on: 2013-12-09 14:14:42

x^-1 = 1/x

More broadly:

x^-y = 1/(x^y)
6  Game Development / Newbie & Debugging Questions / Re: Printing whole exception. on: 2013-12-02 18:58:10
Your error occurs because you don't have the applet properly setup. It can't find the LWJGL JAR.


You're kinda wrong. What the problem is that first off all, file.getAbsolutePath() requires applet to be signed. I haven't signed the applet yet when this error was posted. Second, I can't load natives properly for some reason. Still working on it. The library is inside the game.jar file already.

The library being inside the game.jar doesn't mean anything.

Your exception:

Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException

Is very straightforward, it can't find that class.

You have more than one problem yes... but you also need to figure out how to bundle up a LWJGL application for an applet.
7  Games Center / Showcase / Re: Fetriz on: 2013-12-02 18:54:57
Am I missing something or is this just 4 tetris games at once basically? I watched the video and I did not get the Fez+Tetris impression at all.
8  Game Development / Game Play & Game Design / Re: Feeling aimless ... on: 2013-12-02 16:35:12
That's actually a pretty cool approach if your aim is to build a nice resume with things you have experience in. It enables you to get a broad knowledge of game programming and easily demo and show it off.
9  Game Development / Game Play & Game Design / Re: Feeling aimless ... on: 2013-12-02 13:49:09
I like to gather reasons why I want to make a game... and if those reasons aren't ones that are going to last... then you're going to not be successful.

You need motivation to keep your aim true... I use the idea of working for myself (hopefully making games) coupled with the fact that my wife is pregnant and I have a child I want to raise myself (which requires me to be self-employed working at home).

Find your aim fool!
10  Game Development / Newbie & Debugging Questions / Re: Java Applet problem | Security Exception on: 2013-12-02 13:41:52
Create a keystore using the keytool command:

Using the keystore created, you need to sign the JAR with the jarsigner command:
11  Game Development / Newbie & Debugging Questions / Re: Printing whole exception. on: 2013-12-02 13:37:40
Your error occurs because you don't have the applet properly setup. It can't find the LWJGL JAR.


12  Discussions / General Discussions / Re: Prepper and handler thread rendering. on: 2013-12-02 13:34:36
(If I understand this correctly) this is something I do for my current game I'm working on.

I have a thread that's responsible for building a ByteBuffer for a chunk. That thread is responsible for determining face visibility, how lighting affects the faces, etc. Once the ByteBuffer is ready to be loaded to the VBO it's put on a queue which the main rendering thread reads every iteration.

So essentially my code is organized like this.

Main Thread
1. Rebuild chunks? Place on queue for Build Thread
2. Any built chunks? Take ByteBuffer and update appropriate VBO

Build Thread
1. Wait for chunk to build
2. Build chunk to ByteBuffers
3. Place ByteBuffers on queue for Main Thread

This only works nicely because the building part is done in such a way that it doesn't modify any game state information... AND if a chunk is being built while it's modified the building process for that chunk is restarted. For every block I do a simple check to see whether the chunk has changed since I started (just a simple volatile boolean flag).
13  Discussions / General Discussions / Re: Bad Habits on: 2013-12-02 13:22:43
After you write some code that does something special/important, always think if it will be instantly understandable if you look at it in 6 months... if it's complicated then I say comment it.

I use good variable names so you don't need to comment, but often I find some variables aren't name-able and when your variable names are too long It's hard to read (I like some equations on a single line okay? The readability of the equation is sometimes more important than the variable names - since the variable names don't always represent real-world things. I hope that makes sense.)

When I use short variable names in complex algorithms and equations, I always comment my code.

Of course, this goes out the window if you REALLY think you'll code the entire project in a few months.
14  Game Development / Newbie & Debugging Questions / Re: How could you detect collision with a colour in Java? on: 2013-11-26 13:36:50
Since reading the pixels of the image would be pretty slow... I would write an algorithm that would determine all rectangles in that image and then do collision with those rectangles. It shouldn't be hard to write a greedy algorithm that iterates through all pixels... and when a black one is found it starts to grow that area in all directions until it hits a white pixel. Do this until all black pixels are taken.
15  Game Development / Newbie & Debugging Questions / Re: Back half of cube is being clipped (using geometry shader). on: 2013-11-25 15:39:06
That doesn't look like culling. How is it being rendered what type of polygon are you using.

That's why I said clipping =P

use vec3 for the position and just a mat3 for the roation matrix. I guess your problem is that the w component of the corners is 0

Holy moly! You're awesome =P I changed the w component of the corners to be 1.0 and not 0.0 and it worked! (derp they're points not normals)

Very odd, I wonder how having them be 0.0 would cause the backside to be clipped...

Anywho, thanks!
16  Game Development / Newbie & Debugging Questions / Re: Back half of cube is being clipped (using geometry shader). on: 2013-11-24 17:59:32
Here's a picture of what it looks like:

17  Game Development / Newbie & Debugging Questions / [solved] Back half of cube is being clipped (using geometry shader). on: 2013-11-24 16:49:16
I'm working on a geometry shader that takes points, color, rotation, scale and generates a 3d cube.

The code (including the GS, VS, and FS):

For some odd reason the back half of the rotating cubes are clipped... and they're not clipped on the back plane (which is at 100) because I can move them closer and further and the back is STILL clipped.

I'm fairly sure it has to do with my geometry shader, but after googling for hours I can't find anything =/

The only thing I suspect it could be would be gl_ClipDistance - something I could set to fix it? But there's no good information online...

18  Game Development / Game Mechanics / Re: Best rendering method using pure java? on: 2013-11-19 00:23:07
I started one, and uploaded it to Gist:

It's a software graphics library with blending, textures, and simple primitives.

Checkout to see what the drawing code is like.
19  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Concepts of a game engine/main loop on: 2013-11-18 20:00:22
I wrote a pretty extensive article on my blog,, check it out.
20  Java Game APIs & Engines / OpenGL Development / Re: Is it possible to support skeletal animations without shaders? on: 2013-11-16 22:00:38
I currently use the old method of:

glMultMatrix( boneMatrix );
// draw limb and all child limbs

Only works nicely for models where each vertex only belongs to a single bone...
21  Java Game APIs & Engines / OpenGL Development / Re: Why Can't I Find Bitmap Fonts? on: 2013-11-16 21:57:51
I made a pretty good Font Loader that creates bitmap fonts from True Type Font files, and the built in Java Fonts. It is part of my home-brew game engine, GenesisEngine, and you can find the related files here, and here. If you are interested.

I do a similar thing in my game engine, I use something else to get a little more detail for slightly nicer looking fonts (more detailed advance and what not):

Font font = ....
FontRenderContext context = new FontRenderContext( new AffineTransform(), true, true );
GlyphVector gv = font.createGlyphVector( context, new char[] { c } );
Rectangle2D visual = gv.getVisualBounds();
Rectangle2D logical = gv.getLogicalBounds();

if (logical.getWidth() > 0)
   Glyph g = new Glyph( new Tile(), (float)logical.getWidth(),
      (float)visual.getMinX(), (float)visual.getMinY(),
      (float)visual.getMaxX() + 1, (float)visual.getMaxY() + 1 );
   glyphs[c] = g;
22  Discussions / General Discussions / Re: HSA and Java on: 2013-11-16 21:36:21
I would say it means nothing at all to gaming.
23  Java Game APIs & Engines / OpenGL Development / Re: Not responding? on: 2013-11-16 15:35:12
In my game loop before updating&drawing I do this:

if (isHidden()) {

Where isHidden is defined as:

private boolean isHidden()
   if (Display.isVisible()) {
      return false;
   if (Display.isDirty()) {
      Color bg = getBackground();
      GL11.glClearColor(bg.r, bg.g, bg.b, bg.a);
   try {
   } catch (InterruptedException ie) {
      // ignore
   return true;

That might do it?
24  Discussions / General Discussions / Re: Thread Newbie: How do I use this "Insert Applet" feature in a post? on: 2013-11-16 14:40:14
25  Game Development / Shared Code / OpenGL font without textures on: 2013-11-15 19:14:31
Here's some code you can use to draw text in OpenGL (LWJGL in this case) given a position, character size, kerning scale, and the text!

Each character is a grid of points (3 columns, 5 rows) and a glyph is defined by lines from one point to another.

Here's what it looks like (1.0 pixel thickness, 12 pixels tall, 8 pixels wide):

And the code:
26  Game Development / Shared Code / Re: TrieHard - A Trie implementation! on: 2013-11-15 18:40:22
No problem!
27  Game Development / Networking & Multiplayer / Re: KryoNet Player Locations on: 2013-11-15 18:36:53
I do this for interpolation:

A simple Entity structure: { ping, lastUpdateTime, time, lastPosition, nextPosition, position }

When I get an update for an entity
long currentTime = System.nanoTime(); = (currentTime - user.lastUpdateTime) * 0.000000001f; // in seconds
user.lastUpdateTime = currentTime;
user.lastPosition.set( user.position );
user.nextPosition.set( UPDATE.newPosition );

Every update call (where dt is seconds since last update)
user.time += dt;
user.position = (user.nextPosition - user.lastPosition) * (user.time / + user.lastPosition;

This handles interpolation from previous position to new, and even extrapolation if time passes expected ping (you don't receive an UPDATE in ping seconds).

You can apply this logic to other things like direction and velocity if necessary.
28  Game Development / Networking & Multiplayer / Re: KryoNet Player Locations on: 2013-11-15 16:36:08
Are you using a game engine? Some come with IntMap which is far better than using Map<Integer, Entity>. I would use HashMap if you don't have access to something like an IntMap.
29  Game Development / Networking & Multiplayer / Re: KryoNet Player Locations on: 2013-11-15 16:29:37
You can do Map<Integer, Entity> map = ... and map.get(5) will work. map.remove(4) will also work.
30  Game Development / Networking & Multiplayer / Re: KryoNet Player Locations on: 2013-11-15 16:18:24
I don't use Kryonet, but I wouldn't use their ID stuff if I did.
Pages: [1] 2 3 ... 11
CopyableCougar4 (234 views)
2017-03-24 15:39:42

theagentd (216 views)
2017-03-24 15:32:08

Rule (275 views)
2017-03-19 12:43:22

Rule (259 views)
2017-03-19 12:42:17

Rule (263 views)
2017-03-19 12:36:21

theagentd (280 views)
2017-03-16 05:07:07

theagentd (278 views)
2017-03-15 22:37:06

theagentd (200 views)
2017-03-15 22:32:18

theagentd (194 views)
2017-03-15 22:31:11

ral0r2 (170 views)
2017-03-03 11:52:41
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 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!