Since quite a few people asked for a tutorial on my procedural world generator, here it is. To be honest I don’t know a lot about procedural generation, I am just wing it as I go, but I manage. The generator Is not yet fully done ,still missing what I call “populate” to add small landscape details, but here is what I got.
PS. In this tutorial I will not who any code, this tutorial is just to show how I’ve managed to create the worlds for my game, for I believe trying to explain how everything in code works would require too much time and would bore the life out of you.
The gist of my generator is a node graph system with delaunay triangulation and a modification of the voronoi diagram of the triangulation.
HOW IT ALL WORKS:
Firstly it adds random points in a confined space and triangulates them
Then it add more points in specific positions to add detail
It removes the points that confined the work space (the 4 outside points)
Again it add more points to add detail
After that I get the voronoi diagram and the shortest spanning three of the triangulation
Finally I remove some of the cell of the voronoi diagram
With the voronoi diagram I then have a plane which I will use for the world surface.
Depending on how many starting points you use, or how many levels of detail you add the result vary.
2D to 3D:
The diagram is only the first part of the problem, now to get it to show it as an actual island I take the voronoi diagram and transform it into a mesh, before I translated the code to C# for Unity I saved them to a OBJ file now I just make a Unity Mesh.
To do so I take every point in the diagram as a vertex and every cell as a face, then I get the outer edge of the mesh and extrude it downward multiple times to make the cliff. The outer edge is also used to make the fence, where every vertex is a post and every edge is the bar between the posts, and to later populate the cliff so to make it more interesting.
Never try to make a world generator at 2 in the morning, it will take more than 2 hours.
If you want to make something procedurally generated Random is your friend.
Use a object oriented language, make objects for everything and keep reference of every point, edge and triangle, this way it’s easier to make the triangulation and later the voronoi diagram.
Be careful on the amount of points, edges, and triangles you have, it takes a lot of time to iterate through large lists and it’s not a good idea to make your player wait too much for your world to generate.
The generator is not yet complete, and in no way the definitive way to make procedurally generated worlds, there are other ways that might be easier to Implement, such as cellular automata, but I found that this method gave me the result I wanted.
I might do a part 2 later on once I finish to the “populate” part of the generator, but for now thanks for reading and have a good day
“You shouldn’t have been there.” He waved his hand, cutting me off. “Stop it. I made the decision to follow you. I could’ve gone to one of the Guards or the Sentinels. Instead, I followed you. It was my choice.” I stared at him and saw he was actually serious. He looked like he hadn’t been sleeping well. I looked away. “I’m sorry… you had to go through this.” “It’s okay, all right? Look. What are friends for if they can’t share a few hours with psychotic daimons? We can look at it as a bonding experience.”
Lui, Nicolò Carnesi, è atteso al varco della conferma dal vivo di un bellissimo disco che ha colorato questo inizio 2012. Gli eroi non escono il sabato, il titolo del disco, noi ve lo proponiamo di domenica. Prima Emil dalla sempre verde Brianza.
#nextarch by @nicolo_galeazzi #next_top_architects #AlvaroSiza #vizinhançabouça
working on Portuguese Pavilion @where_alvaro_meets_aldo for 15th #BiennaleArchitettura2016
Sitting on the railing of the Ponte di Rialto with his legs dangling over above the water of the canal beneath Nicolo stared at the object held carefully in his hands. It was old, cracked in places and crumbling in others, one of the only things Nicolo had taken with him from his human life and two hundred years were catching up with it. A Carnevale di Venezia mask that had belonged to his twin sister but was one Nicolo himself had been more prone to wear around this time every year during the celebration. Sitting there the tip of his finger gently tracing along the lines that had cracked through that mask, Nicolo remembered the first time he’s worn it, he’d been fourteen the first time he’d swapped outfits with his sister, trading his mask for hers, his shoes for her heels and his slacks for her gown. He’d worn his hair long back then and she’d had hers cut short and with the masks to muffle their voices, no one was the wiser, even later in the night when intoxication was at a high and masks were removed in dark alleys, there had been nothing in Nicolo’s painted feminine face that gave him away. He’d been fourteen and at the carnevale celebration the first time he’d kissed a boy and he’d been twenty when he fell in love for the very first time.
They were all dead now, his sister, his lover and the woman he’d married that only ever shared a bed with his twin. Nicolo’s first love, the man he’d have spent the rest of his life with and been forever happy had been murdered right beside him in the bed as he slept, his sister and her partner had been taken form him in the same way, all in the same night, drained by the vampire who’d fed him his blood while he slept who also lost his immortal life that night before Nicolo had even known what had happened or what was happening to him, before he could ever even get the chance to ask him why. A lifetime of love and happiness turned out to only be three years long.
He supposed the vampire that had done it to him was somewhere in Hell now, probably suffering somewhere in Belial’s stink pits, he’d learned a lot about the world and the workings of Heaven and Hell since then but the desire to find the one responsible for ending his human life had faded over time. It wasn’t Hell that Nicolo was sitting there thinking over though, no, it was the workings of Heaven that plagued the mind of this Venetian Vampire. Heaven really wasn’t something that Nicolo had ever thought about until recently, even upon showing up at the Cirque and finding Julian with white wings hadn’t sparked much thought on the subject, call it ignorance or naivety but Heaven hadn’t really existed for Nicolo until the Wilde’s had announced their intentions to take it over and three people had walked right out of those gates and back to Earth…
After his family had died and he’s become what he now was Nicolo had never even thought about getting the chance to one day see them again, he’d accepted his fate to Hell a long time ago and had no desire to change that but now, now it was a real possibility, a possibility that was back on the table and the idea of it terrified him. It terrified him to think that they might have been watching him, it scared him to think about who they might be now but that he could deal with. What he couldn’t deal with was who else was waiting in Heaven for the members of his new family. If seeing his human family again terrified him, the idea of Julian being reunited with Jeremie went so far beyond terror there wasn’t even an noun, verb or adjective he could put to the feeling.
Nicolo had fallen in love with Jules the very first moment he’d seen him but who didn’t. Nicolo had run from Caim and his Coven of Vampires the second time because he wanted something with Julian that just wasn’t possible and knew that the feeling was going to kill him either way. Solomon Julian Ignacio didn’t settle down for anyone, he was so far beyond anything Nicolo could describe, so far above ideals of monogamy, family and relationships that it would have been nothing but harsh cruelty to try and lock him into such a situation. But Julian had settled down with Jeremie and he’d done it willingly, he’d done it because he wanted it. How could Nicolo ever compare to that. He’d met Jeremie once, the spirit, ghost of him, whatever it was had paid him a visit and gifted him that same blade that had then been used to kill Stacey, ironic really, he’d heard even more about the Vampire turned Saint too but it was seeing him that had let Nicolo know how doomed he really was. Jeremie looked like someone who’d walked right off of a fashion runway but still had all that masculine edge that this particular vampire never had and possessed. There was no way that Nicolo could ever match up to that, not just appearance and polar opposite personality but the history that tied Julian and his ex husband together. Husband…
The Wilde’s had taken over the world, alongside Caim they had taken Hell and now their sights were set to Heaven and Nicolo was yet to see them fail at anything. Everyone in his life wanted them to succeed, everyone but that little blonde vampire that was perched on the edge of The Rialto Bridge, holding an old mask in his hands because if there was one thing that Nicolo knew about relationships or his own at least, if there was one thing he knew about true love and love that lasts a lifetime…
…His first had lasted three years and his second had lasted two.