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 / [AGK] Voronoi Tessellation

Author
Message
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st Jul 2018 03:42 Edited at: 21st Jul 2018 03:42
Thanks to TheComet for helping me remember what this technique was called. I first came across it when looking up random terrain generation. The basic idea is having certain spots fixed on map, and the neighboring tiles will match whichever fixed point is closest.
On a 500x500 map and 20 fixed points, I get about 10fps so clearly this isn't something you'd want to do in real time.



Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Attachments

Login to view attachments
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 27th Jul 2018 11:17
I've done something similar to this with a current project I'm working on to create randomly generated levels. I only run the function during the level creation, load screen, than during gameplay the level dosn't change so no need to keep running the function. So I don't think the slow down is an issue in that regard.

Secondly, hope you don't mind me moving the thread, so more AppGameKit peps see this.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 27th Jul 2018 16:53 Edited at: 27th Jul 2018 17:25
Thats so great I had to try this myself and as you know I like doing things with shaders soo....
Demo: Voronoi Tesselation.zip

Attachments

Login to view attachments
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 27th Jul 2018 17:21
Oh very cool abstract looking scene! Be a nice background for an abstract / minimalist platformer or shmup.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Jul 2018 20:00
Or a random territory generator for a Risk type wargame.

Nice
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Jul 2018 22:30
I've never done anything with metaballs before, but I think something similar to this might be the basis for it. If you're getting 1500fps with a shader, then it'd be fast enough to update this in realtime, moving the points around and watching it all change.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
puzzler2018
User Banned
Posted: 28th Jul 2018 07:12


JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 28th Jul 2018 09:29
I use metaballs for quick/simple liquid physics demos. They're fun to play around with.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Jul 2018 23:56
If you refer to the voronoi demo you can move the points already.
If you refer to metaballs, I should have a shader laying around somwhere... i'll search it tomorow.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Jul 2018 09:36 Edited at: 29th Jul 2018 09:38
Here you go... Water physics using Metaballs:
Demo: Metaballs.zip

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 29th Jul 2018 10:10
Wow, you absolute genius


Hope you feeling much better on a side note.

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 29th Jul 2018 10:18 Edited at: 29th Jul 2018 10:19
I didn't play much with the physics setup so I guess there is still much more potential for the water simulation
And I'm back home again...I felt good the whole time but the docs said its bad so...
I guess its good I like programming
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Jul 2018 12:46
That's neat! My issue was always trying to figure out how one would draw the curves when two points meet. A shader would be the only way to go to make this fast enough.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 31st Jul 2018 17:35 Edited at: 31st Jul 2018 17:40
You can think of them as White blobs which you additive blend together, then you only need a threshold at which you make white to a constant color.
Not sure if a second but less costly render pass would be faster ?
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Aug 2018 17:12 Edited at: 21st Aug 2018 14:09
Made a small demo using voronoi tessellation to form random 2D map. Press spacebar to randomize the map. Combine this with an auto-tiling feature and you have random tile maps.
Changing the "areas" constant creates more points of reference for each terrain type, increasing the chance of islands and rivers.

Small update. Use the up/down arrow keys to increase/decrease the number of areas.




More examples here: http://zimnox.com/voronoi/

Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-03-29 10:51:26
Your offset time is: 2024-03-29 10:51:26