Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (581)
Games in Android Showcase (162)
games submitted by our members
Games in WIP (632)
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 ... 14
1  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Crocodile3D - Create 3d models and environments with tiles. on: 2015-05-15 23:53:45
Reminds me of old school game modding tools like DEdit for Lithtech.



Except I feel like DEdit was easier to use than this. Never understood why more editors don't go for the four viewport look.
2  Discussions / General Discussions / Re: Looking for Beta Testers for Android Metronome App on: 2015-05-10 18:40:36
Ah OK. Right. Misunderstood what you meant by "bar subdivision." Thought it was just beats in a bar again.
3  Discussions / General Discussions / Re: Looking for Beta Testers for Android Metronome App on: 2015-05-09 10:05:31
Shouldn't the third control of the third menu be the "beat subdivision" rather than "bar subdivision?" The bar sub division is contained in the time signature, but you would normally have a beat subdivision that you would use to, for example, play triplets or quintuplets.
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LWJGL] Library for rendering text. on: 2015-05-05 12:54:33
The absolute easiest way is to have prebaked images with the text you want on them. Obviously that isn't the best since no dynamic text.

If you want dynamic text, the easiest way (and it is still pretty easy as long as you have some experience) is to have a texture with every single character on it. You just have to know where each character is and then you can specify texture coordinates such that you get the right character. Downsides to this are: you will probably end up drawing one character at a time, creating the texture with all the characters can be time consuming unless you write a program to do it for you (which I would suggest, again not too difficult) and you need a new texture for each font you want to use.
5  Game Development / Newbie & Debugging Questions / Re: Make a camera with changeable size on: 2015-05-05 12:48:16
So many +1 to @KevinWorkman.

But to answer your question, it depends on the type of camera you are talking about. If you are talking first person then no. But I presume you aren't talking that. If it's 2D platformer or in fact anything 2D then yes.

However will not be efficient. I've never worked with Java2D for games but I would guess you would have to mess around with he transform associated with the Graphics object. Someone who knows what they're talking about can confirm or not that.
6  Game Development / Newbie & Debugging Questions / Re: Issue with path movement/speed on: 2015-04-30 09:47:11
A problem you will often get with stuff like this

