LWJGL BlockWorld

Don’t take me too seriously, just a pet peeve of mine that most voxel-games after Minecraft seem to use the grass on dirt block that is, literally, Minecraft’s icon :wink:

The reality is that the basic voxel engine will always be very similar to Minecraft until you get to developing more advanced content. Just steer away from creepers and everything will be ok.

I agree with the assertion that voxel engines have many possibilities, my problem with what most people building them does is this:

Is it so hard to try and use textures that aren’t an almost exact match to Minecraft’s?

When at first glance voxel engines (even in development stages) look like Minecraft clones, then it is to be expected that people will think they are clones.

When engines like the one on this thread feel and behave pretty much like Minecraft, up to how broken blocks fall as spinning smaller versions of themselves, then the “I’m doing something different” defense wears thin.

Mind you, it is perfectly fine if you want to make a Minecraft clone as a way to learn stuff (I’m not one to speak of originality myself), but just don’t get pissed when someone inevitably points it out. :slight_smile:

But seriously, people, come up with a different standard block instead of dirt with grass on top.

A Minecraft clone is actually a pretty good way to learn OpenGL and 3D concepts. :slight_smile: Who cares what the product looks like – this is a programming forum, after all.

@oskuro

Thanks for your comments. I will take this in a new direction eventually, like I’m planning water shaders etc. I will try to make the graphics different! But I do take what you mean. Actually part of the idea is replication, it’s like having a specific goal, sure the problems of playability and what makes a good game is solved, but my quest is to try learn how to implement things. And being original, without the underpinning skills is a bit much for me.
In short, it’s a way to focus and solve specific problems.

Thanks Davedes, also thank you for the amazing tutorials on shaders. This is what I’m reading!


Your normal maps in lesson 6 is awesome. :slight_smile:

My tests showed the same so it isn’t as weird as you may think :). Display lists are actually very well optimized in the drivers, so from a performance point of view when rendering is a toss up between the two. Sometimes the one is quicker and sometimes the other. The huge performance gain you get from VBO’s are when doing something that updates. For example, in my game the fps drops with about 10-20% when using VBO’s on my gfx card, but the time it takes to load in the landscape into memory is about 200-400% quicker.

If you want to support all kind of computers you can give the players the option what to use (like minecraft does). If not just take one and go with it, the difference in switching isn’t big enough to rewrite everything.

Mike

Don’t take me too seriously, just a pet peeve of mine that most voxel-games after Minecraft seem to use the grass on dirt block that is, literally, Minecraft’s icon :wink:

The reality is that the basic voxel engine will always be very similar to Minecraft until you get to developing more advanced content. Just steer away from creepers and everything will be ok.

@Vermeer You probably have answered this question, but did you use JBullet for the bouncing blocks that flew into the air when you destroyed a block?

Anyways, looks great, as your dungeon game! :smiley:

@Vermeer You probably have answered this question, but did you use JBullet for the bouncing blocks that flew into the air when you destroyed a block?

Anyways, looks great, as your dungeon game! :smiley:

No, I just used a few vector calculations…


//first I give the blocks random horizontal velocity at a random angle
//when its constructed

this.yVel = 2;
yRot = (float) Rand.nextInt(360);
hVelocity = (float) 1/50f;

