Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / Minecraft like Voxel Engine

Author
Message
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th Aug 2020 21:36 Edited at: 10th Aug 2020 18:23
Minecraft like Voxel Engine
This time done right



So this is a work in progress and everything is subject to change.
You can find the source code to play with on Github: AppGameKIt-VoxelEngine
Right now you can:
•Dig and Build fluently at 4k FPS (tested on RTX 2070)
•Define Different Block types and their textures for each face inside the face indices.txt
•Generate different Terrain and Caves using the included noise library

Some Screenshots of the development progress.







I encurage you to find my two major bugs which are:
Blocks being dublicated from the chunks three zero coordinates and put at the chunks max coordinates leaving ghost blocks begind. [Solved]
And the memblock setup for a chunk Object is is somehow wrong which results in the very last vertex of the very last triangle being at the chunks origin:

Then there are just things on the todo list like:
Fixing the texture atlas seams between blocks.
Generate terrain on the fly.
Beautify and revise the code.
Explore different Culling and Greedy meshing algorithms.

Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Aug 2020 22:55
looks great and i am getting somewhere between 750 fps and 950 fps on my machine

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Aug 2020 23:02 Edited at: 10th Aug 2020 00:29
Superb as usual Janbo.
Frustum culling would be cool too
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Aug 2020 23:11 Edited at: 9th Aug 2020 23:20
dunno if my feeble machine could digest it but would love to try

meanwhile, at a glance: is this a typo?

IE, should it be Indices? if not, my apologies

good stuff, janbo.
[AGK Resource Directory] | [TGC @ GitHub]
[My Itch.io Home]
[CODE lang=AGK] Your Code Here [/CODE]
[VIDEO=youtube] VideoID [/VIDEO]
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 10th Aug 2020 08:19
@Blink0k: AGK's Frustum culling should work as every 16x16x16 block is one Chunk and one chunk is also one object, so the chunks behund you for example should not be considered for rendering.
@Virtual Nomad: Good find thanks, I guess one can find even more typos. The Terrain doesnt need bones obviously so I'll remove it entirely.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Aug 2020 08:22
Ok then. Very cool.
Have you done any testing on multiple objects vs one big model?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 10th Aug 2020 11:51 Edited at: 10th Aug 2020 12:25
@Blink0K: I have tested larger chunks (16*256*16) and (32*32*32) while they render just fine it results in a tiny lag when digging or building which needs to generate the mesh again.
16*16*16 seems fine for rendering and generating...but I didn't test the sweet spots much, so I could imagine a 24*24*24 or some other dimensions being better FPS wise and also fast in generating the mesh.
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 10th Aug 2020 21:42 Edited at: 10th Aug 2020 22:00
Looks great so far.

~ 30 FPS on the OUYA with AGK-Player broadcast.

Attachments

Login to view attachments
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 11th Aug 2020 08:46 Edited at: 11th Aug 2020 08:50
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 11th Aug 2020 19:29
I fixed all bugs. which means I can concentrate on Ambient Occlusion, Lighting, on the fly Terrain Generation and other things.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 11th Aug 2020 22:39
Wow that is fast, 170/200 fps on my old laptop with that much 3D.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 12th Aug 2020 14:05 Edited at: 12th Aug 2020 14:07
And it can still get faster (greedy meshing)
I implemented Voxel based Ambient Occlusion.
It just checks the neighbours for every face vertex again and darkens it the more surounding blocks there are.

Attachments

Login to view attachments
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 23rd Aug 2020 01:40
"•Dig and Build fluently at 4k FPS (tested on RTX 2070)"

An RTX 2070 - I should hope so!! Lol.
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 23rd Aug 2020 12:29 Edited at: 23rd Aug 2020 12:30
Quote: "I implemented Voxel based Ambient Occlusion.
It just checks the neighbours for every face vertex again and darkens it the more surounding blocks there are."

Brilliant, in more than one way.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 23rd Aug 2020 15:23
Very nice stuff janbo....playing around with it just now


PSY LABS Games
Coders don't die, they just gosub without return
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd Aug 2020 17:09 Edited at: 23rd Aug 2020 17:24
Thanks, may I remember you: you can contribute to it
There is a DC link too.

Quote: "An RTX 2070 - I should hope so!! Lol."

Actually it doesn't matter what Graphics card you have for regenerating the mesh as this happens mostly on the CPU, but this statement shows that the Mesh Generating happens so fast I cant notice a fps drop even at 4k fps.
not picking on you Santman...info for all ^^
Also note it's easier to loose more FPS(absolute) in higher FPS rates than it is on lower.
But I aslo I didn't capture the time to generate the mesh... maybe thats something one of you can do ?
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 23rd Aug 2020 17:59
I would say the GPU is hugely important - the quicker the render takes place, the less noticable CPU delays will be.

