Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (516)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (577)
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 ... 6
1  Game Development / Newbie & Debugging Questions / Re: LibGDX Procedural Generation on: 2014-10-28 15:42:16
K.. in reading the responses it seems you have multiple questions.

ill try to answer all the ones i made note of:

1. how do you save your map.. vs generating a new one.
After you generate your map you may want to store the result in a file or database of some sort. This is the most straight forward answer.
As for regenerating.. its important to know that most noise approaches involve using a seed value (a random number). If you use the same seed value again the result of the noise algorythm should be the same every single time.

2. how to get the width / height
It sounded like you were asking about how to setup the view / camera matrix for rendering the screen. If so then the link provided is a start (in previous post) keep in mind just cause you used a map to generate your terran doesnt really change how you would draw or render your 3d scene.

3. from map to game.
ok you made your noise map.. now what? its really up to you to decide what the dark vs light elements of map mean and translate that to a map you can display. Perhaps the map is 1000x times bigger than what you want to show on screen at one time.. thats up to you. Smiley the trick is procedurally decide how to interpret the values and build your "real" game map based on them.

2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-28 03:47:55
Ok.. i guess ill start updating here too Smiley

today i worked a bit on my game engine. here is a vid..
i still have lots to fix and add but its getting there..
(raytracing, text, loading of 3d models, textures, shaders.. all work in its current state)

I was just adding a skybox model here (there is a broken seem.. the pic needs to be a higher res... but you get the idea)


<a href="http://www.youtube.com/v/W_fH33__eks?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/W_fH33__eks?version=3&amp;hl=en_US&amp;start=</a>
3  Java Game APIs & Engines / OpenGL Development / Re: [LWJGL] Making The Camera Look At A Point on: 2014-10-28 03:31:25
heres a tip.

instead of floats consider keeping your yaw pitch and roll in three separate matrix4f's.
you merge them only when creating your view matrix. this will make situation like when you roll and now your yaw moves like a pitch much easier..
 
4  Game Development / Newbie & Debugging Questions / Re: LibGDX Procedural Generation for Platformer on: 2014-10-28 03:07:01
procedure generation techniques tend to be based on some sort of math procedure that is run to "generate" a result that is then interpreted as your landscape..

A common one is called perlin noise. When you run this you get something that resembles TV static.
But if you run it three times at say different resolutions.. and then merge them together you get an image that resembles the natural transition between hilly and flat land areas.

(this of the first run as the pebbles.. the next is the hills and the last as the mountains.. mix them together and you get a more natural looking result)

Im not entirely sure how you would want to take this into a 2d game.. but im sure there are techniques (or others may chime in with what they have done + ideas)

cheers.
j.
5  Game Development / Newbie & Debugging Questions / Re: All about arrays! on: 2014-10-28 01:13:08
what you may be tripping on is when to use an array vs a List (like an ArrayList or other form of Collection).

The simple truth is before object oriented programming Lists were not arround but arrays where. Array provide a very nice and small way to describe ordered / indexable data.

A list is more flexible and but they do come with a larger memory footprint.

Since arrays have been around a lot longer they are also highly optimized.. so if your trying to squeeze as much speed as possible out.. thats another factor..

Lists use method calls to get their data and thus are slower.

Now with experience you become pragmatic. The sort of considerations ive listed above to do not make arrays better than lists. In many cases Lists are easier to work with (personal opinion) and easier to maintain. Those factors can out weigh most others. But understanding the pro vs cons of both approaches and when you should use them and why will be a good tool to have in your programming arsenal!

Keep asking questions! dont hesitate. We have all been there and its better to ask then not know.
6  Game Development / Newbie & Debugging Questions / Re: All about arrays! on: 2014-10-28 00:53:02
This is why i ask if he / she means VertexBufferArrays.. which is more opengl specific..
7  Game Development / Newbie & Debugging Questions / Re: All about arrays! on: 2014-10-28 00:50:49
Do you mean vertex object arrays?

if so ill do a post and provide sample code if you like.
8  Discussions / General Discussions / Re: Instancing.. NVIDIA vs ATI on: 2014-10-24 18:33:34
where i was running into a cap was in the array of uniform variables being passed into the instances
there appeared to be a cap on the max size of the array of mat4 's i was passing it (mat[253] appears to be the max)

