Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
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
1  Java Game APIs & Engines / OpenGL Development / Re: Suggestions for a really nice sun effect in OpenGL/Slick2D? on: 2013-04-09 22:27:37
As your planet looks static, you should render it only one time (to an texture or something), and use an VBO.
3D noise is just slow, so you will not be able to render many planets at the same time this way.
Generating an texture will be much much faster in the long run.

Agreed. Unfortunately, I'm having horrible problems with shader texture binding interfering with Slick. As it stands, this shader can basically render 400x400 pixels of planet at 60 FPS, and it doesn't really matter if that's one big 400x400 planet or 100 40x40 planets.
2  Java Game APIs & Engines / OpenGL Development / Re: Suggestions for a really nice sun effect in OpenGL/Slick2D? on: 2013-04-09 12:25:22
Don't use ShaderToy, use https://www.shadertoy.com/

Oh, wow! It even has a pretty neat sun effect: https://www.shadertoy.com/view/4dXGR4

Here's my planet in action. Smiley https://www.shadertoy.com/view/MdX3RM
3  Java Game APIs & Engines / OpenGL Development / Re: Suggestions for a really nice sun effect in OpenGL/Slick2D? on: 2013-03-28 17:51:27
Yeah, perlin noise seems to be the way to go. I've been playing with ShaderToy and following the advice from the slick forum and managed to create a fairly nice shader for making planets. (Haven't actually looked into suns yet, but that should be easier!)

4  Games Center / 4K Game Competition - 2013 / Re: Annotated Code on: 2013-03-23 10:48:23
Well, I'll give it a try to gauge interest. Annotated code tomorrow or so. Smiley
5  Java Game APIs & Engines / OpenGL Development / Suggestions for a really nice sun effect in OpenGL/Slick2D? on: 2013-03-22 20:14:52
So I'm working on the star map for a space-based game, and I'd like really beautiful animated sun graphics. This is what I have so far, which makes heavy use of particles:



<a href="http://www.youtube.com/v/Y4RuyKPPaEg?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/Y4RuyKPPaEg?version=3&amp;hl=en_US&amp;start=</a>

This is pretty, but as people have remarked, not that much like an actual sun, which looks more like

<a href="http://www.youtube.com/v/jx0MivZge_s?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/jx0MivZge_s?version=3&amp;hl=en_US&amp;start=</a>

