Hey all,
Im working on a voxel engine game and I want to generate random paths throughout the world. I already have random hills and mountains by using perlin noise. But is there some kind of standard algorithm for generating random paths / veins?
Hey all,
Im working on a voxel engine game and I want to generate random paths throughout the world. I already have random hills and mountains by using perlin noise. But is there some kind of standard algorithm for generating random paths / veins?
Hmmm, well there are algorithms but they can be pretty arduous to implement and slow performing.
For a quick solution your best bet might be to create an overlaid grid of waypoints and then connect them based on their reachability to their 8 immediate neighbours. If you modify the world you would update the connection points. After that you would use A* to find your route between them. When you are in the proximity of a waypoint you’d use some simple testing to reach a destination in that neighbourhood.
The other way of doing this is by overlaying a grid and creating full connectivity. Your A* algorithm then adds vertical height change as a cost when it finds a path which will drive your characters to follow level paths where possible - this leads to natural looking behaviour that you can actually prewarm to erode paths and play with textures. I describe a grid based A* here: unitygems.com - unitygems Resources and Information.
I use “The Sims” style advertisments to provide my characters with random destinations. Basically you place objects in the world that advertise their ability to satisfy some need. The easiest of these being “something to do” which just has the character wander there.
You choose an advertisment based on the needs of the character (so if they’re hungry then find food, if they’re bored find something to do), the ability of a location to service that need (so if you’re really hungry you visit a cafe rather than two dozen blueberry bushes) and the distance to the location (so if you are really hungry and next to a blueberry bush you would eat there first, then move on to the cafe).