looks like i may have to find another way to pass in the instance specific model matrixes.

j.
9  Discussions / General Discussions / Instancing.. NVIDIA vs ATI on: 2014-10-23 01:54:24
Hi Everyone,

I have what i hope is a fairly simple question.

My code is using opengl instancing.
However in doing research, i have found that early implementations of instancing support was limited to NVIDIA supporting instance data arrays of max size 1000
and ATI only supporting a max size of 32. (a hell of a difference!)

Since both my computers are using nvidia cards i wanted to ask if anyone knew if this limitation was still true?


thanks.
j.
10  Java Game APIs & Engines / OpenGL Development / Re: Draw Order and Scene Graphs on: 2014-10-15 11:29:32
so for anyone who makes the error that i did .. i believe what your referring to is :

https://www.opengl.org/archives/resources/faq/technical/depthbuffer.htm
11  Java Game APIs & Engines / OpenGL Development / Draw Order and Scene Graphs on: 2014-10-15 11:17:03
So i did an experiment with my custom game engine and came to a realization .. and now i need some advice.

Realization : render order matters.

What i saw: objects that are farther away from the camera are being rendered "in front" of closer objects for no other reason than they were "drawn" after the closer one. this results in a pretty trippy effect when you navigate the world...

So .. i may need some way of ordering the meshes before rendering them on each draw pass.. what is an effective way of doing this since what is "close" is relative to the camera position and thus will change.

What im really hoping is that the video card was just going to do this for me. So perhaps i missed a switch that i need to enable in my openGL code?

thanks in advance for any advice.

j.
12  Game Development / Newbie & Debugging Questions / Re: loading + drawing + animate an md2 file on: 2014-10-14 19:26:35
never tried to use an md2 file but i know the theory.

-First step you need to figure out how to draw the first model frame.
-- a frame is basicallly a series of models and shapes at a single point in time.
-Next figure out how to draw the subsequent frames.

the linear translation is then the determination of where are the model points if the point the time is between two frames.
this is done by comparing the points at the start position and end position and then adjusting the down a linear path by a percentage.

13  Game Development / Game Play & Game Design / Re: How do I make a moddable game in Java? on: 2014-10-14 16:44:17
To support modding you need to make sure you do the following:
  • leverage interfaces ! have a good component design and assume that your implementations may be extended or even replaced
  • make your loading dynamic on startup. If you community is  going to change your program make it easy to do.
\

Lots of frameworks can be leveraged to do this: spring, osgi... heck you can even make your own using reflection if your so inclined.
(spring is the simplest .. osgi is an very well established plugin framework but has a larger learning curve)

j.
14  Game Development / Newbie & Debugging Questions / Re: Perlin noise that looks like this on: 2014-10-14 15:00:46
To get an image like you want.. you want to run the perlin routine at different levels and them merge the results.

15  Game Development / Newbie & Debugging Questions / Re: LWJGL - 3D Frustum Issue on: 2014-10-14 14:59:23
Not sure im following what your issue is..

can you be specific on what you want to have happen, expect to have happen and what your experiencing.

Will do my best to help

j.
16  Discussions / General Discussions / quaternion camera - almost working - rotation control glitch on: 2014-09-03 00:53:08
So my quaternion based camera is almost working perfectly.

I've just noticed one odd glitch.

If i roll 180 degrees and then yaw say 45 degrees.. the movement is off. (i yaw more than i should and move forward less than i should )
If i roll back to up is back to opposite direction everything works great.

I believe this might be a bug in my getForward logic that doesnt account for the up vector.

anyone encounter this before? or have tips?

j.

17  Discussions / General Discussions / Re: Building a free flying 3D Quaternion camera on: 2014-08-29 16:50:44
i've removed my movement code so as to return to the "most working" state as i ask for suggestions.

thanks!
J.
18  Discussions / General Discussions / Re: Building a free flying 3D Quaternion camera on: 2014-08-29 16:49:27
well im still struggling on this..

so here is the full class..

What works
  • Rotate the camera pitch (w/s) yaw (a/s) roll (q/e)

what doesnt work:
  • Movement: attempting to following the examples provide resulted in a axis getting locked (stopped moving with the rotations) or the forward direction ignoring an axis rotation