Quote
if(entity.getX() == path.getPath().get(entity.getPathIndex()).getX() && entity.getY() == path.getPath().get(entity.getPathIndex()).getY()){

is that due to floating point inaccuracy, two values can be not quite equal but instead 1E-20 off. Which can cause unexpected issues. Try instead of using the equality comparator, using a method like this:

1  
2  
3  
public static boolean equalsTolerance(float f, float g) {
    return Maths.abs(f - g) < TOLERANCE;
}


Where TOLERANCE is some very small constant. Probably try it out somewhere in the order 1E-5 to start with.
7  Game Development / Newbie & Debugging Questions / Re: LWJGL 2D Point lighting on: 2015-04-26 18:18:41
OK so here's a really simple example of lighting using a single white point light using a square attenuation model.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec2 out_TextureCoords;
out vec2 out_WorldPos; //The untransformed position

uniform mat4 projectionMatrix;
uniform mat4 transformationMatrix;
uniform mat4 viewMatrix;

void main(void){
   out_TextureCoords = vec2(textureCoords.x,textureCoords.y);

   vec4 worldView = viewMatrix * transformationMatrix * vec4(position,1.0);
   
   out_WorldPos = position.xy;
   gl_Position = projectionMatrix * worldView;
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
#version 400 core
#define ATTENUATION_COEFFICIENT 0.1 //fine tune to get it how you want it

in vec2 out_TextureCoords;
in vec2 out_WorldPos; //The untransformed position

out vec4 out_Colour;

uniform sampler2D texture0;
uniform vec3 light; //x, y refer to position. z refers to intensity.

void main(void){
   float d = length(light.xy -  out_WorldPos);
   float a = light.z / (d * d * ATTENUATION_COEFFICIENT);
   out_Colour = a * texture(texture0, out_TextureCoords);

}


I HAVE NOT TESTED THIS CODE. It should give you an idea of how to go about this even if it doesn't work.
8  Game Development / Newbie & Debugging Questions / Re: LWJGL/OpenGL 3.3+ Voxel Chunk Management on: 2015-04-03 15:11:02
So surely just:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
public class Chunk {

   private static final int CHUNK_SIZE = 64;
   private static final int CHUNK_HEIGHT = 128;

   public static void create(int chunkX, int chunkZ) {
      float xOffset = CHUNK_SIZE * chunkX;
      float zOffset = CHUNK_SIZE * chunkZ;
      for (int x = 0; x < CHUNK_SIZE; x++) {
         for (int y = 0; y < CHUNK_HEIGHT; y++) {
            for (int z = 0; z < CHUNK_SIZE; z++) {
               if (y < 16) {
                  if (StartClient.rand.nextInt(2) == 0) {
                     if (StartClient.rand.nextBoolean()) {
                        StartClient.allCubes.add(new Entity(
                              Blocks.cubeStone,
                              new Vector3f(x + xOffset, y, z + zOffset ), 0f, 0f, 0f, 1f));
                     }
                     if (StartClient.rand.nextInt(2) == 0) {
                        StartClient.allCubes.add(new Entity(
                              Blocks.cubeSand, new Vector3f(x + xOffset, y, z + zOffset),
                              0f, 0f, 0f, 1f));
                     }
                  }
               }
            }
         }
      }
   }
}


And also by the looks of it, your code will generate stone blocks and sand blocks in the same location.
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How to check if Object is in certain part of camera? on: 2015-03-30 13:26:35
Yes, I did mean for the full stop "." to denote the vector dot product (aka scalar product). Sorry for all the confusion, I normally define that. And fyi, I don't use "*" so as not to confuse with the cross product (aka vector product).

As for how to get the left vector, I thought you would already have that to do the frustum test. Essentially you can take it directly from the rotation matrix of the camera. That is the matrix that defines the rotation. Not the viewing matrix (which includes translation) not the projection matrix. Just the rotation matrix.

A1 A2 A3 A4
B1 B2 B3 B4
C1 C2 C3 C4
D1 D2 D3 D4


Then the left vector is just (A1, A2, A3) although if you're using a right handed coordinate system this is the right vector. If you're interested, (B1, B2, B3) is the "up" vector and (C1, C2, C3) is the "forward" vector.

Sorry again for all the confusion.
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How to check if Object is in certain part of camera? on: 2015-03-28 23:27:39
So if the "Object" is at position A, the camera is at position C, and the camera's left direction is the vector L then:

if (A - C) . L > 0 the object is to the left

if (A - C) . L < 0 the object is to the right

if (A - C) . L = 0 the object is dead in the centre.
11  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java Model Importer - Design Discussion on: 2015-03-15 13:10:20
Sounds plausible. It is a proprietary format after all. But apparently Blender has written their own importer, and have been nice enough to write up some unofficial specs: http://code.blender.org/index.php/2013/08/fbx-binary-file-format-specification/ and http://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure. Which might be of some help.
12  Game Development / Newbie & Debugging Questions / Re: Model Wrapper Class Improvements on: 2015-03-15 12:54:54
Premature optimization is the root of all evil. If your game is running too slowly and your analysis shows that the garbage collector is causing it to be slow then you are creating too many objects. Otherwise don't worry about it.
13  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java Model Importer - Design Discussion on: 2015-03-14 14:22:55
So you are right. But the maths really isn't that complicated. If I were you I'd take a look at the COLLADA specs. https://www.khronos.org/files/collada_spec_1_4.pdf. They really are so useful. Chapter 4 is a programming guide and it has a section called "Skinning a Skeleton in COLLADA." Which should explain everything you need to know about skeletal animation. The implementation can be a bit difficult but there are other posts here to help with that.

As for your clusters, I have no idea what they are.
14  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-10 15:16:12
kepler

Yes but I wanted to show where it comes from. But also, yes Kepler will give you a more complete view of orbits.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-10 08:53:57
...
Your third system would fall apart very quickly , the outer planet is moving faster than the inner ones , if that is the required orbit velocity at that radius then the other two will fall into the star , if it is moving too quickly it will fly off into space. Still very cool effects , would be great to see where these space projects go.

I agree. And it can be proven mathematically. If you equate the gravitational force with the centripetal force:

F = G*m*M / (r^2) = m*(v^2) / r

Where G is the gravitational constant, m is the mass of the satellite, M is the mass of the sun, r is the radius of the orbit and v is the tangential velocity of the satellite.

Cancelling 'm's and 'r's.

G*M / r = v^2

Since G and M are constant, the speed is inversely proportional to the square root of the radius. The greater the radius, the smaller the velocity.

You can use v = w*r to find the angular velocity.

G*M / r = (w*r)^2

G*M / (r^3) = w^2

Hence the angular velocity is inversely proportional to the radius to the power 3 / 2.

It seems like you've gone to a lot of effort to make the star types and positions, it'd be a shame if your orbits weren't right.

 
16  Java Game APIs & Engines / OpenGL Development / Re: Using Slick2D's Image.getGraphics crashes on some machines on: 2015-03-02 19:11:48
Post the exception/error message as well as the stack trace.
17  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java Model Importer - Design Discussion on: 2015-03-02 19:10:32
So I have done something like this before for a few formats. Essentially I just built everything around the way COLLADA structures  it's data. It's an extremely comprehensive format that covers everything and it's designed by lots of collaborators (the Khronos ARB) so it's quite a good average of all the stuff out there.

Also it'll probably be the most complex format you will support so better that you bend everything else to fit it than vice versa.
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-28 10:10:59
Having started a module on control theory, I cannot see anything like that without thinking about transfer functions and feedback loops. Looks good.
19  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-02-20 21:33:03
Additionally angles are usefully avoidable in the first place.

Yes. Vectors, matrices, quaternions are all better than angles in every respect. Certainly for a computer. As with most complex things in maths, learning about them is the hard part but once you have, then they make things so much more simple and general case.

And "degrees" is more natural is mostly myth.  That's only true for very large angles.

I disagree. Certainly most people would be fine with pi/3, pi/2, pi etc. but once you go to more complex multiples than that then you have to think about it to figure out how big the angle actually is. Or at least I do. And I am studying engineering which is practically maths. I wouldn't be surprised if they dropped you marks if you tried to solve a problem in degrees instead of radians.
20  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-02-20 09:19:23
The idea of degrees is that it takes the sun exactly 360 days to travel around the earth.  And that's exactly how useful they are.

And it doesn't even do that.

But degrees have a use in that they are what people know about. They are what people learn about and hence what most of us think about intuitively with angles. So why not have a degrees to radians method so that people can use their intuitive knowledge in, for example, initial conditions. Yes you should discourage people from using degrees but you shouldn't prevent them entirely.
21  Game Development / Game Mechanics / Re: Calculate Derivatives for Newton's Method on: 2015-02-16 09:21:36
So the first thing to understand about the Newton-Raphson method is that is is an iterative process. You take the answer from the last iteration (xn), stick it into the next iteration (xn-1). Now as you keenly noticed, this requires an initial starting point. The way to get this is to guess an answer, for a human quite simple, for a computer I don't know of any methods of guessing an answer. If you choose well and your guess is near to a root then the solution will converge quickly (in fewer iterations) if you guess poorly then it will take longer. Also, if the function has multiple roots, then the starting point will affect which root is converged upon.

Now calculating derivatives. A derivative is actually defined as:



Now computationally, since we are just using approximations anyway, why not approximate the derivative by using a value of h close to 0. Like 1E-10 for example. That's very simple for a computer to do. (And although I've never heard of it before, I thought secant was a trig function, it seems like this is what they mean by the secant method although they apply it to second derivatives)
22  Game Development / Game Mechanics / Re: questions on opengl, lwjgl(slick util) on: 2015-02-08 22:15:36
1) Depends on impl a bit and what generation you are working with and stuff. In general not the most expensive method but not to be abused either. If you can easily cut down on texture binds then great, if not then lets remember about how sick and evil premature optimization is.