Can you think of some method of generating a similar visual effect? (I'm using Slick2D, but can happily drop down into the raw OpenGL if needed.)
6  Games Center / 4K Game Competition - 2013 / Annotated Code on: 2013-03-22 20:09:19
So now that the competition has all but concluded, I have a suggestion: given the nature of Java4k code, it's often not too easy to read, and given they're small single-person projects, they tend to be light on comments. But it would be great to be able to learn from each other.

Would people be interested in reading/writing thoroughly annotated versions of their game code? If there's some interest, I'll start out and post an annotated version of the Parasite Escape code.
7  Games Center / Showcase / Re: Patent Blaster on: 2013-03-14 07:22:44
Interesting source of assets.  You should patent the concept Wink


You are quite right, I really should. And include an illustration of a deformed-looking person playing the game on a blocky computer screen.  Cool
8  Games Center / Showcase / Patent Blaster on: 2013-03-13 19:04:27
<a href="http://www.youtube.com/v/0dizSEHow9Y?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/0dizSEHow9Y?version=3&amp;hl=en_US&amp;start=</a>

I've just released a small indie game called Patent Blaster that's based on Slick. It's a sidescrolling shooter inspired by the awfulness of patent illustrations, with weird creatures you can burn/freeze/dissolve or just shoot.

If you want to give it a try, download the demo: Win Mac Linux. Let me know what you think. Smiley

9  Games Center / 4K Game Competition - 2013 / Re: Parasite Escape on: 2012-12-31 08:55:18
Thanks for the feedback. Smiley The pictorial instructions were a bit of an experiment, so I'll definitely add some text to them to make things less incomprehensible.

Can you describe in what way you find the controls/movement difficult?
10  Games Center / 4K Game Competition - 2013 / Parasite Escape on: 2012-12-30 15:00:39
My entry this year has you play as a horrific brain parasite trying to escape from a space base. Leap from brain to brain and outwit the humans to reach the next sector. Try it out: http://zarkonnen.com/parasite_escape/

Solicitations for feedback:
  • Any crashes?
  • Are the instructions understandable?
  • Is it fun?

11  Games Center / Showcase / Re: Bridge Crossing Minigame - Looking for Feedback on: 2012-06-08 15:33:57
I too got  stuck on level 3. I think you need to introduce the weight shifting mechanic in a much simpler level where *only* weight shifting is needed (no jumping), then a couple of levels like that before you start to combine the two.

Yeah, I think the difficulty curve is kind of wall-like. I will rework that shortly, and also introduce the concepts one by one instead of just in a massive info screen.
12  Games Center / Showcase / Re: Bridge Crossing Minigame - Looking for Feedback on: 2012-06-08 09:30:31
Level 3 is unbeatable AFAIK...

Try shifting your weight so that your footsteps become softer. The color of your "feet" changes to indicate how much weight you're putting on them. Smiley
13  Games Center / Showcase / Re: Bridge Crossing Minigame - Looking for Feedback on: 2012-06-07 17:49:56
Managed to cross every time by just going straight forward.  Had to shift-reload to reset the boards.   Maybe make it slippery so if you go too fast you could slip and slam through the boards.  Not sure how you'd represent that with footprints tho :/


That's just the first level. The second level has a board missing, which means you have to jump.

So feedback item #1: actually label the levels as LEVEL 1, LEVEL 2, etc. Smiley
14  Games Center / Showcase / Bridge Crossing Minigame - Looking for Feedback on: 2012-06-07 17:21:59


http://www.zarkonnen.com/ropebridge/

A Java applet minigame for crossing a bridge. I'm not totally convinced of it as it feels a bit awkward, so feedback on how to make it work better would be brilliant. Smiley

The aim is to cross the bridge and not fall down. You can move forward, jump, and crucially, shift your weight to avoid treading too heavily on damaged boards.

The idea behind this is that there's lots of games where you go on an adventure: delving into a dungeon, crossing wide wastelands, etc. In historical reality, there have been lots of these adventures. The main challenge was usually the terrain (cliffs, rivers, forests to get lost in, caves that branch again and again) and the chance of accident (breaking a leg, being bitten by a snake, losing your equipment).

But in games about adventures, the main challenge tends to be monsters that want to eat you. We all know RPGs have an unfortunate tendency to reduce some combination of a hack-and-slash, navigating dialogue trees, and jumping puzzles. But there's so much more to an adventure! So many other perils! LoTR is a classic story of an adventure, and there is very little fighting for the adventurers in it.

It's not all clear-cut, of course: in game history there were games that centered more on other perils, like Pitfall!

But anyway, I tried to make a list of all the activities that an adventure might actually involve. One of the classic ones is crossing a rickety bridge, so I thought I'd try making that into a game.
15  Game Development / Newbie & Debugging Questions / Re: LWJGL Lighting problem: All faces have same color on: 2012-03-23 21:25:46
Never mind, I finally figured it out: it was just that I was moving the light so little that for all intents and purposes it was always at the top. It works now!

Thank you so much for your help!
16  Game Development / Newbie & Debugging Questions / Re: LWJGL Lighting problem: All faces have same color on: 2012-03-23 21:19:50
You often don't want each vertex of a triangle to have to same normal.

Imagine rendering a sphere, or other curved shapes, it would look rather bad as the shade wouldn't be smooth across the surface.

Aaah, of course. OK, I'm afraid I have another question. (And BTW, thank you so much for your help so far.) So I'm now trying to render a cube, and I'm setting the normals to point straight out of the faces. However, I'm now seeing that the top face of the cube, with a normal call of

1  
glNormal3f(0.0f, 0.0f, 1.0f);


gets the most illumination, independent of what light position I supply using

1  
glLight(GL_LIGHT1, GL_POSITION,(FloatBuffer)temp.asFloatBuffer().put(lightPosition).flip());


Complete code:

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  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
package com.zarkonnen.lwjgltest;

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.util.glu.GLU.*;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;

public class Main {
   public static final int DISPLAY_HEIGHT = 480;
   public static final int DISPLAY_WIDTH = 640;
   public static final Logger LOGGER = Logger.getLogger(Main.class.getName());

   private float lightAmbient[] = { 0.5f, 0.5f, 0.5f, 1.0f };  // Ambient Light Values ( NEW )
  private float lightDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };      // Diffuse Light Values ( NEW )
  private float lightPosition[] = { 0.0f, 1.0f, 0.0f, 1.0f }; // Light Position ( NEW )
 
   static {
      try {
         LOGGER.addHandler(new FileHandler("errors.log", true));
      } catch (IOException ex) {
         LOGGER.log(Level.WARNING, ex.toString(), ex);
      }
   }

   public static void main(String[] args) {
      Main main = null;
      try {
         main = new Main();
         main.create();
         main.run();
      } catch (Exception ex) {
         LOGGER.log(Level.SEVERE, ex.toString(), ex);
      } finally {
         if (main != null) {
            main.destroy();
         }
      }
   }
   
   ArrayList<Box> boxes = new ArrayList<Box>();

   public void create() throws LWJGLException, IOException {
      //Display
     Display.setDisplayMode(new DisplayMode(DISPLAY_WIDTH, DISPLAY_HEIGHT));
      Display.setFullscreen(false);
      Display.setTitle("Hello LWJGL World!");
      Display.create();

      //Keyboard
     Keyboard.create();

      //Mouse
     Mouse.setGrabbed(false);
      Mouse.create();

      //OpenGL
     initGL();
     
      Texture tex = TextureLoader.getTexture("png", Main.class.getResourceAsStream("tex.png"));
      boxes.add(new Box(0, 0, 0, 1, 1, 1, tex));
   }

   public void destroy() {
      //Methods already check if created before destroying.
     Mouse.destroy();
      Keyboard.destroy();
      Display.destroy();
   }
   
   public void initGL() {
      glEnable(GL_LIGHTING);
      glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
       glShadeModel(GL_SMOOTH); // Enable Smooth Shading
       glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
       glClearDepth(1.0f); // Depth Buffer Setup
       glEnable(GL_DEPTH_TEST); // Enables Depth Testing
       glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do

        glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
       glLoadIdentity(); // Reset The Projection Matrix

        // Calculate The Aspect Ratio Of The Window
      gluPerspective(
            45.0f,
            DISPLAY_WIDTH * 1.0f / DISPLAY_HEIGHT,
            0.1f,
            100.0f);
        glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix

        // Really Nice Perspective Calculations
       glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
        ByteBuffer temp = ByteBuffer.allocateDirect(16);
        temp.order(ByteOrder.nativeOrder());
        glLight(GL_LIGHT1, GL_AMBIENT, (FloatBuffer)temp.asFloatBuffer().put(lightAmbient).flip());              // Setup The Ambient Light
       glLight(GL_LIGHT1, GL_DIFFUSE, (FloatBuffer)temp.asFloatBuffer().put(lightDiffuse).flip());              // Setup The Diffuse Light
       glLight(GL_LIGHT1, GL_POSITION,(FloatBuffer)temp.asFloatBuffer().put(lightPosition).flip());         // Position The Light
     glEnable(GL_LIGHT1);                          // Enable Light One
  }

   public void processKeyboard() {
      if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { cx += 0.03f; }
      if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { cx -= 0.03f; }
      if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { cy -= 0.03f; }
      if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { cy += 0.03f; }
   }

   public void processMouse() {
   }
   float cx, cy;
   
   public Main() throws IOException {
     
   }
   
   static class Box {
      float x, y, z, w, d, h;
      Texture tex;

      public Box(float x, float y, float z, float w, float d, float h, Texture tex) {
         this.x = x;
         this.y = y;
         this.z = z;
         this.w = w;
         this.d = d;
         this.h = h;
         this.tex = tex;
      }
   }
   
   public void render() {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);          // Clear The Screen And The Depth Buffer
     for (Box b : boxes) {
         glLoadIdentity();
         // Camera
        glTranslatef(cx, cy, -8);
         glTranslatef(b.x, b.y, b.z);
         b.tex.bind();
         glBegin(GL_QUADS);
         // North face
        glNormal3f(0.0f, -1.0f, 0.0f);
         glTexCoord2f(0.0f, 0.0f); glVertex3f(b.x, b.y + b.h, b.z);         glTexCoord2f(b.tex.getWidth(), 0.0f); glVertex3f(b.x + b.w, b.y + b.h, b.z);
                                                            glTexCoord2f(b.tex.getWidth(), b.tex.getHeight()); glVertex3f(b.x + b.w, b.y + b.h, b.z + b.d);
         glTexCoord2f(0.0f, b.tex.getHeight()); glVertex3f(b.x, b.y + b.h, b.z + b.d);
         // East face
        glNormal3f(1.0f, 0.0f, 0.0f);
         glTexCoord2f(0.0f, 0.0f); glVertex3f(b.x + b.w, b.y, b.z);         glTexCoord2f(b.tex.getWidth(), 0.0f); glVertex3f(b.x + b.w, b.y, b.z + b.d);
                                                            glTexCoord2f(b.tex.getWidth(), b.tex.getHeight()); glVertex3f(b.x + b.w, b.y + b.h, b.z + b.d);
         glTexCoord2f(0.0f, b.tex.getHeight()); glVertex3f(b.x + b.w, b.y + b.h, b.z);
         // West face
        glNormal3f(-1.0f, 0.0f, 0.0f);
         glTexCoord2f(0.0f, 0.0f); glVertex3f(b.x, b.y, b.z);            glTexCoord2f(b.tex.getWidth(), 0.0f); glVertex3f(b.x, b.y + b.h, b.z);
                                                            glTexCoord2f(b.tex.getWidth(), b.tex.getHeight()); glVertex3f(b.x, b.y + b.h, b.z + b.d);
         glTexCoord2f(0.0f, b.tex.getHeight()); glVertex3f(b.x, b.y, b.z + b.d);
         // South face
        glNormal3f(0.0f, 1.0f, 0.0f);
         glTexCoord2f(0.0f, 0.0f); glVertex3f(b.x, b.y, b.z);            glTexCoord2f(b.tex.getWidth(), 0.0f); glVertex3f(b.x, b.y, b.z + b.d);
                                                            glTexCoord2f(b.tex.getWidth(), b.tex.getHeight()); glVertex3f(b.x + b.w, b.y, b.z + b.d);
         glTexCoord2f(0.0f, b.tex.getHeight()); glVertex3f(b.x + b.w, b.y, b.z);
         // Top face
        glNormal3f(0.0f, 0.0f, 1.0f);
         glTexCoord2f(0.0f, 0.0f); glVertex3f(b.x, b.y, b.z + b.d);         glTexCoord2f(b.tex.getWidth(), 0.0f); glVertex3f(b.x, b.y + b.h, b.z + b.d);
                                                            glTexCoord2f(b.tex.getWidth(), b.tex.getHeight()); glVertex3f(b.x + b.w, b.y + b.h, b.z + b.d);
         glTexCoord2f(0.0f, b.tex.getHeight()); glVertex3f(b.x + b.w, b.y, b.z + b.d);
         glEnd();
      }
   }

   public void run() {
      while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
         if (Display.isVisible()) {
            processKeyboard();
            processMouse();
            update();
            render();
         } else {
            if (Display.isDirty()) {
               render();
            }
            try {
               Thread.sleep(100);
            } catch (InterruptedException ex) {
            }
         }
         Display.update();
         Display.sync(60);
      }
   }

   public void update() {
   }
}
17  Game Development / Newbie & Debugging Questions / Re: LWJGL Lighting problem: All faces have same color on: 2012-03-23 21:00:08