Since quaternions are still relatively new to me i'm feeling like im just missing that "ahah! " moment..

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  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
package com.windpoweredgames.wind.camera;

import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

import com.windpoweredgames.wind.GameEngine;
import com.windpoweredgames.wind.input.InputManager;
import com.windpoweredgames.wind.input.InputProcessor;
import com.windpoweredgames.wind.util.MatrixUtil;
import com.windpoweredgames.wind.util.VectorUtil;


public class DefaultCamera extends AbstractCamera implements InputProcessor{
   
   private float speed = 0f; // 1 unit per sec
   private float distRate = 1f/1000f;
   private float rotRate = 1f/1000f;
   
   private Quaternion camRotations = new Quaternion();
   
   private Vector3f pos =       new Vector3f(0,0,0);
   private Vector3f up =       new Vector3f(0,1,0);
   private Vector3f forward =   new Vector3f(0,0,-1);
   private Vector3f right =    new Vector3f(1,0,0);
   
   
   
   public void setActive(boolean active) {
      super.setActive(active);
      if(active){
         InputManager.getInstance().add(this);
      }else{
         InputManager.getInstance().remove(this);
      }
   }
   
   public void setSpeed(float speed) {
         this.speed = speed;
   }
   
   public float getSpeed() {
      return speed;
   }
   
   
   
   
   
   private float getTimeDependantDistance(){
      float deltaTime = (float)GameEngine.getInstance().getDeltaTime();
      float dist = speed * (distRate * deltaTime);
      return dist;
   }
   
   private float getTimeDependantRotation(){
      float deltaTime = (float)GameEngine.getInstance().getDeltaTime();
      float rot =  (rotRate * deltaTime);
      return rot;
   }
   
   
   
   
   public Matrix4f getCameraPositionMatrix() {
      Matrix4f result = new Matrix4f();
      Matrix4f rotMat = MatrixUtil.convertToMatrix(this.camRotations);
      result = result.mul(result, rotMat, result);
      result.translate(this.pos);
      return result;
   }
   
   private void updatePosition(float deltaPitch, float deltaYaw, float deltaRoll, float deltaFwd, float deltaRight){
     
      Quaternion qPitch = new Quaternion();
      qPitch.setFromAxisAngle(new Vector4f(this.right.x, this.right.y, this.right.z, deltaPitch));
      camRotations.mul(camRotations, qPitch, camRotations);
     
      Quaternion qYaw = new Quaternion();
      qYaw.setFromAxisAngle(new Vector4f(this.up.x, this.up.y, this.up.z, deltaYaw));
      camRotations.mul(camRotations, qYaw, camRotations);
               
      Quaternion qRoll = new Quaternion();
      qRoll.setFromAxisAngle(new Vector4f(this.forward.x, this.forward.y, this.forward.z, deltaRoll));
      camRotations.mul(camRotations, qRoll, camRotations);
     
     
   }
   
   
   
    public void processInput() {
      float dist = getTimeDependantDistance();
      float rot = getTimeDependantRotation();
      float deltaPitch = 0f;
      float deltaRoll = 0f;
      float deltaYaw = 0f;
     
     
      //System.out.println(deltaTime);
     
      if(Keyboard.isKeyDown(Keyboard.KEY_Q)){
         deltaRoll -= rot;
      }
      if(Keyboard.isKeyDown(Keyboard.KEY_E)){
         deltaRoll +=rot;
      }
     
      if(Keyboard.isKeyDown(Keyboard.KEY_W) & Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
      }else if(Keyboard.isKeyDown(Keyboard.KEY_W)){
         deltaPitch -= rot;
      }
     
      if(Keyboard.isKeyDown(Keyboard.KEY_S) & Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
      }else if(Keyboard.isKeyDown(Keyboard.KEY_S)){
         deltaPitch += rot;
         
      }
     
     
      if(Keyboard.isKeyDown(Keyboard.KEY_A) & Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
      }else if(Keyboard.isKeyDown(Keyboard.KEY_A)){
         deltaYaw += rot;
      }
     
      if(Keyboard.isKeyDown(Keyboard.KEY_D) & Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){
      }else if(Keyboard.isKeyDown(Keyboard.KEY_D)){
         deltaYaw -= rot;
      }
     
     
     
     
      if(Keyboard.isKeyDown(Keyboard.KEY_ADD) ||Keyboard.isKeyDown(Keyboard.KEY_EQUALS)  || Keyboard.isKeyDown(Keyboard.KEY_F)){
         setSpeed(getSpeed()+0.001f);
      }
      if(Keyboard.isKeyDown(Keyboard.KEY_MINUS) || Keyboard.isKeyDown(Keyboard.KEY_F)){
         setSpeed(getSpeed()-0.001f);
      }
      if(Keyboard.isKeyDown(Keyboard.KEY_BACK)){
         setSpeed(0);
      }
     
      updatePosition(deltaPitch, deltaYaw, deltaRoll, speed,0);
     
   }
   
   

   
}

