Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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  Discussions / General Discussions / Data matrix bar codes - Riddle / Challenge on: 2011-08-11 07:46:08
Notch posted on his twitter about a Minecraft or related ad present in the Develop Magazine, issue 119. The online version of this issue can be found here.
I extracted the image on page 43 and it is this:


I've been looking for a way to decode it. I have tried online decoders, downloaded SDK's for barcode reading, I've had no luck. There appears to be no finder pattern within the image, leading me to believe that I am going at this all wrong and that it's not even a Data Matrix barcode.
2  Discussions / Miscellaneous Topics / Rammus on: 2011-08-07 08:11:35
This is Rammus
3  Discussions / Miscellaneous Topics / Re: Google Plus or Google+ on: 2011-07-12 03:18:57
I wouldn't mind an invite. My email is kieve10@gmail.com
4  Game Development / Game Mechanics / Re: Snake (2nd part): Smooth-Moving on: 2011-05-16 15:37:01
If i remember correctly, your position updates UNIT distance every time frame. If you kept two variables, one for the unit it should move to and another for individual pixels. The speed equation (general) = UNIT / time so to move at that speed but one pixel at a time it would look like:
1/x = UNIT/time
x = time/unit
There for you should move render the snake 1 pixel every update time witch would be:  (time / unit distance).

Please correct any errors I may have created here, I like to learn from those mistakes.
5  Game Development / Newbie & Debugging Questions / Re: Exporting an Applet with Eclipse on: 2011-05-11 03:02:27
try changing
1  
APPLET CODE="MyApplet.class"


to
1  
APPLET CODE="game/programming/tutorial/MyApplet.class" 

6  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-08 23:53:17
I think it might be just who I am, I'm not very creative but when it comes to code, everything just flows for me. It also helps that this is a very simple program. I have only been coding for about a year and a half. Everyone can eventually see the connections in Code, some people pick this up very fast, others don't. The best thing I can suggest is come up with an idea for a program, one you have never written before and try to write it. When you come across problems you don't know how to solve right away, work at solving it. Use all the resources you can, and once you truly understand the problem, you will know how to fix it. Something very important though, make sure if something doesn't work how you want it to while your writing it, fix it right away. The longer you wait, and the more Code you write after it, the less you will understand where the problem is and the harder and more time consuming it will be to fix everything.
7  Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations on: 2011-05-08 16:57:33
I have come up with some code that to me seems that it should work, but does not and does work.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
if(rotating){
   currentSpeed = rotationSpeed;
   quatRotationChange.setFromAxisAngle(new Vector4f(turnX, turnY, turnZ, (isPrime? -1:1) * currentSpeed));      
   Quaternion.mul(quatCurrentRotation, quatRotationChange, quatCurrentRotation);
   quatCurrentRotation.normalise();
   createMatrixBuffer();
}      
     
GL11.glLoadIdentity();
GL11.glTranslatef(0f, 0f, -10f);

createMatrixBuffer();
GL11.glMultMatrix(matrixBuffer);


createMatrixBuffer method is 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  
36  
private void createMatrixBuffer(){
   float w,x,y,z;
   w = quatCurrentRotation.w;
   x = quatCurrentRotation.x;
   y = quatCurrentRotation.y;
   z = quatCurrentRotation.z;
   Matrix4f m = new Matrix4f();
     
   m.m00 = sq(w) + sq(x) - sq(y) - sq(z);
   m.m01 = 2 * x * y + 2 * w * z;
   m.m02 = 2 * x * z - 2 * w * y;
   m.m03 = 0;

   m.m10 = 2 * x * y - 2 * w * z;
   m.m11 = sq(w) - sq(x) + sq(y) - sq(z);
   m.m12 = 2 * y * z + 2 * w * x;
   m.m13 = 0;
   
   m.m20 = 2 * x * z + 2 * w * y;
   m.m21 = 2 * y * z - 2 * w * x;
   m.m22 = sq(w) - sq(x) - sq(y) + sq(z);
   m.m23 = 0;

   m.m30 = 0;
   m.m31 = 0;
   m.m32 = 0;
   m.m33 = sq(w) + sq(x) + sq(y) + sq(z);
     
   matrixBuffer.clear();
   m.store(matrixBuffer);
   matrixBuffer.flip();
}
   
