So I'm Making a Game

Talk about anything in here.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post by jacek »

EcazS wrote:Do it! Do it naow!
Tomorrow :D Actually maybe Saturday (it's the last exam tomorrow and we are going to the pub afterwards :D).

Reason: It needs a launcher to handle the downloading of the correct lwjgl stuff and I haven’t made that yet.
Image
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: So I'm Making a Game

Post by EcazS »

I approve of the pub.
I disapprove of no launcher :(
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post by jacek »

Image

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 :)
Image
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post by jacek »

I have no idea if this will work, http://jacekk.co.uk/Lux/play.html
Image
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: So I'm Making a Game

Post by EcazS »

It works! Huzzahs are in order!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: So I'm Making a Game

Post by Temor »

Now that's cool. I will definitely take a look at LWJGL :)
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: So I'm Making a Game

Post 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?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post 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 ;)
Image
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post 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... :lol:
Image
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: So I'm Making a Game

Post by Temor »

It looks very... light weight... :?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post 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 :D
Image
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: So I'm Making a Game

Post 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 :P
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post 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
Image
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post by jacek »

Nobody amazed by my hashes :(
Image
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: So I'm Making a Game

Post by EcazS »

jacek wrote:Nobody amazed by my hashes :(
Oh sorry, I forgot to post. I was BAFFLED by them!
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post by jacek »

EcazS wrote:Oh sorry, I forgot to post. I was BAFFLED by them!
HOORAY !
Image
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post 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.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: So I'm Making a Game

Post 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?
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post 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.
Image
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: So I'm Making a Game

Post 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.
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: So I'm Making a Game

Post by jacek »

You can now shoot little green lines :D

Image
Image
Post Reply