19  Discussions / General Discussions / Re: Building a free flying 3D Quaternion camera on: 2014-08-29 15:59:00
Hi Basil

thanks for the code snippets.

Im going to ask one more dum question.  Smiley

so no i can determine the forward vector. I want to ensure my translate of the position is relative to the new angles.

(ie.. i want to fly forward in the forward vector direction)

Got any samples / tips for that?
20  Discussions / General Discussions / Re: Building a free flying 3D Quaternion camera on: 2014-08-29 14:05:26
you know what.. im probably making this harder in my head than it needs to be.

Here is a snippet of my code

1  
2  
3  
4  
5  
6  
7  
   private Quaternion camRotations = new Quaternion();
   private Matrix4f   camMatrix = new Matrix4f();
   
   private Vector3f up =       new Vector3f(0,1,0);
   private Vector3f forward =   new Vector3f(0,0,-1);
   private Vector3f right =    new Vector3f(1,0,0);
   



1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
   private void updatePosition(float deltaPitch, float deltaYaw, float deltaRoll, float deltaFwd, float deltaRight){
      Quaternion qPitch = new Quaternion();
      qPitch.setFromAxisAngle(new Vector4f(this.right.x, this.right.y, this.right.z, deltaPitch));
      camRotations.mul(camRotations, qPitch, camRotations);
     
      Quaternion qYaw = new Quaternion();
      qYaw.setFromAxisAngle(new Vector4f(this.up.x, this.up.y, this.up.z, deltaYaw));
      camRotations.mul(camRotations, qYaw, camRotations);
     
      Quaternion qRoll = new Quaternion();
      qRoll.setFromAxisAngle(new Vector4f(this.forward.x, this.forward.y, this.forward.z, deltaRoll));
      camRotations.mul(camRotations, qRoll, camRotations);
     
     
   }
   



whats throwing me off.. is if i roll then pitch then yaw.. then forward would be affected by all these rotations .. so When and from which quat would i be adding.. sigh.. need more coffee.

thanks!
J.


21  Discussions / General Discussions / Re: Shameless Plug on: 2014-08-29 13:54:01
Hi Cas,

First off kudos on building another game.
your projects were one of the first I found when deciding to work on a game using java and you've definately done some nicely polished work!

This latest game has me a bit confused as to how you play / what the game really is.

can you elaborate on the concept / mechanics?

22  Discussions / General Discussions / Building a free flying 3D Quaternion camera on: 2014-08-29 13:49:52
Hi Everyone,

Ok.. so i've been trying to build a free flying camera.
I've used quaternions to handle rotations with success.

Only one part of mechanics seems to be eluding me. movement.

how do i find out after the rotations have been applied what my new relative forward vector is, so that i can translate in the right direction...

Im sure there is likely a simple answer that im just missing.

thanks for any help

J.
23  Discussions / General Discussions / Re: Camera with Roll Pitch and Yaw on: 2014-08-28 06:28:30
thanks for the code snippet..
I'll review it but not sure it will work for what i need.

An FPS style camera usually moves on a plane and pitch but does not adjust for a roll.

The camera im looking to make need to be more "flight sim" in style. ie.. the camera can bank and pull up and the relative direction has changed.
24  Discussions / General Discussions / Camera with Roll Pitch and Yaw on: 2014-08-28 06:02:44
wow the net is full cameras that support yaw and pitch.. but not roll.

