Sign in to follow this  
NukeCorr

Random map generation

Recommended Posts

NukeCorr    159
With C++ This is for RTS How to generate random specific tile areas at random spots? My tiles: 0 - normal ground 1 - rock (tiles where you can only build your buildings on, Dune 2 style) 2 - cliff (only generated on rock tiles, again like Dune 2 style) 3 - resource (collect with havester to gain money) Everything first changed to tile number 0 in the map array The point would be to generate 3-5 areas of rocks (each player starts on one of them) 4 - 6 areas of resources for players to go collect for money some random cliffs on rock areas I have everything else working, set tiles, check if out of map bounds, etc. But just looking for the random map generation method. Thanks in advance

Share this post


Link to post
Share on other sites
Nearsighted    100
I'm not sure I understand clearly. Is your intention to have certain areas of your map be generated with a high volume of of a particular tile, or to have individual tiles randomly dispersed across your map?

Share this post


Link to post
Share on other sites
Nearsighted    100
I see. In that case, I'd have to say my method would be choosing a single tile as the point of origin for the "hot spot", and working out to all of the adjacent tiles, reducing the likelihood that a given tile would be set to the chosen type. I'd imagine determining whether or not a tile passes the check to be transformed into the proper tile would be as simple as generating a random number (say, 5 for starters) and making the tile match the specific type to be set as long as the number is not equal to one. Then, with each move outward from the point of origin, reduce the ceiling for the random number by one. That way, as you move farther from the point of origin, the likelihood of a given tile following the pattern will diminish naturally.

Share this post


Link to post
Share on other sites
Narf the Mouse    322
It's counter-intuitive, but I got rather good results just generating randomly and then converting the tiles based on whatever is around them iteratively. Ie, if a Water tile is surounded by mostly Land tiles, it becomes a Land tile - And vice-versa.

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

Sign in to follow this