HytaleModding
HytaleModding
World GenerationWorldgen Tutorial

Graphs System

An explanation of how to use the Graphs system

Written by RedEng Developer
Not Official Documentation

This documentation is written by the community, and is put inside the official documentation section for visibility and accessibility reasons. This documentation is not written, provided, proofread or approved by Hypixel Studios Canada Inc.

Warning

This is a pre-release feature and is expected to be changed and improved upon before the release of Update 6.

What is a Graph?

A parallel to using Graphs would be the Position Cell Noise Density (PCN), so I would encourage experimenting how that density works first! This new Graphs system however allows a lot more control than PCNs! This includes better modification of the positions of points, what outputs you get from them, and most importantly being able to create branches or “Edges” from point to point or in graph's case “Node” to “Node” to be able to create forms of webs or paths between Nodes!

Biome Spheres Showcase

Example Using Graphs

This is my BiomeSpheres Example with a “Biome” per Node with random Edges connecting them! The density, materials, and props were all done through the graph system!

Hytale has also included a few Examples to try out!

Glossary

Most of the terms will be defined in more detail below in the Steps and Definitions. Come back here if a random bolded word shows up!

GraphsContain Content to be used throughout your Biome file.
Content

Contains Density, Material, PropDistributions, and/or Position information.

NodesNodes in Graphs are Positions similar to points in PCNs.
EdgesConnections or branches between Nodes.
Graph PassesProcedures done in a graph to create a final result.
  Positions GraphPassAdds Nodes to the Graph using Position Providers.
  Node Actions

A list of actions to modify nodes, create edges, or define Content.

    Proximity ConnectorThe Action that controls creating Edges between Nodes.
    Node Content

Defines the Density, Material, PropDistributions, and/or Positions information per Node.

  EdgeActions

A list of actions to modify edges or split into Nodes for Content.

    Splitter

Splits up an Edge into a designated amount of Nodes in a line to define content along. This can be used instead of the DistanceFromGraphEdge Density node which may be expensive.

  Node/Edge Selectors

Allows precise control over which Nodes or Edges to perform actions on.

Graph “Connections”

These nodes are how you use Content defined in Graphs inside your Biome file.

Content Layer

This value is the bridge between a Connection and defined Content in a Graph.

Steps and Definitions

Graph Generator

All Graphs start from a Graph Generator. Graphs are created using Passes to define the final output with each type of pass explained below. You can also export and import Graphs to not continuously redefine and re-compute values.

Graph Generator

Nodes

The first Pass is always to create Nodes. This will take in a standard Position Provider same as PCN or PropDistributions to convert these points into Nodes the Graph can then use for further operations.

Position Nodes

Edges

One of the most useful passes is to creates Edges. Edges are created using the “ProximityConnector NodeAction.”

ProximityConnector NodeAction

In this example, the “Range: 75” means all Nodes within 75 blocks of each other will create Edges between each other; “Cap: -1” means there’s no limit to how many Edges will be created; and finally the Node Selector is set to “All” meaning there’s no filter to which Nodes are connected to each other.

Node Content

Now that we have Nodes and Edges set up, let’s make them do something! For this we’ll use the Content NodeAction. This will define the Density, Material, PropDistribution, and / or Positions per Node. For each type of Content (Density, Material, etc.), be sure to assign a Content Layer value! This will be important for later.

Node Content

Here's an example of defining as much Content as we can into Nodes where each Node has a Cylinder defined out of Density, a Gold Material coating the cylinder, with a Dungeon Room PropDistribution placed underneath, with a Position that will be used to point to a chest on top of the Cylinder.

Content
Example

Graph “Connections”

Graph Connections are where you extract the Content you've just defined from Graphs to use in your Biomes. This is where the Content Layer value is important to point to the correct information. Attached to these nodes on the right will be the starting Graph Generator node. (“Connections” is my own personal term for these types of nodes.)

DensityMaterial Provider

Density
Connection

Material
Connection

Prop DistributionsPositions

