Jump to content
  • Advertisement
Magogan

C++ Procedurally generating villages

Recommended Posts

Hi,

I have a procedurally generated voxel (block) world and now want to generate villages. I have structures (houses, townhalls, etc.) and know their size and collision boxes (can be multiple per structure). I also have roads that are already there at this stage and can't be changed - but it is possible to add more roads. The roads don't go straight in one of the 4 directions, they have bends and can go in any direction.

There are groups of structures, e.g. different houses, and each group has a minimum and maximum number of how many of its structures are generated in total per village, e.g. 3 to 10 houses.

I also know the height of the world (obviously) and all nearby objects (collision boxes).

Now my question: How do I determine good positions and orientations (0°, 90°, 180°, 270°) for the structures in the village, such that they are near a road (pre-existing or newly generated)?

I could maybe follow one of the pre-existing roads and generate structures on both sides, but how would I add more roads in some intelligent way instead of just a random direction? My only idea for the roads is to pick a point several meters away from any existing roads and connect it with the nearest road, but I'm not sure if that's a good idea.

Are there any articles or tutorials on this topic? I couldn't find any...

Cheers,

Magogan

Share this post


Link to post
Share on other sites
Advertisement

Hi,

I've been working on some village/town generation recently (although somewhat simpler, as grid based). I did find this article, which may help, with a non grid system  https://gamedev.stackexchange.com/questions/122015/how-to-generate-a-city-street-network 

As for where to put buildings, yes i would probably traverse roads, and where there is adjacent, blank (flat?) terrain, add a building (maybe set one side to be road facing?). 

As for generating new roads, how have you generated the initial road(s)?  As this may determine how best to add extra.

Nick

 

 

 

Share this post


Link to post
Share on other sites

It seems you don't know what rules to apply for your generator. The most important thing is the ruleset.

I wrote an answer some time ago about map generation, maybe this could help ya too
https://www.gamedev.net/forums/topic/692945-creating-a-3d-world-for-an-rpg/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!