Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (499)
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]
1  Game Development / Newbie & Debugging Questions / Strange issue with recursion? on: 2013-12-28 22:26:07
So essentially, the following snippet of code loops endlessly.

1  
2  
3  
4  
5  
      while (parent != null) {
         System.out.println(parent);
         offset.add(offsetFromParentWithRotation());
         parent = parent.getParent();
      }


Why is that?  Am I not allowed to set the parent like that, or am I missing something very obvious?
2  Game Development / Newbie & Debugging Questions / Re: OOP Noob - Extending Classes, or How Else to Create Unique NPCs? on: 2013-11-16 15:13:03
This may be a bit advanced or a jump to get into, but a component-system based approach is quite efficient, from my own experience.  Essentially, each entity is simply an ID that's assigned predefined component classes - like health, or damage, or movement - that another class, a system or handler, takes into account to make the entity do what you want it to.

The one I like currently is the Artemis Entity System.  http://gamadu.com/artemis/
3  Game Development / Game Play & Game Design / Re: Creating a circular "grid" ? on: 2013-11-16 02:28:32
Abuse has the right idea, and philfrei goes a little more in depth.
4  Game Development / Game Play & Game Design / Re: Creating a circular "grid" ? on: 2013-11-11 17:17:46
I would do it that way, were it not for that you're supposed to be viewing these at all angles - the "up" can be in any direction along this single plane.  But since it's like that, it's supposed to look like everything is going towards the center - if I were to use a square grid in this case, if you were looking at it at a 45 degree angle, everything would be diagonal.
5  Game Development / Game Play & Game Design / Creating a circular "grid" ? on: 2013-11-11 16:55:33
My quest is to essentially create different-sized rings, centered around the same point, that are made of 1-unit pieces.

My problems are that I have difficulty understanding the math required to create such.  I know how to create rings that are made of differing SIZED pieces, like 360 degrees = 360 pieces per ring, but the pieces get progressively larger as you go away from the origin point.  I don't want that - I want the pieces to stay the same size, instead creating more as you go outward.

I was hoping someone would help me figure out how to fix up my code in order to do this.


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
      float radians = (float) Math.toRadians(degrees);
     
      float[] data = new float[] {};
     
      float circ = MathUtil.getCircumference(depth); // Get the circumference at the chosen depth
     float circt = MathUtil.fastfloor(circ); // Round the circumference
     
      for (int c = 0; c < circt; c++) { // For every 1 "unit" do
        float rads = (float) c / circt; // Dividing the count by the circumference gives us the radian measure for each block
       
      }


That was as far as I had gotten before this made itself clear to my mind.
6  Game Development / Newbie & Debugging Questions / Re: Using LWJGL color API? on: 2013-07-13 05:45:16
Adding this snippet of code to ask:  Am I going about this the correct way?  I need 4 floats (one representing each of r, g, b, a) and they're supposed to be values between 0 and 1.  I'm trying to convert from a hexadecimal integer (eg 0xFFFFFFFF) to the four floats.

1  
2  
3  
4  
5  
6  
7  
8  
   protected float[] getRGBA(int color) {
      return new float[] {
            (color & 0xFF) / 255f,
            (color >> 8 & 0xFF) / 255f,
            (color >> 16 & 0xFF) / 255f,
            (color >> 24 & 0xFF) / 255f
      };
   }


Am I thinking about this the right way?
7  Game Development / Newbie & Debugging Questions / Re: Face culling on voxels. on: 2013-07-13 03:26:48
Ahh, that's actually what I was busy doing.  I eventually figured out the whole access issue, although I'm not sure the method that I went about is correct.

By the way, there is no World class;  each voxel group effectively needs to know about all the voxels it contains.  So i suppose there are many World classes in that respect; the basic group and all of the ones that extend it (so they can behave differently - ie a turret of a ship needs to rotate differently than the ship itself.)  To that end, this is what I've come up with:

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  
   public void updateVBO() {
      int numfaces = 0;
      boolean front = false, back = false, left = false, right = false, top = false, bottom = false;
      for (int x = 0; x < width; x++) {
         for (int y = 0; y < height; y++) {
            for (int z = 0; z < length; z++) {

               if (isOOB(x+1, y, z) || !isOCC(x+1, y, z)) {right = true; numfaces++;}
               if (isOOB(x-1, y, z) || !isOCC(x-1, y, z)) {left = true; numfaces++;}
               if (isOOB(x, y+1, z) || !isOCC(x, y+1, z)) {top = true; numfaces++;}
               if (isOOB(x, y-1, z) || !isOCC(x, y-1, z)) {bottom = true; numfaces++;}
               if (isOOB(x, y, z+1) || !isOCC(x, y, z+1)) {right = true; numfaces++;}
               if (isOOB(x, y, z-1) || !isOCC(x, y, z-1)) {left = true; numfaces++;}

               voxelData(x, y, z, voxels[x][y][z].type, numfaces, front, back, left, right, top, bottom);

            }
         }
      }
   }

   protected boolean isOOB(int x, int y, int z) {
      if (x * y * z > width * height * length || x * y * z < 0) return true;
      return false;
   }
   protected boolean isOCC(int x, int y, int z) {
      if (!isOOB(x, y, z)) if (voxels[x][y][z].opaque) return true;
      return false;
   }


