j3CW-G437S4
Added some basic block picking.
j3CW-G437S4
Added some basic block picking.
That is looking great, lots of features! It all seems to be working well. Great video.
What’s next?
Hi there.
That looks pretty good so far.
How many cubes & chunks in total are in memory (RAM) right now?
256 chunks, 1048576 blocks.
And the next Question:
How big is the memory footprint with 256,1024,2048,4096 and 8192 chunks?
My experimental engine can handle ~16000 16³ Chunks without crashing and a stable framerate of 50 fps.
Im just wondering what your engine is capable of.
PS: Your CHunk counter in the video seems to go a little bit, wrong?
16384 chunks, 67108864 blocks @60 fps. (vsync enabled)
Yay! Your Engine is as fast as mine.
The difference in the FPS comes from my PC.
My PC is a big piece of crap, but im happy with it.
Oh, and i think you forgot something: Memory Footprint.
That’s what im interested in the most.
Looking great @Pauler!
I’ve got an issue in mine now, I’m only rendering chunks when at a certain view distance, this seems to work, but problem is, CPU memory usage goes up on each chunk that gets rendered?!
I am using Display lists, could this be the issue, and this is on my Macbook Pro which has a intel 3000 HD graphics card…
This is how chunks are determined if they are to be rendered or not:
public void render(float x, float z)
{
for(Chunk c : ChunkList)
{
if( (Math.abs(c.getX() * Chunk.CHUNK_SIZE) - Math.abs(x)) < Chunk.CHUNK_SIZE * 3)
{
if( Math.abs((c.getZ() * Chunk.CHUNK_SIZE) - Math.abs(z)) < Chunk.CHUNK_SIZE * 3)
{
c.render();
}
}
}
}
x and z are the players/camera position and getX and getZ return the chunks voxel space position. CHUNK_SIZE is 16. ChunkList is an ArrayList of my chunk objects:
private ArrayList<Chunk> ChunkList = new ArrayList<Chunk>();
And render just does a glCallList.
Thanks
Lists are really slow. You should change to arrays as I did.
Hmmmmm, I believe display lists are just as quick for static data?
My Macbook supports openGL 2.1, VBO’s I believe are supported in this version?
Maybe when I’m rendering, the primitives are still going to the CPU, or, maybe my calculation is incorrect for checking if chunks in view…
I think this is incorrect:
if( (Math.abs(c.getX() * Chunk.CHUNK_SIZE) - Math.abs(x)) < Chunk.CHUNK_SIZE * 3)
{
if( Math.abs((c.getZ() * Chunk.CHUNK_SIZE) - Math.abs(z)) < Chunk.CHUNK_SIZE * 3)
{
c.render();
}
}
Needs further investigation…
Now, that I read my reply again I see that it can also have another meaning. I am talking about the array lists and the arrays not about display lists and vbos.
I am using display lists, too , btw.
Mmmmm, so what are you using instead of ArrayLists, thought this would be ok?
Thanks
I think pauler may mean to use an array for chunkdata rather than an arrayList?
Edit: I didn’t see the 2 above posts, sorry!
Chunk[]
Or Chunk [][][]
So. Chunk[c].render
Would that not mean having a static world with Chunk being a static array?
Thanks
Perhaps the array[][][] is relative to the player in some way.
Could this array have bounds of say [64][16][64]
And if your position gets near the edge, the new chunks are loaded at the other end of the array in a wrap around effect?
This is pure speculation, as I did have mine represent a static world.
But I think I may try that idea and see if it works…
Multiple dimension arrays smell bad…esp with fixed lengths.
I don’t think the bottle neck is the ArrayList, more to do with my distance formula, I’ve now got this:
int deltax=Math.abs((int)x - (c.getX() * 32));
int deltaz=Math.abs((int)z - (c.getZ() * 32));
int deltay = 1;
float distance=(float)Math.sqrt((deltax*deltax)+(deltay*deltay)+(deltaz*deltaz));
if(distance < Chunk.CHUNK_SIZE * 8)
{
c.render();
}
for(Chunk c : ChunkList)
{
int calc = Math.abs((int)(c.getX() * Chunk.CHUNK_SIZE) - (int)Math.abs(x));
if(calc < Chunk.CHUNK_SIZE * 2)
{
calc = Math.abs((int)(c.getZ() * Chunk.CHUNK_SIZE) - (int)Math.abs(z));
if(calc < Chunk.CHUNK_SIZE * 2)
{
c.render();
}
}
}
x and y are player position, c.getX and c.getZ are chunks offset, thus chunk 1 is at offset 0, chunk 2 is at offset 1 * Chunk.ChunkSize, offset 2 is at 2 * Chunk.ChunkSize…
But it seems as I get closer to the chunks they are then not rendered? Kind of like reverse effect?!
That is looking nice.
BTW - do you only hold a certain amount of chunks in memory, i.e. the ones you can see?
Less chunks that I can see.