Well, I assumed they'd be calculated from the vertices using the right-hand or left-hand rule. Learning! Trying it out now...
18  Game Development / Newbie & Debugging Questions / Re: LWJGL Lighting problem: All faces have same color on: 2012-03-23 20:54:14
Show us your code.

Did you add normals to each vertex?

There you go:

And no - I didn't know vertex normals were a thing! That might explain a lot! (Can you tell I'm new at this OpenGL thing?)

Anyway, here's the code:

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  
package com;

import com.zarkonnen.lwjgltest.Main;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.lwjgl.util.glu.*;
import org.lwjgl.input.Keyboard;

import java.nio.FloatBuffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

/**
 *
 * @author penguin
 */

public class main {

   public static void main(String[] args) {
      try {
         Display.setDisplayMode(new DisplayMode(800, 600));
         Display.setTitle("3D Pyramid");
         Display.create();
      } catch (Exception e) {
      }
      initGL();

      float rtri = 0.0f;
      Texture texture = null;
      try {
         texture = TextureLoader.getTexture("png", Main.class.getResourceAsStream("tex.png"));
      } catch (Exception ex) {
         ex.printStackTrace();
      }
      while (!Display.isCloseRequested()) {
         // Draw a Triangle :D

         GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

         GL11.glLoadIdentity();

         GL11.glTranslatef(0.0f, 0.0f, -10.0f);

         GL11.glRotatef(rtri, 0.0f, 1.0f, 0.0f);

         texture.bind();

         GL11.glBegin(GL11.GL_TRIANGLES);

         GL11.glTexCoord2f(0.0f, 1.0f);
         GL11.glVertex3f(0.0f, 1.0f, 0.0f);
         GL11.glTexCoord2f(-1.0f, -1.0f);
         GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
         GL11.glTexCoord2f(1.0f, -1.0f);
         GL11.glVertex3f(1.0f, -1.0f, 1.0f);

         GL11.glTexCoord2f(0.0f, 1.0f);
         GL11.glVertex3f(0.0f, 1.0f, 0.0f);
         GL11.glTexCoord2f(-1.0f, -1.0f);
         GL11.glVertex3f(1.0f, -1.0f, 1.0f);
         GL11.glTexCoord2f(1.0f, -1.0f);
         GL11.glVertex3f(1.0f, -1.0f, -1.0f);

         GL11.glTexCoord2f(0.0f, 1.0f);
         GL11.glVertex3f(0.0f, 1.0f, 0.0f);
         GL11.glTexCoord2f(-1.0f, -1.0f);
         GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
         GL11.glTexCoord2f(1.0f, -1.0f);
         GL11.glVertex3f(1.0f, -1.0f, -1.0f);

         GL11.glTexCoord2f(0.0f, 1.0f);
         GL11.glVertex3f(0.0f, 1.0f, 0.0f);
         GL11.glTexCoord2f(-1.0f, -1.0f);
         GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
         GL11.glTexCoord2f(1.0f, -1.0f);
         GL11.glVertex3f(-1.0f, -1.0f, 1.0f);


         GL11.glEnd();

         GL11.glBegin(GL11.GL_QUADS);
         GL11.glVertex3f(1.0f, -1.0f, 1.0f);
         GL11.glVertex3f(1.0f, -1.0f, -1.0f);
         GL11.glVertex3f(-1.0f, -1.0f, -1.0f);
         GL11.glVertex3f(-1.0f, -1.0f, 1.0f);
         GL11.glEnd();

         Display.update();
         rtri += 0.05f;
         // Exit-Key = ESC
        boolean exitPressed = Keyboard.isKeyDown(Keyboard.KEY_ESCAPE);
         if (exitPressed) {
            System.out.println("Escape was pressed!");
            Display.destroy();

         }
      }

      Display.destroy();
   }

