Prefabs are the essence of reusable structures in Hytale. Think of them as intelligent blueprints that define a construction, whether it’s a small ruin, a village house, a complex dungeon, or even simple decor elements.
These structures are not just blocks, but dynamic entities that can include blocks, specific entities, NPCs, and even predefined interaction points. They are saved as JSON files, describing their composition, size, origin point, and placement rules.
This approach allows content creators to design rich and varied environments with remarkable efficiency, both for procedural world generation and manual construction in creative mode.
The prefab editor
Hytale offers a dedicated prefab editor, providing an isolated environment to build and manipulate your creations. This editor is your blank canvas where you can bring your wildest ideas to life before integrating them into the game world.
Creating your first prefab
The creation process is intuitive and straightforward:
- Initiate an editing world:
Use the command/editprefab new <world_name>to create a new workspace. The name you choose is that of the editing world, which can contain multiple prefabs. - Build your structure:
Let your imagination run wild to build whatever you desire. - Select the area:
Use the selection brush to precisely delimit the area you want to save. - Save the prefab:
Type/prefab save <prefab_name>to save your creation. - Exit the editor:
Use/editprefab exitto return to the main world. - Place your creation:
With the paste brush, press ‘E’ to access the menu and select your new prefab in the “server” category. You can also load it via/prefab load <prefab_name>.
Advanced editor settings
The prefab editor offers several options to refine your building and placement experience:
| Setting | Type | Description |
| Prefab directories | List of paths | Defines folders where the editor will search for prefab files. |
| Recursive search | Button | Enables or disables searching in subfolders of specified paths. |
| Desired Y level | Integer | Specifies the Y coordinate where prefabs will be pasted, useful for precise placement. |
| Blocks between prefabs | Integer | Determines the number of blocks to leave empty between prefabs pasted in a series. |
| Spawn entities and NPCs | Button | Allows choosing if entities and NPCs included in the prefab should be spawned upon pasting. |
| World generation type | Choice list | Specifies the generation context (e.g., “Flat” for flat worlds, with air blocks option). |
| Air blocks below prefab | Integer | (Flat world mode only) Number of air blocks to place under prefabs. |
| Alignment method | Choice list | Defines how the prefab aligns (e.g., by anchor point, by center). |
| Paste axis | Choice list | Specifies the axis on which the prefab will be pasted (e.g., X). |
Mastering prefab commands
Two main commands, /prefab and /editprefab, allow you to interact with your prefabs and the editing environment.
Command /prefab
This command manages the prefab file itself (save, load, delete, etc.).
| Sub-command | Description | Example usage |
| save <name> | Saves the current selection as a prefab. | /prefab save my_cool_house |
| load <name> | Loads an existing prefab into your clipboard for pasting. | /prefab load my_cool_house |
| list | Displays the list of all available prefabs. | /prefab list |
| delete <name> | Deletes a prefab from the file system. | /prefab delete my_old_shack |
| info <name> | Displays detailed information about a prefab. | /prefab info my_cool_house |
Command /editprefab
This command is dedicated to managing the physical prefab editing session.
| Sub-command | Description | Example usage |
| new <world_name> | Creates a new editing world to build a prefab from scratch. | /editprefab new my_new_project |
| load <prefab_id> | Creates an editing world and pastes an existing prefab into it for modification. | /editprefab load abandoned_dungeon |
| exit | Exits the current editing world and saves changes. | /editprefab exit |
| select | Selects the area of the prefab the player is looking at (within a 200 block radius). | /editprefab select |
| save | Saves changes to the current prefab. | /editprefab save |
| saveui | Opens the save interface to manage all prefabs in the editing world. | /editprefab saveui |
| kill | Deletes all entities in the currently selected prefab. | /editprefab kill |
| saveas <name> | Saves the selected prefab under a new name. | /editprefab saveas new_version |
| setbox | Defines the bounding box of the selected prefab. | /editprefab setbox |
| info | Displays general information about the selected prefab. | /editprefab info |
| tp | Opens the teleport interface to a prefab in the editing world. | /editprefab tp |
| modified | Lists all prefabs with unsaved changes. | /editprefab modified |
Prefab anchors
Anchor points are special markers defined within a prefab, essential for its precise positioning or interaction with it.
| Anchor type | Description | Typical use |
| origin | The main reference point for prefab placement. | Initial placement, grid alignment. |
| spawn | Point where an entity or NPC should appear within the prefab. | Creature or character spawning. |
| connection | Points allowing multiple prefabs to connect logically. | Connecting roads, tunnels, or modular buildings. |
| custom | User-defined anchor for specific needs. | Interaction points, quest objectives, etc. |
You can define these anchors using specific commands, like /prefab anchor set <name> [x y z].
Prefabs in world generation
One of the most powerful uses of prefabs is their integration into Hytale’s world generation system. This allows creating rich, coherent, and diverse environments procedurally.
Prefab definition (yaml)
Prefabs are defined via YAML files that specify their structure and behavior during generation.
Type: Prefab
Id: simple_village_house
Size: [7, 5, 9] # Dimensions [width, height, depth]
Origin: [3, 0, 4] # Relative origin point
Palette: # Block definition by character
W: hytale:oak_planks
S: hytale:stone_bricks
G: hytale:glass_pane
D: hytale:oak_door
A: hytale:air
Structure: # The prefab structure, layer by layer
- "SSSSSSS"
- "SWWGWWS"
- "SWWAWWS"
- "SWWDWWS"
- "SSSSSSS"
PlacementRules: # Placement rules for world generation
RequiresSolidGround: true
MinGroundLevel: 60
MaxGroundLevel: 100
AllowedBiomes: [plains, forest]
EntitySpawns: # Entity/NPC spawn points included
- Type: hytale:chicken
Position: [1, 1, 1]
Count: 1Placement rules
Each prefab can have specific placement rules that determine where and how it can appear in the generated world. This includes checks for ground type, altitude, allowed biomes, spacing with other structures, and even terrain slope.
Rotation and variants
To avoid repetitiveness, prefabs support rotation (in steps of 90, 180, 270 degrees) and variants. A prefab group can be defined to group multiple variants of the same prefab (e.g., different sizes of oak trees) and assign them selection weights, allowing natural diversity in the world.
| Rotation option | Angle degrees |
| none | 0° |
| cw_90 | 90° |
| cw_180 | 180° |
| cw_270 | 270° |
Tips and best practices for your prefabs
- Optimize performance: The fewer blocks and entities, the lighter your prefab will be. Be mindful of complexity, especially for those intended for large-scale world generation.
- Define clear rules: Use PlacementRules to ensure your structures appear in coherent and immersive environments.
- Exploit variants: Create multiple versions of the same prefab to introduce visual diversity without multiplying unique definitions.
- Use palettes: Palettes simplify block management and facilitate large-scale material changes.
- Test, test, test: Use the
/prefab loadand/editprefab newcommands to quickly test your creations under different conditions. - Document your anchors: If your prefabs have specific anchor points, document their function to facilitate integration by other creators or for future maintenance.
- Think about scale: A prefab well-designed for a small object won’t necessarily be suitable for an entire city. Adapt your design to the intended scale of use.
Convert a Minecraft build to Prefab
Have you spent hundreds of hours building an epic castle or a detailed city on Minecraft and dread having to start all over on Hytale? Good news: it is possible to transfer your creations!
Check out our dedicated article on the subject to import your Minecraft builds into Hytale.