2) No.

3) Don't know the actual implementation in Slick (the method doc should really say) but I would guess yes - it releases the OpenGL texture object.

4)  Releases all textures, buffers, shaders etc. and the whole OpenGL context.

5) Premature optimization again but if Slick has some kind of "Source" class, then I would expect that also has a "release()" method.

6) A PNG is a compressed image file format. When you load a texture, it is stored in a non compressed format so it can be accessed quickly. How much space it takes up depends on the format you store it in. A typical RGBA format is 4 floats per pixel so will take up (roughly) 4 * 4 = 16 bytes per pixel. You will know when you're video card is stressed when the program starts lagging. Premature optimization.

7) I know of no conventional way. Your enum method sounded good. But do what is easier and what works. Premature optimization.
23  Discussions / Miscellaneous Topics / Re: The joys of game dev in C++ on: 2015-02-02 11:39:55
...
Yes, it crashes lol.

Well to be more specific, it throws an Exception. The exception can be caught to avoid a crash. That is a quite significant difference to c++ null pointers being dereferenced. In practise though it makes no difference (although I think Java's handling of exceptions makes an NPE easier to debug) since we rarely catch NPEs but rather check to see if a variable is null before dereferencing as you would in c++.

But we are good programmers so let's be precise.
24  Discussions / Miscellaneous Topics / Re: Java Certificates on: 2015-01-31 18:23:45
So what value do these certificates have?

As much as you paid for them. I have never seen anyone put any value into certification as far as job prospects are concerned. And neither would I.
25  Java Game APIs & Engines / OpenGL Development / Re: Applying transformations to vertices on: 2015-01-29 11:13:49
Not in the same FloatBuffer object but you should stick it in a ByteBuffer.

So your "creating the buffer" code will look like this.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
private ByteBuffer createInterleavedArray() {
    ByteBuffer bb = BuferUtils.createByteBuffer(m_vertices.length * 52);
    for(int j = 0; j < m_vertices.length; j++) {
         bb.putFloat(m_vertices[j].m_position.m_x);
         bb.putFloat(m_vertices[j].m_position.m_y);
         bb.putFloat(m_vertices[j].m_position.m_z);
         bb.putFloat(m_vertices[j].m_normal.m_x);
         bb.putFloat(m_vertices[j].m_normal.m_y);
         bb.putFloat(m_vertices[j].m_normal.m_z);
         bb.putFloat(m_vertices[j].m_uv.m_x);
         bb.putFloat(m_vertices[j].m_uv.m_y);
         bb.put(m_vertices[j].m_influences[0].m_bone_index);
         bb.put(m_vertices[j].m_influences[1].m_bone_index);
         bb.put(m_vertices[j].m_influences[2].m_bone_index);
         bb.put(m_vertices[j].m_influences[3].m_bone_index);
         bb.putFloat(m_vertices[j].m_influences[0].m_bone_weight);
         bb.putFloat(m_vertices[j].m_influences[1].m_bone_weight);
         bb.putFloat(m_vertices[j].m_influences[2].m_bone_weight);
         bb.putFloat(m_vertices[j].m_influences[3].m_bone_weight);
    }
    bb.flip();//Or whatever
    return bb;
}


and then setting up your pointers.

1  
2  
3  
4  
5  
glVertexAttribPointer(vert_pos, 3, GL_FLOAT, false, 52, 0); //3 * 4 = 12 bytes
glVertexAttribPointer(color, 3, GL_FLOAT, false, 52, 12); //3 * 4 = 12 bytes
glVertexAttribPointer(tex_coord, 2, GL_FLOAT, false, 52, 24); //2 * 4 = 8 bytes
glVertexAttribPointer(joint_indices, 4, GL_BYTE, false, 52, 32); //4 * 1 = 4 bytes
glVertexAttribPointer(joint_weights, 4, GL_FLOAT, false, 52, 36); //4 * 4 = 16 bytes


So you see ByteBuffers are great because you can mix and match data however you want.
26  Java Game APIs & Engines / OpenGL Development / Re: Applying transformations to vertices on: 2015-01-28 15:12:56
The one thing I could see was these two lines:

1  
2  
gl.glVertexAttribPointer(joint_indices, 4, GL.GL_BYTE, false, Buffers.SIZEOF_FLOAT * Vertex.SIZE, Buffers.SIZEOF_FLOAT * 8);//32
gl.glVertexAttribPointer(joint_weights, 4, GL.GL_FLOAT, false, Buffers.SIZEOF_FLOAT * Vertex.SIZE, Buffers.SIZEOF_FLOAT * 12);//48


So when you create the buffer, you specify the joint indices as a float each. But then you interpret the indices as a byte in your pointer. That can't be good.

Also a byte is obviously one byte long and you have 4 of them for the indices. However you have the offset of joint_weights (and I would guess the stride as well) set as if the they were 4 floats (for 16 bytes).

But to be honest I would have thought that these issues would have caused more problems. But correct them and we'll see what happens.
27  Game Development / Newbie & Debugging Questions / Re: Trouble Implementing Simple Projectile into Slick2D on: 2015-01-27 18:10:16
And is this not working?

You need to tell us what is going wrong.
28  Game Development / Newbie & Debugging Questions / Re: Texture always facing the camera on: 2015-01-18 17:39:59
This is called billboarding. And there are essentially two methods or doing it.
1) Don't use the camera rotation as part of the view transform when you are billboarding. The translation part yes but not the rotation method.

