Rpg dungeon generator algorithm
If we take the water lake generation we can see that the (range) functions is being called systematicly when it tries to place water lakes: The random value is calculated like this:Įverytime a structure is generated, it will call the random function in order to place blocks or generate coordinates for instance. In the game each chunk has a random seed value associated with it in order to place structures, decorations, lakes randomly. Everytime the random function is called it will generate a need seed from the old one and it will output a random number. the numbers will have no links between them but if you take the same seed you will get the same random numbers, that's why from the same seed you get the same world in minecraft.
#RPG DUNGEON GENERATOR ALGORITHM GENERATOR#
A pseudo-random generator is a generator that will output the same numbers from the same seed. The generation uses a pseudo-random generator, called a RNG (the java random number generator). also do other things: add animals, snow and ice) (new WorldGenDungeons()).generate(this.worldObj, this.rand, blockPos.add(x, y, z)) //dungeon Generation.īiome.worldDecoration(this.worldObj, this.rand, new BlockPos(posx, 0, posz))
![rpg dungeon generator algorithm rpg dungeon generator algorithm](http://d289qh4hsbjjw7.cloudfront.net/rpgmaker-20150825031853275/files/dungeons-volcanoes-tile-pack-left.png)
(new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, blockPos.add(var14, var15, var16)) (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockPos.add(x, y, z)) ((long)chunkX * j + (long)chunkZ * k ^ ()) Public void populate(IChunkProvider chunkProvider, int chunkX, int chunkZ)īlockPos blockPos = new BlockPos(posx, 0, posz) īiomeGenBase biome = (blockPos.add(16, 0, 16)) Unpopulated chunks The chunk population ĭuring this step, Structures, lakes, dungeons, and finnaly terrain decoration(trees, grass, ores, granite.) are added to the chunk Finnaly once the structure is placed, the game will populate the chunk when the player will get close enough from the chunk and will -if the location and the structure is correct- create a dungeon.Ĭhunk population and chunk seed The Chunk creation ĭuring the first phase of generation, when the chunk is created, the game generates the stone, the dirt, the sand, the caves, the water and the lava, (notice that lava at y level ~11 is generated during this step whereas lava lakes and water lakes are generated during population.)
![rpg dungeon generator algorithm rpg dungeon generator algorithm](https://i.imgur.com/9TsZluP.gif)
Building the machine that pushes a certain structure into unloaded chunks at a precise locations is the most tedious part of Spawner Generation.
#RPG DUNGEON GENERATOR ALGORITHM MOD#
Having a mod or tool to predict the locations of apparition of the dungeons and building the convenient structure for the generation will force the game to generate dungeons at the population process.īuilding the structure into an unpopulated chunk requires the player to be far away from the chunk, that's why a device that put blocks far away from the player is required, flying machines or pistons bridges are used for this purpose. It will also generate all the structures of the game, the last structure in the overworld that is being generated is dungeons.ĭungeon generation does depend on the seed of the chunk and also on the blocks that are at the location at where the dungeon is trying to be placed. In the second step the game will add ores, lava and water lakes, and trees for example, this step is called the 'chunk population' since it is the step which is adding life to the chunk. Actually the generation is composed of two steps, first the game will generate the block, such as stone, dirt, sand, etc. Spawner generation uses the fact that the game does not generate the dungeons at the same time as generating the blocks.
![rpg dungeon generator algorithm rpg dungeon generator algorithm](https://d289qh4hsbjjw7.cloudfront.net/rpgmaker-assets/product_sale_images/images/medium/spacescifi_screenshot2.png)
3.1.1.2 chest generation and spawner placement.