does anyone have a good example / tutorial or sample of a full yaw/pitch/roll camera?

thx
j.
25  Discussions / General Discussions / Re: Matrix4f rotation and movement interaction problem on: 2014-08-27 23:55:35
yes thats right..

if anyone has a really good tutorial link for this it would be much appreciated.
im sure im just missing one little detail.

j.
26  Discussions / General Discussions / Matrix4f rotation and movement interaction problem on: 2014-08-27 17:03:13
Hi Crew,

Ok.. im having what i thought should be simple but i must be missing something.

I have a object in my world. (camera)
I represent its location using a Matrix4f.

I want to be able to rotate the object and then move it forward where forward has been affected by the rotation.
ie.. rotate roll 45 degree then pitch 45 .. forward is now 45 / 45 and move forward 100.

in multiplying my matrices however the rotation works fine.. but the forward direction is unaffected.
(it will move forward ignoring the rotation)

so im clearly missing something that likely is very newbish on my part.

any help is appreciated.

j.
27  Game Development / Newbie & Debugging Questions / Re: Private fields, not really private? on: 2014-08-20 20:43:07
Are you afraid someone will use reflection to "hack" your application?
28  Game Development / Newbie & Debugging Questions / Re: LWJGL drag shape with mouse - How would I do it? on: 2014-08-20 19:13:03
ok.. so your a 2d application which makes things easier..

you have two choices on how to tell if your mouse in "inside" your shape.

option1 : treat all your shapes like rectangles.

This is a simplification...  if your mouse Y is less than highest modelY and more than lowest modelY then its within the height.
If your mouse X is less than the highest modelX and more than the lowest modelX then its inside X
if your inside Y and inside X your in the "rectangle" of the shape!

Option 2: very accurate approach but more work.

For your irregular shape (like your image)
your going calculate the area of the shape. To do this take 3 points that make up the shade and find the area of that triangle.
Next repeat this step taking another 3 points where at least 1 point has never been used in previous calculations
repeat until you covered all the points.

If you add up all the area calculations you will have the area of the shape.

Next we repeat the process but now we use the mouse x,y as if it was a point in the shape.
If the x,y of the mouse is inside the shape the area sum will == our first calculation. if its outside the shape it will result in an area larger than the original sum of the areas.

This approach will give you very accurate detection.




 
29  Game Development / Newbie & Debugging Questions / Re: LWJGL drag shape with mouse - How would I do it? on: 2014-08-20 17:59:06
Ok.. what you want to do should (as in most things in life) be broken down into smaller steps that when combined get the result your looking for.

Step 1: is my mouse over my model.
Now you didnt say if this was a 2d or 3d game.. the the concept is the same either way.
If your in a 2d game you needs a bounds checking (is my mouse x,y inside my shape)...
If your in a 3d game you need to do a raytrace or picker routine.

This is probably the hardest part.. once you have this working.
Next comes what to do now that we know your over the object with your mouse.

Step2: Keyboard  / mouse listener
LWJGL provides a very nice interface for building a keyboard and mouse listener.
Implement this and youll be able to write code that reacts to when a button on either peripheral is pressed.

Step 3 and 4
Now that we know we were over a object and a key was pressed change the coords of the model as we move the mouse.
This really just changing the coords your using based on more keyboard / mouse listener imputs. Thing of moving the mouse as another way of pushing buttons.. you can get the motion from the same interface provided by lwjgl.

They then push a button and you stop updating the model's coords.

Ok.. so this is very very abstract.. but if you tell me more about your game i can try to be more specific.

j.
30  Game Development / Game Mechanics / Re: [LibGDX] Edges on 3D models on: 2014-08-18 18:44:51
in your shader.. you will need to "test" if your at the edge of your model and if so change the color to say black..
you can reapply this same logic to see if your "withing 5 pixels" of the edge to make the highlight bold if you want.

Pages: [1] 2 3 ... 6
 

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

The first screenshot will be displayed as a thumbnail.

TehJavaDev (33 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (41 views)
2014-10-26 19:37:11

Luminem (22 views)
2014-10-26 10:17:50

Luminem (27 views)
2014-10-26 10:14:04

theagentd (33 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (58 views)
2014-10-16 15:22:06

Norakomi (47 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
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

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