Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  The Architect (Voxel Engine)  (Read 6612 times)
0 Members and 1 Guest are viewing this topic.
Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2013-03-23 14:54:38 »

Can I ask you how, or where, you learned perlin noise?

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

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


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

Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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

JGO Coder


Medals: 16



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


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


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

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




Offline Vermeer

JGO Coder


Medals: 16



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

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

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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

JGO Coder


Medals: 16



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


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


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


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


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


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


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




More screenshots on my blog.

Offline matheus23

JGO Kernel


Medals: 106
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?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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

JGO Coder


Medals: 16



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


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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: 5
Exp: 3 years



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

Getting a project done is by far the most hard thing in game development.
Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


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

I didn't do frustum culling. Undecided

Offline marcuiulian13

Senior Member


Medals: 5
Exp: 3 years



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

I didn't do frustum culling. Undecided

Oh, ok...

Getting a project done is by far the most hard thing in game development.
Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« 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

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


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

Offline masteryoom

JGO Coder


Medals: 5
Projects: 2


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 Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


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

@opiop65: No.

@masteryoom: Triangles.

Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #25 - Posted 2013-08-03 08:35:12 »



More voxels = More fun.

- World Size: 512x256x512
- RAM Usage: ~300MB if I use bytes for world storage. ~800MB if I use ints.
- CPU Usage: ~15%

How did I do it?

Two words: Greedy Meshing.

There are a few lighting bugs to fix due to the change, but it works very, very well.

I have had a few different idea on where I should actually go with this game. Sandbox? Survival? Adventure-RPG? etc.
At the moment I'm leaning towards RPG (after seeing that Cube World is now available)

Need to do a bit of work on shaders atm. Especially SSAO.

Oh, by the way, this is my third voxel engine since the start of this project.

Offline Herjan
« Reply #26 - Posted 2013-08-03 09:59:47 »

Still working on this, fun! When my project is finished I will maybe jump also in 3D..

Cube World is really nice game, however, it has really bad sides... You almost don't level up, 2 full days gaming is level 6, you have to be level 300 to be slightly able to do a boss (Oh wait! Its just me, Im noob)... And if you join a multiplayer world, you are level 500 in two seconds, because if others do a boss 99999 kilometers away, you get the experience points also... So the experience systemshit is on all sides the worst (my opinion).
And it gets a big bit boring / taking too long / everything is the same... I only like the veeryyyyy cool graphics.

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #27 - Posted 2013-08-03 11:19:30 »

Cube World is really nice game, however, it has really bad sides... You almost don't level up, 2 full days gaming is level 6, you have to be level 300 to be slightly able to do a boss (Oh wait! Its just me, Im noob)... And if you join a multiplayer world, you are level 500 in two seconds, because if others do a boss 99999 kilometers away, you get the experience points also... So the experience systemshit is on all sides the worst (my opinion).
And it gets a big bit boring / taking too long / everything is the same... I only like the veeryyyyy cool graphics.

I've had problems with CubeWorld, too.

I started playing CubeWorld with a friend, he was mage (healing) and I was Rough, making all the damage and stunning the enemy all the time (which turned out to be the very best combo of classes in the game... we were lucky...).
It takes a lot of time to get from level 1 to level 2, because you can almost only kill enemies, which give you 1 ep (and you need 50), additionally killing an enemy takes a long time and you often die and get no ep at all.

At about level 5 or 6 (I'd say) it got pretty easy. We started doing dungeons, exploring the world and getting tons of ep. It was the most fun part of the whole game. Also, the ep you get on the servers accross the whole map are quests. They give you from 500 to thousands of ep, depending on the level of the best player on the server (I guess? somehow like that).

It stays very fun until about level 32. Then we started creating another player, who stays in the village in an Inn all the time and resets the world when we kill a boss, and our normal characters which killed all the bosses while staying at the same position all the time and resetting until the boss respawned and was a quest, which gave us insanely much ep in a very short time.

I became level 124 in about an hour. It wasn't fun then anymore, because the effects your skills have are inverse exponential. If you have every skill on level 40 and you level them up a level there is probably a 0.1% difference. Also your power, which is the identifier which says you which armor and weapons you can equip. The power level rises inverse exponentially too. So at about power 80, you won't get power that much anymore (only like every 10 levels...) and you need to be level 1000+ to have power 99 and level 4.000.000.000+ to have power 100 ( -.- ).

Cube World is really a mess when it comes to balancing. Very, very, very not fun because of that. But the period from level 6 to level 32 however, was pretty good and really fun Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline DQQAYME

Junior Member


Medals: 1
Projects: 1



« Reply #28 - Posted 2013-08-03 12:50:40 »

Block Picking is working

http://pastebin.java-gaming.org/ddc736e1252 for source.

If I understand you’r code(I may be wrong ^^) you have small bug
Lat say Ray go X+1 Y+0.8 : you check collision every X (x,y) (1. 0.8f), (2, 1.6f) (3, 2.4f)
But you skip Y side collision (1.25f, 1)

Also You create many useless objects that java GC then Delete

=)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
    Vector3Int vec = new Vector3Int(MathUtils.floor(x), MathUtils.floor(y), MathUtils.floor(z));
               
               Block b = world.getTile(vec.x, vec.y, vec.z);
               if(b != null && b.solid)
               {
                  return new Face(b, vec, 0);
               }

               vec = vec.sub(new Vector3Int(1, 0, 0));
               
               b = world.getTile(vec.x, vec.y, vec.z);
               if(b != null && b.solid)
               {
                  return new Face(b, vec, 0);
               }
   


my Fix ^^
   
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
          
       int xii = MathUtils.floor(x);
       int yii = MathUtils.floor(y);
       int zii = MathUtils.floor(z);
       Block b = world.getTile(xii, yii, zii);
       if(b != null && b.solid)
       {
          return new Face(b, new Vector3Int(xii, yii, zii), 0);
       }
   
       xii -= 1;
       b = world.getTile(xii, yii, zii);
       if(b != null && b.solid)
       {
          return new Face(b, new Vector3Int(xii, yii, zii), 0);
       }
   

Offline HeroesGraveDev

JGO Kernel


Medals: 238
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #29 - Posted 2013-08-03 22:56:19 »

That code is wrong. It was from the first evolution of the engine, and wasn't completely finished (although it did work lots of the time). I removed it in the later versions of the engine.

The problem was that the concept was designed for 2D, where there are only 2 axes to check. When rhere are 3, it creates the problem of finding the order in which the ray crosses the axes.

It was also a quick hack, which explains the useless objects.

As for the bug (missing the y side collision), unless I uploaded a buggy version of the code it should work. It (should) check the y coordinates from x to x+1, and if they are different, detect a collision on that face.
However, I can't be sure if the code works as intended, as the Z-axis made things a mess.

Pages: [1] 2
  ignore  |  Print  
 
 

 

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

The first screenshot will be displayed as a thumbnail.

pw (21 views)
2014-07-24 01:59:36

Riven (19 views)
2014-07-23 21:16:32

Riven (16 views)
2014-07-23 21:07:15

Riven (19 views)
2014-07-23 20:56:16

ctomni231 (47 views)
2014-07-18 06:55:21

Zero Volt (43 views)
2014-07-17 23:47:54

danieldean (34 views)
2014-07-17 23:41:23

MustardPeter (38 views)
2014-07-16 23:30:00

Cero (53 views)
2014-07-16 00:42:17

Riven (52 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!