FANDOM


20130412

An intersection between stairs and a cross-way in a stone-styled dungeon

Dungeons are strongholds, found all over worlds, in many different forms. A common form of dungeon is the single room dungeon, with stone styled dungeons also found.

StylesEdit

The dungeon generator in VC4-Vanilla permits many different dungeon-styles to be avaliable, with different spawn requirements, spawn chances and rooms.

Dungeon Styles in Vanilla:

  • Single room dungeon
  • Stone-wall dungeons (100)
  • Library dungeons (10)

The numbers to the right of the styles indicate the chance that style has of spawning

Dungeon-Style APIEdit

To create a dungeon style, you must create a subclass of ​"vc4.vanilla.generation.dungeon.style.DungeonStyle", your class will look something like this:

package vc4.vanilla.generation.dungeon.style;

import vc4.vanilla.generation.dungeon.WeightedRoom;
import vc4.vanilla.generation.dungeon.room.*;

public class DungeonStyleStone extends DungeonStyle{

	public DungeonStyleStone() {
		addRoom(new WeightedRoom(new DungeonRoomBase(), 15));
		addRoom(new WeightedRoom(new DungeonRoomCorridor(), 20));
		addRoom(new WeightedRoom(new DungeonRoomLeftTurn(), 6));
		addRoom(new WeightedRoom(new DungeonRoomRightTurn(), 6));
		addRoom(new WeightedRoom(new DungeonRoomStairs(), 8));
		addRoom(new WeightedRoom(new DungeonRoomPit(), 5));
		addRoom(new WeightedRoom(new DungeonRoomLibrary(), 2));
	}
	
	
}

The WeightedRoom class tells the generator the chance of this room generating. As you can see, the chance of a Crossways (Base) room spawning is 15/62 (24%), because the chance given for it to spawn is 15, and the total chance is 62. There are several other things you can do with styles:

public void onWorldLoad(World world){
		setBrickId(Vanilla.brick.uid);
		setMossId(Vanilla.mossBrick.uid);
	}

This method "onWorldLoad" is used when a new world is loaded. Use it to set the block ids of the brick and moss in the dungeon, because these can be different per world.

setRoomFailChance(0.45);

This allows you to set the chance a room has to fail spawning. This can be used to keep dungeons small and create empty doorways.

setMaxRooms(12);

This allows you to set the maximum rooms in a dungeon. This is incredibly useful for keeping dungeons small. Failed to generate rooms do not count.

setType(14);

This allows you to set the data value (5-bit) of the brick and moss blocks that can be generated. Useful ones include "4" for stone, "14" for hell-cobble" and "15" for cobblestone"

ChangesEdit

Version Changes
0.2
  • Added dungeon styles
  • Added stone-wall and library dungeons
  • Added library room
  • To prevent small dungeons, there must be more than 8 rooms in a dungeon before rooms will begin to fail to generate
0.1
  • Added dungeon generator
  • Added crossway, corridor, turn, stairs and pit rooms

GalleryEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.