Also, I've refrained from putting data into the actual floatbuffer for now because I don't want the buffer being too big.  That being said, compacting it would work to remove the extra space, right?
8  Game Development / Newbie & Debugging Questions / Re: Using LWJGL color API? on: 2013-07-13 01:19:41
So would I only need 1 color "vertex" when interleaving color with position in my FloatBuffer?  From what it looks like, that seems to be the case.
9  Game Development / Newbie & Debugging Questions / Face culling on voxels. on: 2013-07-12 21:56:41
I have a segment of code here that's supposed to cull faces of voxels that should be invisible.

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  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
   private FloatBuffer voxelData(int x, int y, int z) {
      float r = rand.nextFloat(), g = rand.nextFloat(), b = rand.nextFloat();
      float xscale = x * scale, yscale = y * scale, zscale = z * scale;
      int numfaces = 6;

      boolean top = true, bottom = false, left = true, right = true, front = true, back = true;
      if (x != width--  && voxels[x + 1][y][z].isActive) {right = false; numfaces--;}
      if (x != 0         && voxels[x - 1][y][z].isActive) {left = false; numfaces--;}
      if (y != height-- && voxels[x][y + 1][z].isActive) {top = false; numfaces--;}
      if (y != 0         && voxels[x][y - 1][z].isActive) {bottom = false; numfaces--;}
      if (z != length-- && voxels[x][y][z + 1].isActive) {front = false; numfaces--;}
      if (z != 0         && voxels[x][y][z - 1].isActive) {back = false; numfaces--;}

      if (numfaces == 0) return null;

      FloatBuffer data = BufferUtils.createFloatBuffer(numfaces * 24);

      if (top) { data.put(new float[] {
            this.x + xscale + 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
      });}

      if (bottom) { data.put(new float[] {
            this.x + xscale - 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
      });}

      if (left) { data.put(new float[] {
            this.x + xscale - 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
      });}

      if (right) { data.put(new float[] {
            this.x + xscale + 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
      });}

      if (front) { data.put(new float[] {
            this.x + xscale + 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale + 0.5f * scale,   r, g, b,
      });}

      if (back) { data.put(new float[] {
            this.x + xscale + 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale - 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale - 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
            this.x + xscale + 0.5f * scale,      this.y + yscale + 0.5f * scale,      this.z + zscale - 0.5f * scale,   r, g, b,
      });}

      data.flip();
      return data;
   }

The segment is passed the x, y, and z values through a triple-nested for-loop checking each voxel in a 3d array.  However, the code seems to only output left and back sides; never any others.  Even then, it's only the left-bottom-back corner that renders, and not even the bottom face; just the back, and three left faces from the edge, and a face one above that.
Here's a screenshot:  
10  Game Development / Newbie & Debugging Questions / Re: About lists and the elements inside of them. on: 2013-07-12 16:45:13
That's actually a very good tip.  However, isn't it sort of misleading when you're going through the interfaces for each component type rather than the actual object itself?

Also, I've abandoned that method of components for now and instead have a basic VoxelGroup class that has an enum of GroupTypes to determine how it should behave (Another class entirely).  The list of voxels from before is non-existant

With that in mind, would your interface method still work properly?  Or should I change my architecture slightly to accomodate?

And the idea of an abstract base class; would that replace the VoxelGroup class, and then I would create multiple classes for different types of groups, all of which would use an interface for commonly needed methods - that about sum it up?
11  Game Development / Newbie & Debugging Questions / Re: Using LWJGL color API? on: 2013-07-12 05:26:24
Indeed, the bytes thing is a good idea.  Could anyone give me a small example of how to convert bytes to a color, though?  It'd be very, very helpful indeed.
12  Game Development / Game Play & Game Design / Re: Intuitive Interface Design on: 2013-07-12 04:15:14
I like design B more.  It positions all the data that the player (Probably) cares about closer together.  The recent screenshot looks really nice, actually.  Oskuro's suggestion is a very good one too.

