Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

607 Good

About nukomod

  • Rank

Personal Information

  • Role
  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. nukomod

    Planet Generation Plans

    You guys are spot on about dividing up the space. I didn't realise at first that tetrahedrons don't tessellate in 3D space, it would have been great if they did. The picture of the sphere where you can see inside is quite misleading isn't it! Gnollrunner I'm playing with some options now, which includes some with prisms, seems I may be going down the same route you did Do you have any links related to what you did?
  2. Hey all! This time I'm going to write a little about my plans for generating planets. This entry won’t go into any specific details of the terrain generation but will be just a very high level overview of the basic framework. I don't think any of the ideas in here are new.. the procedural generation community are a very clever bunch indeed! I'm always amazed how when an idea pops into my head I'm able to find an existing article about it that goes into fine detail on the subject. Anyway let's crack on! Heightmaps & Voxels When it comes to generating terrain an easy first choice is to generate height maps and build the terrain mesh from that. You can get some good looking results quickly by overlaying some noise generation and tweaking things here and there. Though these can give some nice results they have limitations. For example tunnels and overhanging terrain can’t be represented in a simple height map. You also have to choose a projection scheme to map a 2D height map onto a sphere. There’s another approach to terrain generation using voxels and that’s what I’m aiming to use. With voxels you can define all sorts of complex terrain and you can define what’s hiding under the ground too - whether it's seams of coal, ore or underground rivers. Many games use voxel terrains to great effect such as the infamous Minecraft. Sign me up! In Minecraft the voxels are arranged in a grid, keeping everything nice and simple.. until you want to model a whole planet. Then you’d get something like this: Though that does look really cool, I don’t want my worlds to be great big cubes floating in space, so what do I do? There are all sorts of solutions to building a spherical world from a voxel grid, but they seem to be full of difficult space warping, caveats and rendering complications. I’d rather not deal with these kinds of complications, so I’m going to try a different approach. Instead of arranging the voxels in a grid I’m planning to arrange them as points on a geodesic sphere like this (imagine the vertices are voxel points): It’s like taking the space warping issues you’d need to do at the cubes edges and spreading it evenly across the entire surface of the sphere. Instead of it becoming a difficult edge case it becomes a constant low level annoyance and keeps things consistent at all times. It will make the mesh generation a little more fun later too Voxel Planet Generation The plan is to use an icosahedron as a starting point. Each vertex here is a voxel. This can be considered the lowest possible Level Of Detail (LOD) of a planet. The space is chopped up into tetrahedrons from the planet surface into its core. There is an extra vertex at the centre of the planet for this. These tetrahedrons can be subdivided through to the core of the planet as required. These illustrations are somewhat misleading though as this isn’t just generating a spherical mesh, but a bunch of voxels that could be empty space. The voxel points (vertices) hold information about what's actually in the space they occupy, whether it’s atmosphere, rock, magma etc. It is the job of the terrain generator to define what a voxel contains. I'm going to keep a clear divide between the planet voxel generation code and the terrain generation code this way. I have some uncertainties on how to best manage the subdivisions of the planets voxels as required, but I’ll bash it out in a prototype. Dynamic Changes The game also needs to be able to make permanent changes to the terrain during play. Large explosions should create craters and I want them to persist. To do this I will need to be address the voxels and save state changes about them. I'm not 100% sure on the approach for this yet either. One train of thought is to basically create an algorithm for the voxel generation that that is able to assign each possibly generated vertex a unique 64bit number. That would have no waste and allow the maximum number of voxels, and some napkin math makes me believe it would have good detail on earth sized planets. Another approach could be some kind of hash of their XYZ or polar coordinates, though that will be more wasteful so it’d bring the total addressable voxels way below what a 64bit unique id could theoretically hold. Ok that’s enough for now!
  3. I've being progressing a few random things. Generators That Don't Make Models First up I added a JSON visualiser so I can browse the output of generators that don't create 3D models. There will be plenty of these kicking about. I'm using JSONViewer by Roman Makudera to do this for now. In the future I may roll my own version though that can have knowledge about unit types. For example, in the image above "age" is in years, and the height values would be in metres. That kind of information is lost with the current viewer. Height Map I've also started playing with generating a height map. I'm not planning on doing any terrain work with height maps but I just wanted to see how easy it was to do in ThreeJS. Below is a totally random terrain with random vertex colouring. It was quite straight forward to setup - nice one ThreeJS Voxels I want to build my actual terrain using voxels so I can get more realistic results. It's a lot more complicated but it'll be worth it. Above is simply a cube space filled randomly with voxels. I'm not doing anything clever in the rendering yet for generating the mesh. Each voxel is it's own ThreeJS cube. Ultimately the terrain is going to be more like no mans sky than minecraft - that is it's represented with voxel data but the mesh generation won't render it all with just cubes. Next I'm going to continue playing with the terrain generation using voxels, so I'll likely implemented some 3D noise generators. I have a bunch of terrain generation articles bookmarked from over the years so it'll be loads of fun to finally play with making some of my own
  4. nukomod

    Debug Text

    Having decent tools to debug the generators is crucial. One of the tools I always like to have is lots of debug rendering features. Putting debug text in the world is a big part of that, so I need ThreeJS to do that for me. ThreeJS has some nice stuff built in but I don't want to add dependencies on font files. My typical workflow right now is loading my generator test bed HTML file from explorer straight into Chrome. Chrome isn't a big fan of loading stuff like fonts from local file storage unless you load chrome with a particular command line argument which is not suited to how I'm working. So to keep it simple no fonts please. So I decided to just make a simple 'font' defined as line segments and put together a helper to add debug text to the world using ThreeJS LineSegments geometry. And I kinda like the way it looks Bonus: Note that the £ is missing here. That's because of an awkward HTML character encoding issue. I need to tell Chrome about the encoding of my JS files. I'll get around to that soon!
  5. This video is showing early work on my procedural generation test bed. Everything is in javascript using ThreeJS and ThreeCSG. 0:00 - Starts with a cube generator and overriding its input parameters to change it's size. 0:12 - Showing a geometry subtraction test. This uses ThreeCSG. 0:20 - A tiled floor generator. 0:27 - A 'modular' room generator. These would be simple rooms that are made from a standard tile shape - think board games. 0:39 - A stone wall generator that follows a path to build the wall. I'll try to record progress with these every so often. It's always fun seeing how things progress
  6. I've shifted the project from C++ to JavaScript during this prototyping phase. I've done this for a few reasons: This makes the project incredibly portable, allowing me to work on it on different devices easily. Prototyping in JavaScript is easy. Threejs is cool and easy to use. I'm a C++ coder at heart and my ultimate goal is for this to be a C++ project. Pragmatically it hasn't been working for me using C++ for my home projects for the last few years. I find myself needing to upgrade projects and libraries, worry about build processes, ensure Visual Studio is installed on the device etc. Now I can now edit generation scripts almost anywhere, anytime, event on my smart phone. Those little moments of downtime can be much more productive I'll take the project to C++ once it has matured - though it will continue to support JavaScript generation scripts so hopefully with a little work I won't have to throw anything away.
  7. A good while ago I stumbled across this video on youtube about a theory that the earth grew in size and the tectonic plates 'float' on top of this expanding sphere. [media][/media] Now despite this being somewhat scientifically questionable it did get me thinking that it might be fun to model a procedurally generated world using this technique. Typical procedural generation techniques using perlin noise or similar often lead to quite random looking continents: (Apologies if these are your images and you don't like me referencing them!) This approach can get good results, but it's easy to just get noisy terrains. Leveraging the 'expanding' earth idea I'm going to build a model for fun where a verlet cloth sits on an expanding sphere. The cloth will become the terrain of the planet and I'll see if I can get it to 'rip' in nice ways as the sphere expands. One approach I'll try is to randomly assign each of the points on the cloth parameters such as mass or friction, and randomly assign the strength the links have to adjacent points. When the stress on the links reaches a critical point they can 'rip' free. The remaining cloth can be considered land and the rest sea. Another approach could be to 'inject' cloth into the stress points as the sphere grows, and allow the cloth to exist with a height on top of the sphere, allowing wrinkles as material builds up. Then a sea level can be chosen and the coast lines would be a result of that. I think it's an interesting idea, I'll post pictures of any results I may come up with. If nothing else perhaps it will give others a new idea to play with too
  8. nukomod

    Argh, bitrot.

    It's twisted enjoying another mans debugging pain but I admit I did! I guess I love a good mystery, but it's even better when it gets solved. Please let us know how the next debugging session goes!
  9. nukomod

    Brain dump: considerations for organizing code

    Have you seen code bubbles? I think their approach may be of interest to you.
  10. nukomod

    Big Procedural Game Dev

    Pictures marking the development of my 'Big Procedural Game' :)
  11. This time I'm giving an update on the status of the code itself. It's still early days but at the moment I've been working on mesh generation helper code. The first mesh generation function I have working is for geodesic spheres, a cool piece of geometry! It's built from an icosahedron as the base which then has each triangle tessellated to the level of required detail. Each new vertex is then projected back on to the surface of the sphere to complete the job. I'm not generating UV coordinates yet, just normals. There are lots of uses for these guys and they have the cool property of evenly distributing surface area across the faces. [sharedmedia=gallery:images:5534] The process of creating and rendering this mesh is proving out the renderer and scenegraph behind the scenes which is cool. It's also using my framework for generating and storing meshes. I want this process to be asynchronous in the near future. I'll go into more detail on future posts, but I don't think it's anything particularly new or exciting.
  12. nukomod

    Dynamic Narrative in The Hit

    Great overview. I'm working on something similar myself buy you've clearly taken it further. I hope you'll write more articles in the future showing some more the technical details. Hope all goes well with your project!
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!