//then I do the transformations on each entity like this in the update loop
for(Entity Ent : entities){
		//find the ground level for the entity	
		ground = getGroundLevel(Ent.getX(), Ent.getY(), Ent.getZ());
				
			
		//apply vertical calculation ie, its vertical velocity	
		Ent.setY((float) (Ent.getY()+Ent.getyVel()*TIME_STEP*2));
		Ent.setYVel( Ent.getyVel() +((float) (GRAVITY*TIME_STEP)));
			
		if(Ent.getY()<=ground+0.7f)	{
				Ent.setYVel(-(Ent.getyVel()/4));
					
				Ent.setY(ground+0.7f);
				Ent.sethVelocity(Ent.gethVelocity()/1.8f);
					
				}	
				
//move the enity horizontally
		Ent.setX(Ent.getX() + ((float) Math.sin(Ent.getyRot() * piover180) * Ent.gethVelocity()));
		Ent.setZ(Ent.getZ() + ((float) Math.cos(Ent.getyRot() * piover180) * Ent.gethVelocity()));
				
			
				
		Ent.tick();

//I also check if it needs removing, or if player is near it.

Thanks for your positive comments :slight_smile:

No, I just used a few vector calculations…


//first I give the blocks random horizontal velocity at a random angle
//when its constructed

this.yVel = 2;
yRot = (float) Rand.nextInt(360);
hVelocity = (float) 1/50f;

//then I do the transformations on each entity like this in the update loop
for(Entity Ent : entities){
		//find the ground level for the entity	
		ground = getGroundLevel(Ent.getX(), Ent.getY(), Ent.getZ());
				
			
		//apply vertical calculation ie, its vertical velocity	
		Ent.setY((float) (Ent.getY()+Ent.getyVel()*TIME_STEP*2));
		Ent.setYVel( Ent.getyVel() +((float) (GRAVITY*TIME_STEP)));
			
		if(Ent.getY()<=ground+0.7f)	{
				Ent.setYVel(-(Ent.getyVel()/4));
					
				Ent.setY(ground+0.7f);
				Ent.sethVelocity(Ent.gethVelocity()/1.8f);
					
				}	
				
//move the enity horizontally
		Ent.setX(Ent.getX() + ((float) Math.sin(Ent.getyRot() * piover180) * Ent.gethVelocity()));
		Ent.setZ(Ent.getZ() + ((float) Math.cos(Ent.getyRot() * piover180) * Ent.gethVelocity()));
				
			
				
		Ent.tick();

//I also check if it needs removing, or if player is near it.

Thanks for your positive comments :slight_smile:

Update

I finally made some textures! 2 colours of fog, sky box, movement tweaks.
Sounds still wont record :frowning:

8LZJfpM7MKM

Update

I finally made some textures! 2 colours of fog, sky box, movement tweaks.
Sounds still wont record :frowning:

8LZJfpM7MKM

Update

Using shaders now. Added Scrolling water effect, and discarding fragments.
Added glass with translucency, and Leafs with transparency.
Water now scrolls slowly.

I can post the shaders if anyone would like them- but they are only basic.

hKn1Q-mU8EE

Update

Using shaders now. Added Scrolling water effect, and discarding fragments.
Added glass with translucency, and Leafs with transparency.
Water now scrolls slowly.

I can post the shaders if anyone would like them- but they are only basic.

hKn1Q-mU8EE

Looking great!.
Opacity is really anoyying to implement, thumbs up that you managed to fix that.

Looking great!.
Opacity is really anoyying to implement, thumbs up that you managed to fix that.

Oh yes please, post the shaders! Would be awesome to study them while I’m learning how to do shaders myself!

Oh yes please, post the shaders! Would be awesome to study them while I’m learning how to do shaders myself!

Yea, opacity can be a pain. Hopefully is sorted!

Shaders…http://pastebin.java-gaming.org/aacfa371065

In your java program - to communicate with the shaders you use the uniform variables:-

glUseProgram(shaderProgram); 

	int loc = GL20.glGetUniformLocation(shaderProgram, "u_texture");
	GL20.glUniform1i(loc, 0); 
			
	int loc1 = GL20.glGetUniformLocation(shaderProgram, "iGlobalTime");	
	GL20.glUniform1f(loc1, f); 	 //f is a float that is based on a counter or delta time
	    
	 //set scroll mode to 1 (scroll) 
	int loc2 = GL20.glGetUniformLocation(shaderProgram, "scroll");		    
	GL20.glUniform1i(loc2, 1);

//Do rendering stuff


glUseProgram(0); //stop using the shader program


				

This example instructs the shader to enable the scrolling for the water. You need 2 textures in the texture atlas adjacent to each other horizontaly.

Yea, opacity can be a pain. Hopefully is sorted!

Shaders…http://pastebin.java-gaming.org/aacfa371065

In your java program - to communicate with the shaders you use the uniform variables:-

glUseProgram(shaderProgram); 

	int loc = GL20.glGetUniformLocation(shaderProgram, "u_texture");
	GL20.glUniform1i(loc, 0); 
			
	int loc1 = GL20.glGetUniformLocation(shaderProgram, "iGlobalTime");	
	GL20.glUniform1f(loc1, f); 	 //f is a float that is based on a counter or delta time
	    
	 //set scroll mode to 1 (scroll) 
	int loc2 = GL20.glGetUniformLocation(shaderProgram, "scroll");		    
	GL20.glUniform1i(loc2, 1);

//Do rendering stuff


glUseProgram(0); //stop using the shader program


				

This example instructs the shader to enable the scrolling for the water. You need 2 textures in the texture atlas adjacent to each other horizontaly.