Watching this with interest - your graphics tech demos are always impressive, but never seen how you tackle things like AI and actual game content. Sure you'll knock this out the park, cant wait to see it develop.
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 1st Sep 2020 14:14
Thanks, and keep up the good work
http://www.nyan.cat/index.php?cat=pirate
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 3rd Sep 2020 16:18 Edited at: 3rd Sep 2020 16:22
@Santman: Building the mesh takes the same time if at 400 or 4000 Frames per second but the drawing frames takes less time at higher frames than at lower frames, thats the definition of FPS, so far so good.
If we now halt the whole process, the time building the mesh needs, we loose more potential Frames at higher FPS than at lower FPS.

So one Frame at 400FPS takes 0,0025 seconds and a Frame at 4000FPS takes 0,00025 seconds and lets say Updating the Mesh takes 0.0025 second.
For the 400FPS its only double the frame time but for the 4000 FPS its eleven times the frame time.
And note all calculations using the current and last frame time can get screwed up

And here is a preview of what I'm working on right now.
Testing Iterative Floodfill algorithm to spread light to neighbouring Voxels
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 7th Sep 2020 19:48 Edited at: 7th Sep 2020 21:37
Today I outsourced the noise calulation to the GPU which was the part that took the longest in the chunk exploring process.
I render a slice of the 3D simplex noise into a 2D image and read the values via memblock.
I hopoe to further increase the performance by rendering all 16 slices of a chunk into one bigger atlas texture so I have less render calls for the rendertarget and can calculate the slicing inside the shader too.
I could really use threading here

Just a random image I took testing the 3D noise stuff (caped at 30 FPS)

Attachments

Login to view attachments
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 3rd Oct 2020 16:57 Edited at: 3rd Oct 2020 17:01
I'm still working on it from time to time
Still hoping some more people join the team
Even if this feature was just a test:
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 3rd Oct 2020 23:32
Looks good.
What size are your blocks and what is the physics scale?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 4th Oct 2020 22:42
Cube size is 1 and physics scale is 5, can be smaller I guess
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 4th Oct 2020 23:51
Yeah, 1 is a pretty small scale
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 5th Oct 2020 15:47 Edited at: 5th Oct 2020 16:39
It has the positive site that the Cubes have the same Array indices as their psoition.
Although I don't use it to calculate the indices or vice versa but it also means it's easier to have "far lands" which are one integer far away.
But at the moment I cant get so far as I allocate array space for it without deallocating some, which means I crash AppGameKit at a 256x256x256 wide,heigh and deep array ^^
Not bad but also not good

Maybe I make the cubes 16x16x16 units big so one Fragment(Texture Pixel) is one unit ^^
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Oct 2020 21:16
I think larger cubes will prevent that "shake" you get when they align
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 6th Oct 2020 08:49 Edited at: 6th Oct 2020 08:50
True, but it was just for fun I don't plan anything special with the Engine.
I also made an explosion that cuts a shere into the terrain and throws the cubes around using physics, just cause a friend challanged me to it ^^
I have a HalfFaceSize# Variable that defines the cube size but not sure if it works out of the box, so the Cube size is up to the game designer
@blink0k: maybe join the team VoxelEngine Discord Channel
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 8th Oct 2020 00:26
Quote: "Still hoping some more people join the team"


That's the problem with being so much better than the rest of us.....we're probably all just assuming you dont need the help. Lol.
Yeshu777
4
Years of Service
User Offline
Joined: 26th Feb 2020
Location: Cymru
Posted: 8th Oct 2020 03:54

This looks pretty impresive Janbo, great work!

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th Oct 2020 17:27 Edited at: 9th Oct 2020 17:29
Thanks for the kind words ya all.
Lets say I'm better and dont need help, which I think isn't true, discuss, emty the mind over problems and talk about features is fun and helps too.
And it motivates me and the other three probably too, to see some more attention.
Also don't be afraid, we work with github and even if you push an empty project folder we can undo it within few clicks
So again... feel free to join us !
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 18th Nov 2020 14:32 Edited at: 22nd Nov 2020 12:50
Hey guys here is a quick update,

it somehow got past me that the newsletter where this project got featured already was relesed, so here it is: Newsletter 25
I got the plugin to Multithread noise working already and am working on infinite terrain with good progress.
I attach the Plugin here and maybe create a new thread and add some features to it later: OpenSimplexNoise.zip

Voxel Lighting

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-03-29 10:46:36
Your offset time is: 2024-03-29 10:46:36