Prop Distributions
Connection

Positions
Connection

This example continues off of the previous example. Here we are extracting the previously defined Positions Content to place a chest on top of our Density defined Cylinder.

Connection
Example

Edge Content

While defining specific Content per Nodes is cool, we’re here to create some webbing, some connections, and some roads from Edges!

Edges Example

There are 2 ways to define Content along Edges:

Splitter EdgeAction

The first way is to use the Splitter EdgeAction. This will create Nodes along the selected Edges that you can then define Content for. In between each Node, a new Edge is also created.

Splitter EdgeAction

In this example, I’ve created 5 Nodes per Edge and defined a darker stone material to be placed per Node. If you want the Nodes to blend better along the Edges, I recommend upping the “NodeCount” value!

Splitter EdgeAction Example

DistanceToGraphEdge Density

The second method utilizes the new DistanceToGraphEdge Density. This density returns the number in blocks in distance from your created edges. This can be utilized within a large ContentNode Range to utilize this density across the entirety of your Graph.

DistanceToGraphEdge Example

Node/Edge Selectors

What’s really cool about a lot of these Actions, is you can select which nodes or edges to perform these actions on based on a whole set of Selector operations.

All Selector

Selects All Nodes/Edges. Useful for the ProximityConnector if you want to connect all your nodes together!

Selector All

Random Selector

Selects a random subset of Nodes/Edges based on the Seed and Chance.

Selector Random

Node: ConnectionCount

Selects Nodes with a certain amount of Edges, like in this example, more than 1 Edge.

Selector ConnectionCount

Node: Content

Selects Nodes that have an already pre-defined Content assigned to it, so in this example, I’m deleting any Nodes with Content defined by the “IceCaveBiome” tag.

Selector Content

Node: DensityDelimited

Selects Nodes within a range of Density values same as how a FieldFunction PositionProvider would work. In this example, I’m modifying Nodes underneath the Ocean to have “OceanCaves” Content.

Selector DensityDelimited

Edge: Length / Angle

In this example, I’ve combined 2 Selectors! Any Edges that are more than 50 blocks in Length or pointing in the upwards/downwards y direction is being selected which could be useful for creating strips of Caves along the y-axis.

Selector LengthAndAngle

Neighbor Checks

Node->NeighborNodes: Checks all Nodes connected by Edges for their own Selector Conditions.
Node->NeighborEdges: Checks all connected Edges for their own Selector Conditions.
Edge->Nodes: Checks if either or both Nodes creating the Edge match their own Selector Conditions.

Selector Neighbors

The “SelectedNeighborsThreshold” is how many nodes/edges are needed to pass this condition. If set to “-1”, all Neighbors must satisfy their Selector Conditions. These Neighbor Checks are very useful for creating transitionary Nodes and Edges based on what the Content is of neighboring/connected Nodes like removing Ice Caves connected to Lava Caves or creating Lush tunnel transitions towards Lush Cave Biomes.

And / Or / Not Selectors

Finally the logic isn't complete without these Selectors! Use them in combination to be as specific in your selections as you need!

Selector Logic

Node/Edge Actions

Actions aren't limited to creating new Edges, defining Content, and Splitting Edges. Here's a list of some other useful Actions!

Node: Spawner

This Action creates new Nodes within an area around the central Node. This can be similarly attributed to the Cluster PositionProvider. You can also set the new Nodes' Content or set “CreateEdges” to connect these new Nodes to the Central Node.

Action Spawner

Node: Connected Nodes/Edges

This Action will select Nodes connected by an Edge or Edges connected to this Node to perform their own actions. The Ratio value determines the amount of Connected Nodes or Edges to perform the Action on. The Seed will randomize which ones are selected if the Ratio is set between 0 and 1.

Action Connected

Node: ContentCopy

Content Copy will spread the Content listed to Nodes connected by an Edge. If there's a tie of, for example, "IceCave" and "LavaCave" both connecting to the same Node, the seed will randomize which one wins.

Action ContentCopy

