Hi Scratchers,
I am trying to make a world generator.
Here are some facts:
What type?: Planetary (Completely 360 World Generator), 2D
ow many types of ore? 5: Diamond, Gold, Granite, Rock, and Soil
Should some be rarer than others? How much rarer?: It's in order from rare to most common
Should the rarer ores be more common as you go deeper? Yes they should.
Offline
This looks amazingly similar to another thread I've seen today. Anyway, something like this will store it in an array:
delete [all v] of [grid v] set [i] to (0) repeat ((width) * (height)) change [i v] by (1) set [depth v] to (round((i/width)-[0.5])) set [# v] to (pick random (1) to ((depth)*(100))) if<(#) < [40]> // play around with these numbers for rarity. add [dirt] to [grid v] else if<(#) < [170]> add [stone] to [grid v] else if<(#) < [200]> add [granite] to [grid v] end end endJust keep adding more if statements in order of least rare to most rare. You'll get a grid that is basically 2 dimensional. To access an item on the grid, use this:
(item (((y)*(width))+(x)) of [grid v])item zero has the coordinates (1,0) (remember, "y" begins at zero, and "x" begins at one)
Last edited by MoreGamesNow (2012-04-03 21:01:13)
Offline