   private static void initGL() {
      GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glMatrixMode(GL11.GL_PROJECTION);
      GL11.glLoadIdentity();
      GLU.gluPerspective(45.0f, ((float) 800) / ((float) 600), 0.1f, 100.0f);
      GL11.glMatrixMode(GL11.GL_MODELVIEW);
      GL11.glLoadIdentity();

      GL11.glEnable(GL11.GL_TEXTURE_2D);
      GL11.glShadeModel(GL11.GL_SMOOTH);
      GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
      GL11.glClearDepth(1.0f);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      GL11.glDepthFunc(GL11.GL_LEQUAL);
      GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
      float lightAmbient[] = {0.5f, 0.5f, 0.5f, 1.0f};  // Ambient Light Values
     float lightDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};      // Diffuse Light Values
     float lightPosition[] = {0.0f, 0.0f, 2.0f, 1.0f}; // Light Position

      ByteBuffer temp = ByteBuffer.allocateDirect(16);
      temp.order(ByteOrder.nativeOrder());
      GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer) temp.asFloatBuffer().put(lightAmbient).flip());              // Setup The Ambient Light
     GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer) temp.asFloatBuffer().put(lightDiffuse).flip());              // Setup The Diffuse Light
     GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, (FloatBuffer) temp.asFloatBuffer().put(lightPosition).flip());         // Position The Light
     GL11.glEnable(GL11.GL_LIGHT1);                          // Enable Light One
  }
}
19  Game Development / Newbie & Debugging Questions / LWJGL Lighting problem: All faces have same color on: 2012-03-23 20:48:45
So I've been trying to get the lighting code from penguin's post at http://www.java-gaming.org/index.php?topic=23951.0 to work. (Including the missing GL11.glEnable(GL11.GL_LIGHTING);.