Based on all the Nodes so far, there's 3 ways to "spread" out content based on connected Edges.

NeighborNodes NodeSelector

Connected
Example

ConnectedNodes NodeAction

Connected Alt
Example

ContentCopy NodeAction

Connected Alt 2
Example

Edge: Proxy

Edge Proxy is a good way to create offset Nodes from pre-existing Nodes to for example create bridges across islands.

Action Proxy

Before Action Proxy
Before

After Action Proxy
After

Image credit to Ams of Hypixel Studios

Other Actions

Quick fire round as these are mostly self explanatory especially if you've been messing around with other WorldGen features!

Move NodeActionMoves selected Nodes based on a Vector Provider
Jitter2D/3D NodeAction

Jitters the Position of selected Nodes same as the Jitter Position Provider

Weighted NodeActionSelects a random Action to exectute per Node based on the Seed
Empty Node/EdgeAction

A placeholder to do nothing. Most often used with a Weighted NodeAction

Delete Node/EdgeActionRemoves the Node/Edge from the Graph

New Position & Vector Providers

This section includes a look at some of the new Position and Vector Providers also included in this pre-release that may be useful in your Graph creating Journey!

The list is far too long to include here, but I've included an example of using them to set the Y-Value of Positions. This is useful for setting either the Position of Nodes on Graphs or the Positions of Props to the top of your World (without needing a Scanner Prop which is useful for optimization!)

New Providers Example

We also have the new OpposedToGraphEdges VectorProvider! This Provider gives you the Vector that is furthest from all the Connected Edges' Vectors, so for this example of a triangular pyramid, each Node will be pushed further outwards, away from the other Nodes.

OpposedToGraphEdges VectorProvider

Before VectorProvider
Before

After VectorProvider
After

However, on the edge case that the Node is connected on a straight line where the Opposed Vector could be one of many varieties, the results are inconsistent depending on orientation.

Before VectorProvider EdgeCase
Before

After VectorProvider EdgeCase
After

Hytale Examples

River Drainage

This Graph includes an example of an iterative Selection approach to create river branches that branch out from a coast line!

You can find this Example as HytaleGenerator/BiomeAsset/Examples/Example_Graph_River

Rivers Showcase Rivers Nodes

City Roads

This Graph continues off of the previous example by adding Buildings that spawn next to roads near city centers and making sure Road connections don't enter the areas indicated by Bedrock!

You can find this Example as HytaleGenerator/BiomeAsset/Examples/Example_Graph_Road_Layout

Roads Showcase

Mountain Erosion

This Graph utilizes the Density Gradient of the Terrain to only include certain Edges that run alongside the mountain slope and then uses Move Actions with a Simplex noise pattern to create a wavy pattern as the Edges head downwards.

You can find this Example as HytaleGenerator/BiomeAsset/Examples/Example_Graph_Erosion

Erosion Showcase Erosion Nodes1 Erosion Nodes2

Roots

This Graph uses a technique of starting off only creating 1 Node then creating new Nodes by iteratively using the Spawner Action from previous Nodes. It also halfway through switches the Density defined in the Content to be smaller.

You can find this Example as HytaleGenerator/BiomeAsset/Examples/Example_Graph_Roots

Roots Showcase Roots Nodes1 Roots Nodes2

Community Examples

Biome Spheres

This is a showcase example of creating a “Biome” per Node with random Edges connecting them! The density, materials, and props were all done through the graph system!

Link to GitHub Repository - Credit to RedEng Developer

Biome Spheres Showcase Biome Spheres Nodes

Dungeon

This is a Graphs setup for generating a dynamic Dungeon! This Graph contains multiple techniques to get the Dungeon to generate its paths and props, too much to list here right now, but feel free to replace with your own prefabs or define your own pathing GraphPasses!

Link to GitHub Repository - Credit to RedEng Developer

BigRoom Dungeon Showcase BigRoom Dungeon Rooms Showcase


More Examples to come! Feel free to share some of your best work on here for others to play and mess around with!