Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  The Architect (Voxel Engine)  (Read 1291 times)
0 Members and 1 Guest are viewing this topic.
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« 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.

Offline opiop65

Senior Member


Medals: 4


Nishu Studios Dev


« 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
Offline davedes
« Reply #2 - Posted 2013-03-23 17:10:55 »

Fixed-function or programmable pipeline? Tongue

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Agro
« Reply #3 - Posted 2013-03-23 18:24:22 »

this is a pretty good explanation of perlin noise, but heroesgravedev said he used simplex noise Tongue

http://freespace.virgin.net/hugo.elias/models/m_perlin.htm

Offline opiop65

Senior Member


Medals: 4


Nishu Studios Dev


« Reply #4 - Posted 2013-03-23 18:34:36 »

this is a pretty good explanation of perlin noise, but heroesgravedev said he used simplex noise Tongue

http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
Oh woops Tongue Thank you though!

No one ever fully understands coding
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #5 - Posted 2013-03-23 19:44:08 »

Fixed-function or programmable pipeline? Tongue

Programmable. (Although my shaders use the gl_XMatrix uniforms.)

Simplex Noise Article: http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf

Offline Vermeer
« Reply #6 - Posted 2013-03-23 19:58:49 »

That's looks very nice! Thanks for putting that on, it's inspiring. Smiley
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #7 - Posted 2013-03-23 21:43:10 »

I put the FOV up to 90 to get more epic screenshots.




Offline Vermeer
« Reply #8 - Posted 2013-03-23 21:52:25 »

That is epic, very hilly and some nice formations.
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #9 - Posted 2013-03-23 21:57:05 »

With random octaves, you sometimes get nice flat formations too:




(Okay, that last one is a hill, but it's a gentle slope)

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline 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?
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« 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.

Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« 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.

Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #13 - Posted 2013-03-28 22:25:43 »




More screenshots on my blog.

Offline matheus23

JGO Wizard


Medals: 72
Projects: 3


You think about my Avatar right now!


« 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?

Take a look at my development Blog: http://matheusdev.tumblr.com
Also look at my RPG Ruins of Revenge
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« 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.

Offline 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?
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« 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.

Offline marcuiulian13

Senior Member


Medals: 3



« 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);
    }

Check out my current project: http://cube3dev.blogspot.com/
Please comment/review/suggest.
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #19 - Posted 2013-03-28 23:34:12 »

I didn't do frustum culling. Undecided

Offline marcuiulian13

Senior Member


Medals: 3



« Reply #20 - Posted 2013-03-28 23:44:22 »

I didn't do frustum culling. Undecided

Oh, ok...

Check out my current project: http://cube3dev.blogspot.com/
Please comment/review/suggest.
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #21 - Posted 2013-03-29 01:02:05 »

Block Picking is working

http://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.

Offline opiop65

Senior Member


Medals: 4


Nishu Studios Dev


« 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
Offline masteryoom

JGO Coder


Medals: 5
Projects: 3


If you look closely, you might see it turning...


« Reply #23 - Posted 2013-04-02 08:21:30 »

Is it better to make cubes out of triangles or quads?

Smiley
Offline HeroesGraveDev

JGO Wizard


Medals: 63
Projects: 8


Muahahahahahaha...


« Reply #24 - Posted 2013-04-02 09:15:08 »

@opiop65: No.

@masteryoom: Triangles.

Pages: [1]
  ignore  |  Print  
 
 

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (98 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (167 views)
2013-05-12 17:10:36

kutucuk (166 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.202 seconds with 21 queries.