However, what I'm actually seeing is that instead of each face of the pyramid being lit up by an amount depending on its orientation, all faces are lit up by the same amount, which changes as the pyramid rotates. Does anyone have any insight? This is using lwjgl 2.8.3 on Mac OS X.
20  Games Center / Showcase / SpaceGen: A rather silly open source pulp scifi world generator on: 2012-03-13 17:39:16
This isn't quite a game (yet), but an open-source generator for pulp sci-fi settings inspired by How to Host a Dungeon and the Dwarf Fortress world generator. You can view an animated description of the setting's evolution, pause at any time, and export a detailed description of the world as a text file. To try it out, launch the program and keep hitting space to advance, or press R to enter auto-advance mode and come back later. You can move around with the arrow keys and see information about planets by putting the cursor over them.



Download (450 kB jar file).

Example Text Output

GitHub Page (source!)
21  Games Center / 4K Game Competition - 2012 / Re: [WIP] Dawn on: 2011-12-21 19:12:56
OK, just to show it's possible, here's me beating level 3: http://www.youtube.com/watch?v=FupowYzi66o
22  Games Center / 4K Game Competition - 2012 / Re: 4ssassin's Creep: Derivations on: 2011-12-21 07:41:48
I really like this one. Smiley I've never played any of the AssCreed games, but if they're anything like this I'd be almost tempted. If it didn't involve getting a PC or a console or something like that.
23  Games Center / 4K Game Competition - 2012 / Re: [WIP] Dawn on: 2011-12-20 20:34:45
I'm impressed by how much you could get into this game, but how many times do you expect someone has to play it before figuring out a way to win? I have tried it over 10 times now and can't seem to survive for more than about 10 seconds. If I run to a drawer and try to search it the vampire will get me before the search is complete (sometimes I just have time to see the text saying what I found).