2) You can create the geometry you're rendering using the camera's left and up axis for the geometry's left and up axes. Example:
To render a quad of width "w" and height "h" at position "P" with a camera left axis "L" and up axis "U", then the 4 points of the quad would be:
P,
P + w*L,
P + w*L + h*U,
p + h*U

For more help, ask a more specific question and give some information about your current setup.
29  Game Development / Game Mechanics / Re: Translate Point By Pitch/Roll on: 2015-01-14 22:49:57
Also, this must be without any matrices or quaternions.

Why are you trying to make things difficult for yourself? If there is a good reason I will be happy to help you out but I cannot imagine a situation where using matrices wouldn't make this task a whole lot easier.

Seriously, try and imagine rotating a vector about the y axis, the about the x axis and finally about the z axis? Confused yet? No, try drawing down a diagram for each stage with a nice little right angled triangle so you can work out the trigonometry. I say these things because I have tried and it is not worth the effort.
30  Game Development / Newbie & Debugging Questions / Re: Up Vector calculation for matrices on: 2015-01-14 17:27:40
Only normalize a vector when the length isn't one. That should fix this issue.
The issue is that when you cross two parallel vectors, you get a zero magnitude vector so if the forward vector is (0, 1, 0) or (0, -1, 0). Then you normalize a zero vector (giving NaN) or cross it to get another vector (giving another zero vector).

...
Setting the direction to a vector of (0.1, -1.0, 0.0) or (0.0, -1.0, 0.001) seems to work perfectly.

It'll work until you have a forward vector of (0.1, -1, 0) or (0, -1, 0.001). If you are in a situation where your forward vector might be pointing straight up, better to do a check to make sure it doesn't. One conditional is not going to be noticed.
Pages: [1] 2 3 ... 14
 
MrMapcom (9 views)
2015-05-23 20:26:16

MrMapcom (8 views)
2015-05-23 20:23:34

Waterwolf (28 views)
2015-05-20 15:01:45

chrislo27 (34 views)
2015-05-20 03:42:21

BurntPizza (69 views)
2015-05-10 15:53:18

FrozenShade (55 views)
2015-05-07 09:11:21

TheLopais (216 views)
2015-05-06 13:36:48

TheLopais (200 views)
2015-05-06 13:35:14

TheLopais (206 views)
2015-05-06 13:33:39

TheLopais (226 views)
2015-05-06 13:32:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00
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!