private float sq(float x){
   return x*x;
}


I used the formula found Here
8  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-08 15:49:25
Add a boolean called started or some relevant name to your list at the top of your Board class.
Then you need to move:
1  
timer.scheduleAtFixedRate( new ScheduleTask(), 0, DELAY )

Into each of your Adapter if statements like so:
1  
2  
3  
4  
if(!started){
     timer.scheduleAtFixedRate( new ScheduleTask(), 0, DELAY );
     started = true;
}
9  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-08 14:57:45
OH! Right! My bad, i completely missed that. It's like that because your x and y is measured from the top left corner of your image! What you posted is not a quick fix, it's the correct fix =D
10  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-08 14:23:15
You want to change your collision detection to collision prediction.
First, is to check if a collision will occur in the next updated move, if it will, check if they change direction before then, if they don't, end the game, if they do, let them move on their marry way.
I implemented and tested and i think this is what you want.
Add the following to the list of variables at the top of you board class (named how you see fit):
1  
private boolean willCollide, changedDirection;


Next we need to update your checkCollision class to:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
private void checkCollision() {
     changedDirection = false;
     if(left){
          if(x[0] - UNIT < 0){
               willCollide = true;
          }
     }
     if(right){
          if(x[0] + UNIT > BOARDS_WIDTH){
               willCollide = true;
          }
     }
     if(up){
          if(y[0] - UNIT < 0){
               willCollide = true;
          }
     }
     if(down){
          if(y[0] + UNIT > BOARDS_HEIGHT){
               willCollide = true;
          }
     }
}


Changed direction = false because right after we predict collision, we test if they moved within the time frame to prevent the collision.
Each if statement checks what direction you are moving, then tests if you will be out of bounds next update if you continue in that direciton.


Add the following to each of the keyAdapter if statements where you change left,right,up,down:
1  
changedDirection = true;


Finally, in your timerTask run method, change
1  
move();
to:
1  
2  
3  
4  
5  
if(willCollide && !changedDirection){
     inGame = false;
}else{
     move();
}
11  Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations on: 2011-05-08 13:46:02
Are Google and Wikipedia broken again?

Absolutely not, like i said, I have been reading, a TON. The thing is I don't know how to implement it in OpenGL.
12  Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations on: 2011-05-08 01:47:43
I have been reading, and I'm coming across "quaternions" frequently and "gimbal lock". Any help with this?
13  Game Development / Networking & Multiplayer / Re: Would this Client to Server design work? on: 2011-05-07 23:11:54
I know nothing about networked games, as I have not begun working on one yet. I suspect that SQL would have better performance that updating a txt file with every user movement?
14  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-07 17:00:34
The reason for the print screen problem may be that the border of the window is being counted in the pixel count? And for a basic game like Snake, i think only the Main thread is required. A very basic example of a single threaded gameloop might be:
1  
2  
3  
4  
5  
6  
7  
8  
public void start(){
     init();//Initialize variables, load images, etc.
    while(running){
         logic();//update locations, handle input, check collision, etc.
        render();//draw stuff to the screen
    }
     cleanup();//release resources, do things required before exiting;
}
15  Game Development / Newbie & Debugging Questions / Re: New Member + Snake Game on: 2011-05-07 16:17:44
Alright, first first. Your board size problem.

1  
2  
private final int BOARDS_WIDTH = 640; // 16 * 40.
private final int BOARDS_HEIGHT = 480; // 16 * 30


to
1  
2  
protected final int BOARDS_WIDTH = 640; // 16 * 40.
protected final int BOARDS_HEIGHT = 480; // 16 * 30


This is so we can access those values from the Snake class.

1  
2  
add( new Board(), BorderLayout.CENTER );
pack()


to
1  
2  
3  
Board b = new Board();
setSize(b.BOARDS_WIDTH, b.BOARDS_HEIGHT);
add(b);



