Skip to main content
gamedev.net
🔒 Locked

Random map generation

Started by NukeCorr Mar 19, 2010 at 9:18 AM 5 replies 800+ views
Original Post
NukeCorr
NukeCorr
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
What the h*ll are you?
Nearsighted
Nearsighted
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?
NukeCorr
NukeCorr
High volumes of a particular tile, not just single tiles at random spots
What the h*ll are you?
Nearsighted
Nearsighted
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.
NukeCorr
NukeCorr
Thanks for the info, I'll try that out :)
What the h*ll are you?
Narf the Mouse
Narf the Mouse
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.