Probably good game, bad player, but I would prefer if it was a lot slower. Smiley

Seems like there are only a few possible maps, or do some of them just look similar? I never managed to run very far to explore.

I'm glad you like it. Smiley There's actually only one map, but different starting locations. The trick to winning is to shift around furniture to block doorways, and to shake the vampire's tail: if he sees you going around a corner, he'll go up to there, but if you're not visible from there, he has to start searching the house.

I'll record a session of me evading him for 8 minutes in a bit. Smiley
24  Games Center / 4K Game Competition - 2012 / Re: [WIP] Dawn on: 2011-12-19 21:07:25


It's finished & submitted: http://www.zarkonnen.com/dawn/
25  Games Center / 4K Game Competition - 2012 / Re: 4kForge on: 2011-12-13 08:15:41
no windows?

A windows version would be great, but there are two obstacles:
  • I don't have a Windows machine to test it on. In theory, I can convert the make.sh and startserver.sh scripts to .bats, but I can't test them.
  • You'd have to manually download ProGuard and kzip. I can't legally bundle them into the download, and without curl/wget and other tools, I can't write an automatic downloader.

That being said, if there are volunteers (hint, hint Tongue) for testing and/or help with the .bat syntax, I'll do my best to make a windows version where you just have to download ProGuard and kzip into the right directories.
26  Games Center / 4K Game Competition - 2012 / 4kForge on: 2011-12-12 12:41:56
Given that it took me a long time to figure out how to get a good compression chain working, and even longer how to correctly host the resulting pack200'ed applet, I thought I'd distill what I figured out into an easy-to-use package. Hence, I present you 4kForge: http://www.zarkonnen.com/4kforge/