Second, your collision problems are being caused by the lack of a real game loop.

Finally the start position of your Snake.

In your initGame method in your board class.
1  
2  
x[0] = 0;
y[0] = 0;

This is your start position. for the center of the board, use:
1  
2  
x[0] = BOARDS_WIDTH / 2;
y[0] = BOARDS_HEIGHT /2;


You have inspired me to convert the snake game I wrote using Canvas and Graphics2D objects into a tutorial.
16  Game Development / Newbie & Debugging Questions / Re: OpenGL Axis Rotations on: 2011-05-07 14:58:13
I get a NullPointerException in org.lwjgl.opengl.GL11.glShadeModel() at line 160 in rubikEngine.Engine.initGL()
I also get a RuntimeException saying "Image based resources must be loaded as part of init() or the game loop. They cannot be loaded before initialisation." (haha they misspelled initialization) This was thrown inside the Slick library at line 426 in rubikEngine.Engine.loadTextures()

Hope that helped Cheesy

The NPE might have been caused by your video card not supporting smooth shading, i removed it and re-uploaded. My The Slick texture loader is bound to fail sometimes, if it does it just loads with basic GL11.glColor3f() calls instead of texture binding, so that should be fine.

To op: I see what you mean by that weird rotation thingy, it does seem like when you rotate around the x-axis, the y and z axis switch places with each other.
I haven't worked with opengl that much before, but wouldn't it be better to just have one glRotatef call? Like glRotatef(1.0f, rotX, rotY, rotZ); or something like that.

Maybe, but from what I understand is that glRotatef(angle, x,y,z) where angle is the angle of rotation, and x,y,z is either 1.0f or 0.0f, depending if you want to rotate that angle on that axis. The problem is that the angle for each axis is not the same, say maybe I want to rotate 90 degrees on the X-axis, but 180 degrees on the Y-axis.
17  Game Development / Newbie & Debugging Questions / OpenGL Axis Rotations on: 2011-05-07 04:12:33
SOLVED
See my last post for details.

I am programming a 3x3 puzzle cube (aka Rubik's Cube) and I am having some difficulty with axis rotations.
When i press "X" i have the rotX increase by 90 degrees, the same goes for Y, and Z. You can only rotate on one axis at a time.
The problem is, I wish for my cube to rotate relative to my perspective. An example of what happens now is if i rotate 90 degrees on the X axis, then try rotating on the Y axis, the cube turns on (what i see to be) the Z axis.

1  
2  
3  
      GL11.glRotatef(rotX, 1.0f, 0.0f, 0.0f);
      GL11.glRotatef(rotY, 0.0f, 1.0f, 0.0f);
      GL11.glRotatef(rotZ, 0.0f, 0.0f, 1.0f);


If you wish to demo the program: File Beam
Controls:
1 - turn red
2 - turn orange
3 - turn blue
4 - turn green
5 - turn yellow
6 - turn white
X - rotate on "X" axis
Y - rotate on "Y" axis
Z - rotate on "Z" axis
Left Shift - Hold to turn / rotate opposite direction.
Right Shift - Reset cube.
Escape - Exit.
Enter - Scramble cube.
Backspace - Undo last move (includes scramble moves).
18  Game Development / Game Play & Game Design / LWJGL concept question on: 2011-03-18 02:09:55
Edit: Never mind, I got this done, no problem.

Hey, I have got a basic concept question. I'm currently working on replicating the famous 3x3 puzzle cube (brand name Rubik's Cube) in a 3D java environment using LWJGL. I have created and can render all the pieces in their starting position. My question is if anyone has any recommendation on how i should have the cubies move around the cube. I have been thinking of using one of two methods. The first is having the rendered cubies move around the core when a layer is turned and keeping track of the relative position and orientation. The second is to simply move where I am drawing the colors based on a layer movement. I would really appreciate the help of a more experienced programmer.
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.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

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

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

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

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

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

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

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

BurntPizza (34 views)
2014-08-08 02:01:56
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!