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 Classic Chat / Proof of concept: Voxels using Linear Octree

Author
Message
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 7th Mar 2016 19:54
I've implemented a basic voxel system using a linear octree data structure. The performance is surprisingly good. I'm not interested in remaking minecraft, but it just goes to show what you can do with AppGameKit and a bit of programming knowledge.



Here's the code:



I use a HOTAS joystick for moving around. You may want to tweak the controls for whatever input device you use. You can use the mouse to remove blocks.
Hi. I am a real person (not a bot). I appreciate all replies and advice.
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 7th Mar 2016 20:27
@JohnStabler

Nice piece of code ;o)
I look forward to testing ;o)
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Mar 2016 23:27
That is really nice. Thanks! You're next challenge: Texture the cubes so they look like individual cubes
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Mar 2016 19:16 Edited at: 8th Mar 2016 23:00
Playing around with it, I found the performance drops around 220,000 nodes (1,760,000 blocks). Some of that will be the unoptimised pruning. There's also scope to optimize it so that objects aren't created for nodes that are not yet visible.

I created it for use in a destructible landscape, where block colouring / texturing is calculated based on deterministic factors. It would take some work to create a minecraft like system.

I created it to test the speed of the octree data structure and to test the object count limits.
Hi. I am a real person (not a bot). I appreciate all replies and advice.
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 8th Mar 2016 19:40
@JohnStabler

which version of AppGameKit are you using

1 or 2

if 2 which version

all i get is black screen at this point
with the FPS running at the top

i do not have joystick connected
so changed commands around for the mouse
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Mar 2016 19:45
I'm using v2.0.18.

I just copied the code back in to my IDE and it works for me. Does it work / fail for anybody else?
Hi. I am a real person (not a bot). I appreciate all replies and advice.
Cor
AGK Developer
13
Years of Service
User Offline
Joined: 19th Dec 2010
Location: Its a trap!
Posted: 8th Mar 2016 19:53
Just tried it out and it worked fine for me! Thanks for sharing!
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Mar 2016 21:10
Works great for me. Even with texturing the cubes. Tried on 2.0.16 and 2.0.18.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
JohnStabler
AGK Bronze Backer
11
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 8th Mar 2016 21:21
@CJB Got any screenshots? It's always nice to see improvements on my projects
Hi. I am a real person (not a bot). I appreciate all replies and advice.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 8th Mar 2016 22:54 Edited at: 8th Mar 2016 22:55
Haha... it's no improvement! I just wanted to see how it would behave with textures. To do it properly would require some clever UV tiling with wrapped images, but here's a screenshot anyway

V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Attachments

Login to view attachments
Crazy Programmer
AGK Developer
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Lost in AGK
Posted: 10th Mar 2016 04:09
Sweet snippet you have here
Download My Games for Android. Made with AGK.
Jellyfish Dive- https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_JellyFishSwim
Brick Destroyer - https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_BrickDestroyer
Ping Bong - https://play.google.com/store/apps/details?id=com.CrazyProgrammerProductions.my_Pong_Ping_Bong
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 10th Mar 2016 05:34
@JohnStabler

ok i figured out my mistake ..

it works
i do not own the joystick you own i own a Logitech

when it is plugged in

the camera just drops like a stone


Sph!nx
15
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 10th Mar 2016 14:02
Yes! Tagging in and following closely. I'm very interested in voxel techniques. I've tested your code on V2.0.17 (need to upgrade) and it works great!

Thanks for sharing!
Regards Sph!nx
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 12th Mar 2016 17:24
a dynamic culling method should be very useful Good work!

[/url]

Login to post a reply

Server time is: 2024-09-29 11:32:06
Your offset time is: 2024-09-29 11:32:06