Once installed, 4kForge lets you compile&shrink your game using a single shell script invocation, and start a server that hosts the resulted .pack.gz with another. 4kForge is available in Linux and OS X flavours, and comes with no warranty of any kind, or guarantee of correct functioning, or guarantee it will not go back in time, kill your grandfather, and cause you never to be born.

Special thanks to pjt33 for his Zip2Gzip and HTTPD programs that make this possible.
27  Games Center / 4K Game Competition - 2012 / Re: [WIP] Dawn on: 2011-12-11 11:06:58

Right, updated the beta version at http://www.zarkonnen.com/dawn/b2.html.

This version is a bit easier (more stamina, less time spent searching and pushing), hopefully no longer sometimes crashes on game restart, and has some more items of scenery (a bed, rugs and flower pots).

I still have about 100 bytes to play with. Suggestions on what to add?
28  Games Center / 4K Game Competition - 2012 / Re: [WIP] Dawn on: 2011-12-11 10:29:55
It happened when a new game started, just after a Game Over.

Almost certainly the code for choosing starting positions, which has since been rewritten. Thanks!

Pretty hard to play Roll Eyes I think you can consider one of my advices: short time in searching or longer stamina.

Definitely. As it stands, the game is very hard for me, and I wrote it. I've already increased stamina by 50%, and may decrease the time taken to search and push things by like 25%.
29  Games Center / 4K Game Competition - 2012 / Re: Indiespot compression not working on: 2011-12-10 18:06:40
Ah, figured it out now! I wasn't actually turning the kzip into a gzip. My updated shown-to-work approach is:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
cp ../src/a.java .

javac -target 1.5 a.java

jar cvfM a.normal.jar a.class

java -jar ~/Downloads/proguard4.6/lib/proguard.jar -injars a.normal.jar -outjars a.proguard.jar -libraryjars /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar -keep public class a -optimizationpasses 9 -overloadaggressively

pack200 --effort=9 --strip-debug --no-keep-file-order -O --no-gzip a.pack a.proguard.jar

kzip -b96 -y a.kz.pack a.pack

java Zip2Gzip a.kz.pack a.kz.pack.gz

ls -la a.kz.pack.gz
30  Games Center / 4K Game Competition - 2012 / Re: Indiespot compression not working on: 2011-12-10 17:45:14
Try the applet tag without the archive having either a .jar or .pack.gz extension (see my example above) as the server automatically adds it.

Sadly not: the error is unchanged.

However, I just tried it with Cave4k's cave.pack.gz, and that does work, so clearly the error is with my jar file. Sad The compression script I'm using (based off yours) goes like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
cp ../src/a.java .

javac -target 1.5 a.java

jar cvfM a.normal.jar a.class

java -jar ~/Downloads/proguard4.6/lib/proguard.jar -injars a.normal.jar -outjars a.proguard.jar -libraryjars /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar -keep public class a -optimizationpasses 9 -overloadaggressively

pack200 --effort=9 --strip-debug --no-keep-file-order -O --no-gzip a.pack a.proguard.jar

kzip -b96 -y a.pack.gz a.pack

ls -la a.pack.gz


Maybe I made some mistake there? Thank you for all your help!
Pages: [1] 2
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (57 views)
2013-05-17 21:29:12

alaslipknot (66 views)
2013-05-16 21:24:48

gouessej (96 views)
2013-05-16 00:53:38

gouessej (93 views)
2013-05-16 00:17:58

theagentd (104 views)
2013-05-15 15:01:13

theagentd (95 views)
2013-05-15 15:00:54

StreetDoggy (141 views)
2013-05-14 15:56:26

kutucuk (163 views)
2013-05-12 17:10:36

kutucuk (162 views)
2013-05-12 15:36:09

UnluckyDevil (172 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.262 seconds with 20 queries.