Page 2 of 4
Re: So I'm Making a Game
Posted: Thu May 31, 2012 10:52 pm
by jacek
EcazS wrote:Do it! Do it naow!
Tomorrow
Actually maybe Saturday (it's the last exam tomorrow and we are going to the pub afterwards
).
Reason: It needs a launcher to handle the downloading of the correct lwjgl stuff and I haven’t made that yet.
Re: So I'm Making a Game
Posted: Thu May 31, 2012 10:55 pm
by EcazS
I approve of the pub.
I disapprove of no launcher
Re: So I'm Making a Game
Posted: Sun Jun 03, 2012 8:55 pm
by jacek
Not much but you can actually do something now, the little red box in the middle of the screen is the player. It always looks in the direction of your mouse and can move forward and back.
I will now try to make it an applet
Re: So I'm Making a Game
Posted: Sun Jun 03, 2012 9:45 pm
by jacek
I have no idea if this will work,
http://jacekk.co.uk/Lux/play.html
Re: So I'm Making a Game
Posted: Sun Jun 03, 2012 10:25 pm
by EcazS
It works! Huzzahs are in order!
Re: So I'm Making a Game
Posted: Sun Jun 03, 2012 10:43 pm
by Temor
Now that's cool. I will definitely take a look at LWJGL
Re: So I'm Making a Game
Posted: Sun Jun 03, 2012 11:16 pm
by bowersbros
I can't get it to run on my laptop
It just freezes as soon as it loads.
Gives me an fps of 489. maybe that has something to do with it?
Re: So I'm Making a Game
Posted: Sun Jun 03, 2012 11:58 pm
by jacek
bowersbros wrote:Gives me an fps of 489. maybe that has something to do with it?
That's pretty low considering the amount of geometry. The applet loaders seems really buggy or something, I've made some big changes since then so I'll make a proper downloadable version for the next one
Re: So I'm Making a Game
Posted: Mon Jun 04, 2012 12:00 am
by jacek
Temor wrote:Now that's cool. I will definitely take a look at LWJGL
It's actually really easy
For example, here is the really simple code to render the "player"
// build VBO
this.dataVBOId = ARBVertexBufferObject.glGenBuffersARB();
this.indexVBOId = ARBVertexBufferObject.glGenBuffersARB();
int intSize = Integer.SIZE / 8;
int floatSize = Float.SIZE / 8;
int doubleSize = Double.SIZE / 8;
this.vertexSize = doubleSize * 3;
this.normalSize = doubleSize * 3;
this.colourSize = floatSize * 4;
this.totalVertices = 8;
this.VBOElementSize = this.vertexSize + this.normalSize + this.colourSize;
int totalDataSize = this.VBOElementSize * this.totalVertices;
int totalIndexSize = intSize * this.totalVertices;
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.dataVBOId);
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, totalDataSize, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
ByteBuffer dataBuffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, ARBVertexBufferObject.GL_WRITE_ONLY_ARB, totalDataSize, null);
// base
dataBuffer.putDouble(-20).putDouble(20).putDouble(0.1);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1);
dataBuffer.putDouble(20).putDouble(20).putDouble(0.1);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1);
dataBuffer.putDouble(20).putDouble(-20).putDouble(0.1);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1);
dataBuffer.putDouble(-20).putDouble(-20).putDouble(0.1);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(1.0f).putFloat(0.4f).putFloat(0.4f).putFloat(1);
// gun
dataBuffer.putDouble(-6).putDouble(26).putDouble(0.2);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1);
dataBuffer.putDouble(6).putDouble(26).putDouble(0.2);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1);
dataBuffer.putDouble(6).putDouble(4).putDouble(0.2);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1);
dataBuffer.putDouble(-6).putDouble(4).putDouble(0.2);
dataBuffer.putDouble(0).putDouble(0).putDouble(1);
dataBuffer.putFloat(0.4f).putFloat(1.0f).putFloat(0.4f).putFloat(1);
dataBuffer.flip();
ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB);
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, this.indexVBOId);
ARBVertexBufferObject.glBufferDataARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, totalIndexSize, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
ByteBuffer indexBuffer = ARBVertexBufferObject.glMapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, ARBVertexBufferObject.GL_WRITE_ONLY_ARB, totalIndexSize, null);
for (int i = 0; i < this.totalVertices; ++i){
indexBuffer.putInt(i);
}
indexBuffer.flip();
ARBVertexBufferObject.glUnmapBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB);
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
// render VBO
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.dataVBOId);
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, this.indexVBOId);
GL11.glVertexPointer(3, GL11.GL_DOUBLE, this.VBOElementSize, 0);
GL11.glNormalPointer(GL11.GL_DOUBLE, this.VBOElementSize, this.vertexSize);
GL11.glColorPointer(4, GL11.GL_FLOAT, this.VBOElementSize, this.vertexSize + this.normalSize);
GL11.glPushMatrix();
GL11.glRotated(this.lookAngle, 0, 0, -1);
GL11.glDrawElements(GL11.GL_QUADS, this.totalVertices, GL11.GL_UNSIGNED_INT, 0);
GL11.glPopMatrix();
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
See, simple...
Re: So I'm Making a Game
Posted: Mon Jun 04, 2012 1:47 am
by Temor
It looks very... light weight...
Re: So I'm Making a Game
Posted: Mon Jun 04, 2012 2:34 pm
by jacek
Temor wrote:It looks very... light weight...
Light weight does not necessary mean less code. The above could be done with about 20 lines, all of the extra is creating a buffer in the GPU memory so that the geometry is read from there, making it super fast
Re: So I'm Making a Game
Posted: Mon Jun 04, 2012 2:43 pm
by Temor
That sounds reasonable. I always figured light weight stuff would be light weight from the start, i.e small filesizes, instead of making the output light weight. But it does seem like the smarter thing to do
Re: So I'm Making a Game
Posted: Tue Jun 05, 2012 8:42 pm
by jacek
Since everyone is SO curious about the MD5 hashes for the files you can now view them here
http://jacekk.co.uk/Lux/md5.php
Re: So I'm Making a Game
Posted: Wed Jun 06, 2012 3:06 pm
by jacek
Nobody amazed by my hashes
Re: So I'm Making a Game
Posted: Wed Jun 06, 2012 4:39 pm
by EcazS
jacek wrote:Nobody amazed by my hashes
Oh sorry, I forgot to post. I was BAFFLED by them!
Re: So I'm Making a Game
Posted: Wed Jun 06, 2012 4:48 pm
by jacek
EcazS wrote:Oh sorry, I forgot to post. I was BAFFLED by them!
HOORAY !
Re: So I'm Making a Game
Posted: Thu Jun 07, 2012 12:22 am
by jacek
Launcher made:
http://jacekk.co.uk/Lux/LuxLauncher.jar
It will handle downloading the necessary library files and all that boring stuff. Download it and run it with your favourite JVM.
The changes since the applet version are not that interesting, I put a limit on the turning speed and added some basic collision detection for the walls. The location of the wall blocks is still totally random so you might get stuck in one it it spawns at 32,32.
Re: So I'm Making a Game
Posted: Thu Jun 07, 2012 6:58 am
by bowersbros
jacek wrote:Launcher made:
http://jacekk.co.uk/Lux/LuxLauncher.jar
It will handle downloading the necessary library files and all that boring stuff. Download it and run it with your favourite JVM.
The changes since the applet version are not that interesting, I put a limit on the turning speed and added some basic collision detection for the walls. The location of the wall blocks is still totally random so you might get stuck in one it it spawns at 32,32.
Why not make it so that it can't spawn at 32,32? Or you spawn randomly, and do a check for if there is a block there?
Re: So I'm Making a Game
Posted: Thu Jun 07, 2012 8:17 am
by jacek
bowersbros wrote:Why not make it so that it can't spawn at 32,32? Or you spawn randomly, and do a check for if there is a block there?
Because the random blocks are not how the levels will actually be, they are just there so I can test the collisions and pathfinding when I get to enemies.
Re: So I'm Making a Game
Posted: Thu Jun 07, 2012 12:58 pm
by bowersbros
jacek wrote:bowersbros wrote:Why not make it so that it can't spawn at 32,32? Or you spawn randomly, and do a check for if there is a block there?
Because the random blocks are not how the levels will actually be, they are just there so I can test the collisions and pathfinding when I get to enemies.
Ah okay.
Re: So I'm Making a Game
Posted: Sat Jun 09, 2012 12:51 am
by jacek
You can now shoot little green lines