Perhaps there should be a way to assign hotkeys?  Those are always nice to have.

Also, a purely aesthetic idea, perhaps make it so that the player can change the GUI color?  Grayscale images + color interpretation?
13  Game Development / Game Play & Game Design / Re: Data structure for voxels? on: 2013-07-12 00:52:44
Would I not have to loop through with an array for collisions, then?  If you could explain a little more how a 3d (or even 1d) array wouldn't require looping for collisions, that'd make it a bit easier for me to wrap my head around.

Also, for the if statement, do you mean checking each index in the array like this, sorta?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
...
for (int x = 0; x < width; x++ {
     for (int y = 0; y < height; y++) {
          for (int z = 0; z < depth; z++) {
               if (voxels[x][y][z] != null) {
                    // mesh update code
              }
          }
     }
}
...


As it stands, that's what I'm using to create the VBO for the object.

While I'm typing this, another question:  how would I go about applying rotations to each object individually?  I know glRotate and glTranslate would work for the entire world or a single object, but I need to be able to move / rotate individual voxel groups, as well as individual voxels within a group.  If I wanted rotating / moving voxels within the group, it seems inefficient to have to go through and re-work the entire mesh of the thing.  So by that logic, I'm assuming I'd need to have the object have multiple groups of voxels?

Again, just brainstorming, putting it out there for any constructive folk who happen along.

EDIT:  On the subject of "subgroups", perhaps have an enum of what types of subgroups there are?

Also, things like:  Would the gun on a turret need to know about what's going on in the casing it's attached to, AND the main body of a ship?  Or would it just need to know the turret only, since the turret would already compensate for knowing the main body?  Is that kind of "inheritance" going to cause issues?  If so, is there another method around this?  (I'm thinking mainly rotation along this path; the main hull would have its rotation, the turret casing would have its rotation relevant to the hull, and the weapons on the turret would have its rotation relevant to the casing, which is relevant to the hull.)

And on the same topic, what about collisions within the same structure?  What if the turret gun knows about the casing, but not about the main ship?  It would collide / be restricted to the casing, but how would it know to collide with or interact with the main hull?  Is it possible to create a system that does all the collision checking and (possibly) queuing for them?  How would it work?  Raycasting?  Or perhaps another method.
14  Game Development / Game Play & Game Design / Re: Data structure for voxels? on: 2013-07-12 00:20:07
But that array again is larger than what's necessary.  Maybe the memory isn't a big issue, but the extra space still has to be looped through.  Wouldn't that affect the cpu load required rather significantly?
15  Game Development / Game Play & Game Design / Data structure for voxels? on: 2013-07-11 22:52:01
Well, I've thought about this for quite some time now, and I've come to hit what I believe is a roadblock.  If you're really going to help me, prepare for a bit of a read since I tend to over-explain things.

See, each of my voxels currently stores its own position values in 3 integers: x, y, z.  I understand that this is very inefficient in most cases, but more on that in a second.  Within my current structure, the voxels are assigned into groups that don't have a fixed count to them, nor a fixed position; they need to be dynamic as the player will be interacting with them, and also each group needs to be able to do things on its own - move, rotate, etc.  When I got to the point of storing the data, I had two separate ideas, which are below.  I'm doing the second option currently.

1  
2  
3  
4  
5  
// first option
private Voxel[][][] group_voxels = new Voxel[w][h][l];

// second option?
private List<Voxel> voxels = new ArrayList<Voxel>();


Now, the question comes down to efficiency of storage and data, as well as perhaps processing and rendering speed - though I'm not 100 percent certain about that last one.

For the first option, the pros are that I can infer the integer positions for each voxel through the index it's at in the 3d array.  However, doing this also creates a lot of wasted space, since odds are the entire group of voxels will never be filled (Giant cube structures aren't going to be very common).  For example, if I have a tree that's 48 voxels tall, 25 voxels wide, and 25 voxels in depth overall, the empty space (like around the trunk) is sitting there and taking up memory (I think?) where it could be better spent on other things.  It also introduces a bit of unneccessary checking when looping through, since it needs to check those empty spaces as well as the far more important occupied spaces.

For the second option, the plus is that there shouldn't ever be wasted space inside of the list, since only enough voxels are assigned at any point to the list to create their object; the wasted space around the tree trunk would disappear since the list never even bothers about that spot.  In addition, I believe that there would be a boost in general speed since when iterating through the list, it again never bothers to check what isn't there.  However, with this method, I can't come up with any way to infer the position of the voxels through usage of indices; the list doesn't know anything about the width or length or height, it just stores the voxels.  This leads me to using the 3-integer method described as above.

My question is, which is more efficient?  I'm not that experienced with serious programming structure and the sort, usually I just throw it together without a care for the efficiency, so I'd like a few opinions as well as maybe some tips and tricks if anyone's willing to share.

Also, if you actually read all of that, thanks for sticking with it.  I can really be a little too wordy at times.
16  Game Development / Newbie & Debugging Questions / Camera rotation around a central pivot point? on: 2013-07-10 23:23:18
I'm trying to use vector math to rotate the view around a central pivot point, which may move around.  This is the code that I have so far:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
   public void followObject(Object target) {
      if (target instanceof Voxel) {
         Vector3f tpos = new Vector3f(((Voxel)target).x, ((Voxel)target).y, ((Voxel)target).z);
         pitch = Vector3f.angle(new Vector3f(1, 0, 0), tpos);
         yaw = Vector3f.angle(new Vector3f(0, 1, 0), tpos);
         roll = Vector3f.angle(new Vector3f(0, 0, 1), tpos);
         this.setPosition(tpos.x + (pitch * 10.0f * zoom), tpos.y + (yaw * 10.0f * zoom), tpos.z +(roll * 10.0f * zoom));
         GLU.gluLookAt(this.x, this.y, this.z, tpos.x, tpos.y, tpos.z, 0, 1.0f, 0);
      }
   }


Could anyone give me tips or pointers as to how I can get this to work?
17  Game Development / Newbie & Debugging Questions / Using LWJGL color API? on: 2013-07-10 18:16:50
Could anyone break down how to use the Color API of LWJGL to me?  From my testing, all of these colors are apparently the same:
1  
2  
3  
4  
5  
// Color c = new Color(r, g, b, a);

Color c = new Color(255, 155, 0, 255);
Color c = new Color(155, 255, 0, 255);
Color c = new Color(100, 200, 0, 255);

I searched on google for about an hour and didn't come up with anything substantial.  Although I am aware of bitshifting.  Do I need to shift
18  Game Development / Newbie & Debugging Questions / Code snippet that needs reviewing? on: 2013-07-10 07:04:31
I have a segment of code that's supposed to put floats into a FloatBuffer to create a small voxel; however, whenever I try to render it, it comes out as a flat plane.
Could anyone help me with this?

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  
31  
32  
33  
34  
35  
   public float[] voxelVertices(float x, float y, float z) {
      float xx = x * 0.2f, yy = y * 0.2f, zz = z * 0.2f;
      return new float[] {
            //   x,         y,            z
           // Top quad
           xx + 0.1f,      yy + 0.1f,      zz + 0.1f,
            xx - 0.1f,      yy + 0.1f,      zz + 0.1f,
            xx - 0.1f,      yy + 0.1f,      zz - 0.1f,
            xx + 0.1f,      yy + 0.1f,      zz - 0.1f,
            // Bottom quad
           xx + 0.1f,      yy - 0.1f,       zz - 0.1f,
            xx - 0.1f,      yy - 0.1f,      zz - 0.1f,
            xx - 0.1f,      yy - 0.1f,      zz + 0.1f,
            xx + 0.1f,      yy - 0.1f,      zz + 0.1f,
            // Front quad
           xx + 0.1f,      yy + 0.1f,      zz - 0.1f,
            xx - 0.1f,      yy + 0.1f,      zz - 0.1f,
            xx - 0.1f,      yy - 0.1f,      zz - 0.1f,
            xx + 0.1f,      yy - 0.1f,      zz - 0.1f,
            // Back quad
           xx + 0.1f,      yy - 0.1f,       zz + 0.1f,
            xx - 0.1f,      yy - 0.1f,       zz + 0.1f,
            xx - 0.1f,      yy + 0.1f,       zz + 0.1f,
            xx + 0.1f,      yy + 0.1f,       zz + 0.1f,
            // left quad
           xx - 0.1f,      yy + 0.1f,       zz - 0.1f,
            xx - 0.1f,      yy + 0.1f,       zz + 0.1f,
            xx - 0.1f,      yy - 0.1f,      zz + 0.1f,
            xx - 0.1f,      yy - 0.1f,      zz - 0.1f,
            // right quad
           xx + 0.1f,      yy + 0.1f,       zz + 0.1f,
            xx + 0.1f,      yy + 0.1f,      zz - 0.1f,
            xx + 0.1f,      yy - 0.1f,       zz - 0.1f,
            xx + 0.1f,      yy - 0.1f,       zz + 0.1f};
   }
19  Game Development / Newbie & Debugging Questions / Camera spazzing out, as well as render method not working as intended on: 2013-07-10 00:42:50
Never mind, I have figured out what the problem was.  Could someone remove this?
20  Game Development / Newbie & Debugging Questions / Re: About lists and the elements inside of them. on: 2013-07-09 06:51:59
Ahh, thank you very much.  This helps me enormously!
21  Game Development / Newbie & Debugging Questions / About lists and the elements inside of them. on: 2013-07-09 05:51:45
So I have a List of Component.java, right?  Inside of this list, I want to store a few types of classes all of which extends the Component.java class.  See, that part I can do just fine.  At present, I'm storing Wire.java's and Pipe.java's.

However, when it comes to accessing the different types inside of the list, I'm faced with a dilemma.

First I tried it like this:  for (Wire w : component_list)
However, it can't iterate over only a single type of component inside of the list; it's looking for Wires when the iterator only knows to return Components.

Seeing this, I tried:

for (Component c : component_list) {
     if (c.equals(Wire.class)) {
          Wire w = (Wire) c;
     }
}

However, I'm not sure that it's working properly.  I'm wondering, is the second option possible?
22  Game Development / Newbie & Debugging Questions / Re: Computing volume on: 2013-07-09 02:50:50
I honestly wouldn't know how to figure that out.  How would I check to see if a voxel is an exterior corner, or an interior corner?  Like, if I had an L-shaped container?

Each Voxel is assigned to a group called a Component, and the type of Component determines what those voxels do.  For example, a Chamber component can contain liquids, while Containers can hold solid cargo, and Pipes, which can hold and transport liquids.

The volume calculation is important only to Chambers and Containers at present, and the player places the walls of the chamber or container; once the player saves the current set of voxels, a class builds a new in-game Component based on what the voxels would do.  That's why I need to be able to calculate irregular spaces, since odds are that players will be making irregular shapes.
23  Game Development / Newbie & Debugging Questions / Computing volume on: 2013-07-09 02:08:28
What I mean by the title is that I have a set of voxels that are arrayed so that they encompass a 3d space.  The question is, can I compute the volume of this space in an efficient way?

I thought of starting inside of the space and checking the 6 directions from the beginning, and then checking the spaces beyond those, and so on until they hit a voxel, but that seems very inefficient to me.

In any case, any pointers are greatly appreciated.
24  Game Development / Newbie & Debugging Questions / Re: LWJGL camera zooming? on: 2013-07-08 20:13:01
Aha, yeah, I figured something like that would be needed.  Thanks for the help, though!  It really did help a lot.
25  Game Development / Newbie & Debugging Questions / Re: LWJGL camera zooming? on: 2013-07-08 18:25:04
Linear interpolation, huh?  I'll keep that in mind, thanks.

EDIT: nevermind, figured that one out.

However, my question now is:  Mouse.getDWheel() is returning an int of 120.  Is the 120 a universal value across all mouses, or do I need to create something to accomodate a change in that value?
26  Game Development / Newbie & Debugging Questions / LWJGL camera zooming? on: 2013-07-08 17:52:54
So I have a float value called zoom.  Zoom can be anywhere between 0.0125 and 1, with 1 being fully zoomed out, and 0.0125 being approximately 80 times zoomed in.

I'm attempting to change this value using the mouse scroll wheel, but I'm not sure how I would want to get a smooth zoom.  Would I repeatedly add (0.0125 * scroll wheel change) to the zoom value?

Or would I perhaps multiply zoom by something like 1.05?

Essentially, the question is, how would I go about creating a smooth zooming "range"?
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (46 views)
2014-04-15 18:08:23

BurntPizza (42 views)
2014-04-15 03:46:01

UprightPath (58 views)
2014-04-14 17:39:50

UprightPath (40 views)
2014-04-14 17:35:47

Porlus (56 views)
2014-04-14 15:48:38

tom_mai78101 (79 views)
2014-04-10 04:04:31

BurntPizza (138 views)
2014-04-08 23:06:04

tom_mai78101 (238 views)
2014-04-05 13:34:39

trollwarrior1 (199 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!