Jump to content

  • Log In with Google      Sign In   
  • Create Account


sliders_alpha

Member Since 14 Apr 2012
Offline Last Active Jul 22 2012 03:07 PM

Topics I've Started

VBO or display list?

20 July 2012 - 11:10 AM

Hi,

Fisrt of all this is not just about comparing the 2 tech but also about what I'm going to do.

My purpose is to make a minecraft Clone, each chunk is like mojang cut into 16 display list, when a player remove or add a block then this display list is being re-rendered.

My question is, is it more advantageous to use display list rather than VBO?

From my understanding Displaylist uses CPU power and VBO uses GPU power.
And nowaday we tend to use portable laptop with high end CPU and a lot of ram but with a very low end GPU.

what do you think?
Thanks.

Static is evil, supposedly

17 July 2012 - 04:47 PM

Hi,

So i'm a student in information systems, or to put it more simply java based website for corporation.
Recently I've taken quite some interest in making a minecraft clone, because I like learning new stuff and I want a better minecraft.

I'm working on the graphical engine and I noticed that using a static class containing
  • view distance
  • Sector size
  • installation paths
  • an array of Texture (slick object)
Could be really usefull, instead of having to pass down and down those data.

Now, what do you think? is this a good idea to do this? in my line of work static attributes or classes are considered as evil.
It messes up with our unit testing and mocking.

As my teacher say, if you want to do static classes go back to procedural languages, you are doing objects now.

But this is not a information system, so does these rules still apply?

thanks.

java serializable class, really usefull?

04 May 2012 - 11:25 PM

Hi,
for my game I have to store game sectors, each sector is an array of 16x16x256 byte.

What I did is make a method to write sectors into a single string inside a file named after it's coordinate,
and one to read them and rebuilt my object in RAM.
But my write time is about 65ms and read time 135ms wich is quite long since a scene is composed of 900 sectors..

Then someone told me to use serializable objects instead,
after reading some documentation about it I don't see how to use this.

If I serialize object A,B,C and D then I can only get them back in the same order,
but I need to acces files according to their coordinate, not their storage order.

is it me or the serializable class is not what I'm looking for?

thanks

infinite procedural world

30 April 2012 - 06:39 AM

Hi, I want to make a minecraft clone but I don't know if I'm going in the right way or not.
having never took any game programming courses I might be re-invented the wheel^^

first thing first, my world is stored in a 2D sectors array.
I give the illusion of movement by drawing the world backward when the player wants to go forward.

Posted Image

and here is my Idea for infinite world generation.

Posted Image
(in reality I have a bigger array called cache which contains the world sectors and the sourrounding ones, this cache object is managing hard disk access on it's own to always give to the world quick access to new sectors)

what do you think?

thanks

standart camera code is messing up my world sectors D:

15 April 2012 - 12:38 PM

HI,
my problem is the following, if I only do translation or Y rotation everything looks fine.
But as soon as I do X rotation my sector get "seprarated"

http://www.youtube.com/watch?v=Zq5b6ZJhLSE


this is my init

	private void initGL() {
	
		GL11.glEnable(GL11.GL_TEXTURE_2D);//texture mapping
		GL11.glShadeModel(GL11.GL_SMOOTH);//smooth shading
		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);//couleur de fond noire
		GL11.glClearDepth(1.0);//setup du buffer de profondeur
		GL11.glEnable(GL11.GL_DEPTH_TEST);//permet le test de profondeur
		GL11.glDepthFunc(GL11.GL_LEQUAL); //le type de test de profondeur a faire
		GL11.glMatrixMode(GL11.GL_PROJECTION);//selectrione la matrice de projection	
		GL11.glLoadIdentity();//reset la matrice de projection
		// Calcul l'aspect ratio de la fenetre
		GLU.gluPerspective(
		  45.0f,
		  (float) displayMode.getWidth() / (float) displayMode.getHeight(),
		  0.1f,
		  100.0f);

		  GL11.glMatrixMode(GL11.GL_MODELVIEW);//selectionne la modelview Matrix
		  GL11.glColor4f(1.0f,1.0f,1.0f,0.3f);			  // Full luminosité, 30% Alpha
		  GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE);	  // Blending mode one
		  // met les melleur parametre
		  GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
	}

