Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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 / 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.
2  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?
3  Discussions / General Discussions / Re: Did you ever cut corners to solve a problem? on: 2013-12-09 14:18:49
Nope, never.
4  Game Development / Game Mechanics / Re: plane intersection on: 2013-12-09 14:14:42
FYI:

x^-1 = 1/x

More broadly:

x^-y = 1/(x^y)
5  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.

Checkout http://www.lwjgl.org/wiki/index.php?title=Deploying_with_the_LWJGL_Applet_Loader_-_Introduction



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:

1  
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.
6  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.
7  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.
8  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!
9  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:

http://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html

Using the keystore created, you need to sign the JAR with the jarsigner command:

http://docs.oracle.com/javase/tutorial/deployment/jar/signing.html
10  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.

Checkout http://www.lwjgl.org/wiki/index.php?title=Deploying_with_the_LWJGL_Applet_Loader_-_Introduction

11  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).
12  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.
13  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.
14  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!
15  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:

16  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):

https://gist.github.com/ClickerMonkey/7605059

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...

Thanks!
17  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:

https://gist.github.com/ClickerMonkey/7534326

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

Checkout https://gist.github.com/ClickerMonkey/7534326/raw/7a472d6541a9be059eba3735a7e6e19e7264e5e1/Test.java to see what the drawing code is like.
18  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, http://www.gameprogblog.com, check it out.
19  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:

1  
2  
3  
4  
glPushMatrix();
glMultMatrix( boneMatrix );
// draw limb and all child limbs
glPopMatrix();


Only works nicely for models where each vertex only belongs to a single bone...
20  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):

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
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;
}
21  Discussions / General Discussions / Re: HSA and Java on: 2013-11-16 21:36:21
I would say it means nothing at all to gaming.
22  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:

1  
2  
3  
if (isHidden()) {
   continue;
}


Where isHidden is defined as:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
private boolean isHidden()
{
   if (Display.isVisible()) {
      return false;
   }
   if (Display.isDirty()) {
      Color bg = getBackground();
      GL11.glClearColor(bg.r, bg.g, bg.b, bg.a);
      triggerDraw();
   }
   try {
      Thread.sleep(100);
   } catch (InterruptedException ie) {
      // ignore
  }
   return true;
}


That might do it?
23  Discussions / General Discussions / Re: Thread Newbie: How do I use this "Insert Applet" feature in a post? on: 2013-11-16 14:40:14
KILL IT WITH FIRE!
24  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:

http://pastebin.com/urD2QYpH
25  Game Development / Shared Code / Re: TrieHard - A Trie implementation! on: 2013-11-15 18:40:22
No problem!
26  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
1  
2  
3  
4  
5  
long currentTime = System.nanoTime();
user.ping = (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)
1  
2  
user.time += dt;
user.position = (user.nextPosition - user.lastPosition) * (user.time / user.ping) + 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.
27  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.
28  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.
29  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.
30  Game Development / Networking & Multiplayer / Re: KryoNet Player Locations on: 2013-11-15 16:08:41
Here's my ID generation/sync process:

1. Client generates a LOCAL ID when an entity (like a bullet or grenade or something)  is created and sends to server.
2. Server generates a REMOTE ID which is unique to the server (the server can do nextId++ or something) and the server sends a message to the client "your LOCAL ID should be changed to REMOTE ID so we're in sync"
3. Client only sends information now with REMOTE ID given by server
Pages: [1] 2 3 ... 11
 

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

The first screenshot will be displayed as a thumbnail.

atombrot (25 views)
2014-08-19 09:29:53

Tekkerue (24 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (13 views)
2014-08-16 06:20:21

Tekkerue (20 views)
2014-08-16 06:12:11

Rayexar (58 views)
2014-08-11 02:49:23

BurntPizza (38 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
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
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!