Skip to main content
 Warning: Unmaintained Version
Version: 0.6.1
Difficulty: Normal

Road Network

 Before starting

This guide assumes that you have already installed the Basic Extension.
Also, make sure you have read the layout documentation and created a static page.

Road Networks are essential if you want to make NPCs move around your map or let the player follow a path. In this guide, we will show you how to create a road network and how to use it in your story.

What is the road network

The road network is an internal graph structure that TypeWriter uses to efficiently calculate paths between two distant points.

Creating a road network

First, we need to add a Base Road Network entry to our page. To add it to our page, click on the + icon in the top right corner of the panel and search for base road network then add it to your page by clicking on the + icon.

Add Base Road Network
A definition of the words road network
+

Opening the content mode

In the Base Road Network entry in the inspector, click the blue camera icon next to the ArtifactId field to open the content mode.

Adding a node

Now that we have opened the content mode, we need to add a node. Nodes are points in a world that can be connected to each other using edges. To add a node, in your hotbar select the diamond and right-click it. This will open the node editor. To exit the menu of the node, click the end crystal.

Creating the path

To create a path, you will always need 2 nodes. So create 2 nodes and then select the redstone from your hotbar and right-click it. Now it should look a bit like this:

Now you have created a path. You can expand a road network with unlimited nodes and create paths between them.

 Node placement

It is recommended that you create nodes at the beginning and end of a road or path in your world. This is to save resources on loading and recalculating the edges.

Editing a node

When in the node editor, you have 4 options:

Why is their radius?

When performing pathfinding from node A, all nodes within a 30-block radius will be checked, for example, nodes B, C, D, E, F, and G. If it finds that the path to node C requires passing through nodes B radius, it will stop calculating the path to C. This is because the pathfinding avoids paths that need to skip nodes like B.

road-network radius explanation

How to use?

To change the radius of a node, select the sculk sensor from your hotbar and right-click.

 Node click

When right-clicking an item, you must not point your cursor at the node you are editing. This will open the content mode and not trigger the event.

Then, with your scroll wheel, you can change the radius of a node.

Negative Nodes

Sometimes you want pathfinding to not go via a certain path. For example, when you have a place where the pathfinding thinks it can jump down or up 1 block but shouldn't, you can add a negative node to prevent this.
Here is an example:

How to add a negative node?

You can add a negative node by selecting the netherite ingot from your hotbar in the content mode and right-clicking it.

 Recalculate

You must recalculate the edges using the redstone from your hotbar after adding or removing a negative node

Highlighting nodes

When you have a lot of nodes, it can be hard to see which nodes are connected to each other. To make this easier, you can highlight the nodes that are connected to each other. To do this, select the glowstone from your hotbar and right-click it.

Ending

Now you have learned how to successfully set up the road network.