HeroesGraveDev
|
 |
«
Posted
2013-03-23 08:04:50 » |
|
This is a toy project. Guardian II is still my main game.     Infinite World or fixed size Simplex Noise Generation with randomized octaves. Lighting. Fog. Basic Movement (For test purposes. Real movement soon). If any of the other people currently making voxel engines (or anyone else) want some help with something, feel free to ask.
|
|
|
|
opiop65
|
 |
«
Reply #1 - Posted
2013-03-23 14:54:38 » |
|
Can I ask you how, or where, you learned perlin noise?
|
No one ever fully understands coding
|
|
|
davedes
|
 |
«
Reply #2 - Posted
2013-03-23 17:10:55 » |
|
Fixed-function or programmable pipeline? 
|
|
|
|
Games published by our own members! Check 'em out!
|
|
|
|
opiop65
|
 |
«
Reply #4 - Posted
2013-03-23 18:34:36 » |
|
Oh woops  Thank you though!
|
No one ever fully understands coding
|
|
|
|
|
Vermeer
|
 |
«
Reply #6 - Posted
2013-03-23 19:58:49 » |
|
That's looks very nice! Thanks for putting that on, it's inspiring. 
|
|
|
|
|
|
|
Vermeer
|
 |
«
Reply #8 - Posted
2013-03-23 21:52:25 » |
|
That is epic, very hilly and some nice formations.
|
|
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Vermeer
|
 |
«
Reply #10 - Posted
2013-03-23 23:11:40 » |
|
Be nice to have the best of both in one world. I'm thinking of using a diamond star algorithm, do you have any advice/thoughts on that?
Also, I take it simplex produces a 2d height map? Are there any 3d implementations?
It's looking great tho. Your obviously drawing lots of faces. Do you know how many?
|
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #11 - Posted
2013-03-25 06:08:28 » |
|
Depends what I set the view distance to.
It works fine for me on 9x9x9 chunks. In fact, lag is caused by chunk loading. I should fix this. Which equals 144^3 potential cubes. Probably (144^3)/2 cubes. Most cubes are invisible. On an almost flat world, there will be 1 cube per x,z coordinate. The cube would have around two faces visible on average.
(144^2)x2 = 41472 faces on an almost flat world.
As for simplex noise generation, I'm still looking for a way to have sections of flat and mountains. You could try multiplying two (or more) octaves (between 1 and -1) and multiplying that by the height.
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #12 - Posted
2013-03-26 07:45:23 » |
|
2 optimisations:
- Uses multithreading for chunk loading. - Blocks are organised in chunks by an array instead of a HashMap of Vectors.
Result:
9^3 chunks (of 16^3) rendered: Uncapped Framerate: ~110fps when loading new chunks, ~160fps when staying in one chunk. RAM usage dropped massively due to less Vectors.
|
|
|
|
|
|
matheus23
|
 |
«
Reply #14 - Posted
2013-03-28 22:30:34 » |
|
- Blocks are organised in chunks by an array instead of a HashMap of Vectors. [...] RAM usage dropped massively due to less Vectors.
You could probably just use a Vector pool, no?
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #15 - Posted
2013-03-28 22:36:16 » |
|
A while ago I made almost all of the vectors immutable and only left mutable ones for things like player position etc If I ever hit problems again I could refactor though.
Thanks for the suggestion, I never thought of that.
|
|
|
|
Vermeer
|
 |
«
Reply #16 - Posted
2013-03-28 22:52:30 » |
|
Looking good with the extra definition provided by the grass/soil texture.
I think I'm going to need some mulithreading for loading! That's next on the list..
What you planning next?
|
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #17 - Posted
2013-03-28 23:16:46 » |
|
Block breaking/building/interacting
I'm currently trying to get it to pick the right block, then I'll move onto getting the right face.
|
|
|
|
marcuiulian13
|
 |
«
Reply #18 - Posted
2013-03-28 23:28:07 » |
|
Can you please tell me how you did the frustum culling? I am trying to do it for last 4 hours, but i can't make it work how it should. Here is how i did the frustum faces loading: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public void update() { FloatBuffer projectionBuffer = BufferUtils.createFloatBuffer(16); glGetFloat(GL_PROJECTION_MATRIX, projectionBuffer); FloatBuffer modelBuffer = BufferUtils.createFloatBuffer(16); glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer);
Matrix4f projectionMatrix = new Matrix4f(); projectionMatrix.load(projectionBuffer); Matrix4f modelMatrix = new Matrix4f(); modelMatrix.load(modelBuffer); Matrix4f viewMatrix = new Matrix4f(); Matrix4f.mul(projectionMatrix, modelMatrix, viewMatrix);
planes[0] = new Plane(viewMatrix.m30 + viewMatrix.m00, viewMatrix.m31 + viewMatrix.m01, viewMatrix.m32 + viewMatrix.m02, viewMatrix.m33 + viewMatrix.m03); planes[1] = new Plane(viewMatrix.m30 - viewMatrix.m00, viewMatrix.m31 - viewMatrix.m01, viewMatrix.m32 - viewMatrix.m02, viewMatrix.m33 - viewMatrix.m03); planes[2] = new Plane(viewMatrix.m30 + viewMatrix.m10, viewMatrix.m31 + viewMatrix.m11, viewMatrix.m32 + viewMatrix.m12, viewMatrix.m33 + viewMatrix.m13); planes[3] = new Plane(viewMatrix.m30 - viewMatrix.m10, viewMatrix.m31 - viewMatrix.m11, viewMatrix.m32 - viewMatrix.m12, viewMatrix.m33 - viewMatrix.m13); planes[4] = new Plane(viewMatrix.m30 + viewMatrix.m20, viewMatrix.m31 + viewMatrix.m21, viewMatrix.m32 + viewMatrix.m22, viewMatrix.m33 + viewMatrix.m23); planes[5] = new Plane(viewMatrix.m30 - viewMatrix.m20, viewMatrix.m31 - viewMatrix.m21, viewMatrix.m32 - viewMatrix.m22, viewMatrix.m33 - viewMatrix.m23); } |
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #19 - Posted
2013-03-28 23:34:12 » |
|
I didn't do frustum culling. 
|
|
|
|
marcuiulian13
|
 |
«
Reply #20 - Posted
2013-03-28 23:44:22 » |
|
I didn't do frustum culling.  Oh, ok...
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #21 - Posted
2013-03-29 01:02:05 » |
|
Block Picking is workinghttp://pastebin.java-gaming.org/ddc736e1252 for source. The Face class is just a Block, the block's position, and a useless integer (supposed to be for finding which face) It was hacked together, so there will be optimisations. Also, it sometimes fails when looking diagonally in all 3 directions. Now I'm working on getting it to find the correct face.
|
|
|
|
opiop65
|
 |
«
Reply #22 - Posted
2013-03-31 03:11:18 » |
|
Do you use occlusion culling? If so, do you use a bunch of rays to test all the blocks? Or how do you do it?
|
No one ever fully understands coding
|
|
|
masteryoom
|
 |
«
Reply #23 - Posted
2013-04-02 08:21:30 » |
|
Is it better to make cubes out of triangles or quads?
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #24 - Posted
2013-04-02 09:15:08 » |
|
@opiop65: No.
@masteryoom: Triangles.
|
|
|
|
|