any problem in it? (projection mode or something)

as for the rendering algorythm, I don't think that there is any problem with it.
since each cube is placed according to the previous one, if one of them is out
of sequence then all of them are..

I made a function that draw cube where I want (from the current position, which is the last drawed cube).
I have 16x256x16 sectors containing 65k cubes
a world is 9x9 sectors large.

I draw the world line by line

world top view
-z
^
|Sec Sec Sec <- World line 3
|Sec Sec Sec
|Sec Sec Sec <-World line 1
|------------------------>x

and a sector is drawed layer by lawer
(see videos)

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////Positioning       
GL11.glRotatef(lookupdown,1.0f,0.0f,0.0f);
GL11.glRotatef(sceneroty,0.0f,1.0f,0.0f);
GL11.glTranslatef(xtrans, ytrans, ztrans);   //starting position
///////////////////////////////////////////////////////////////////////////////////////////////////////////////Drawing
//drawing each sector
for (int zsect=0 ; zsect < displayArea; zsect++)
		{
		 for (int xsect=0 ; xsect < displayArea; xsect++){
			   chunk = world.getSector((short)xsect, (short)zsect);
			   //drawing each layer
			   for(int yc=0; yc<256; yc++){
				   for(int zc=0; zc<16;zc++){
			 		   for(int xc=0; xc<16; xc++){

							 chunk.drawCube(xc.yc.zc,0.5f) //0.5f is a x translation
						  }
						  GL11.glTranslatef(-16.0f, 0.0f, 1.0f); //goes where line+1 of the layer is starting
						 }
						GL11.glTranslatef(0.0f, 1.0f, -16.0f); //goes where layer+1 is starting
					   }
					   GL11.glTranslatef(16.0f, -256.0f, 0.0f); //goes where the next chunk on the line is starting
					 }	
			   GL11.glTranslatef(-(float)(displayArea*16.0f), 0.0f, 16.0f);//goes at the beginning of the next chunk line
		  }


video examples, chunk generation :
http://www.youtube.com/watch?v=2sV-d5cx9oc
world generation
http://www.youtube.com/watch?v=7eNjjiyRQcM

camera code

	private void readAndAct(int delta) {
   //delta is to sync with fps
		if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {	   // Exit if Escape is pressed
			done = true;
		}
		if(Display.isCloseRequested()) {					 // Exit if window is closed
			done = true;
		}

		if (Keyboard.isKeyDown(Keyboard.KEY_Z)) {

			xpos -= (float) Math.sin(heading * piover180) * 0.03f*delta;
			zpos -= (float) Math.cos(heading * piover180) * 0.03f*delta;

		}

		if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
			xpos += (float) Math.sin(heading * piover180) * 0.03f*delta;
			zpos += (float) Math.cos(heading * piover180) * 0.03f*delta;

		}

		if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
			heading -= 0.25f*delta;
			yrot = heading;
		}

		if (Keyboard.isKeyDown(Keyboard.KEY_Q)) {
			heading += 0.25f*delta;
			yrot = heading;
		}

		if (Keyboard.isKeyDown(Keyboard.KEY_PRIOR)) {
			lookupdown -= 0.25f*delta;
		}

		if (Keyboard.isKeyDown(Keyboard.KEY_NEXT)) {
			lookupdown += 0.25f*delta;
		}
		if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
		ypos += 0.05f*delta;
		}
		if(Keyboard.isKeyDown(Keyboard.KEY_C)) {
		ypos -= 0.05f*delta;
		}
		updateFPS();
	}

any idea?

thanks =D

PARTNERS