# Pipecraft Pipes, ducts, cable trays and cables drawn in the viewport, for Unreal Engine 5.6, 5.7 and 5.8. Elbows, tees, flanges, caps and supports fit themselves. Everything works the same placed in the editor or spawned while the game runs, and replicates to every client. - **Pipes** bend at every spline point, change size, branch into tees and crosses, and hold on to the nearest wall, floor or ceiling with supports. Built as a mesh, or from a kit of static meshes. Five kits come with the plugin. - **Ducts and cable trays** are pipes with another section: a rectangular duct that never twists through its bends, and an open tray that lays a bundle of cables along its bottom. - **Cables** hang as real cables do, between any two points or actors, and sway in the wind in the material. Switch on physics and a cable becomes a rope: it falls, swings, rests on what it touches, can be cut and reeled, lifts a load and tows a vehicle. - **For the game:** a line graph that says what is connected to what (a pump to a tank, a generator to a lamp) with valves and switches, a route finder that lays a pipe round walls by itself, a preview pipe for building games, and save and load of what the players built. On top: a draw mode with typed lengths and surface snapping, valves, gauges and tags held on a pipe, baking to Nanite static meshes, instances or a Blueprint, and a setup check. Windows. Measured on the development PC, UE 5.8, in the editor, with other work running, so the times are on the high side: | | Time | |---|---| | 1,000 pipes built from nothing | 2.8 s | | The same 1,000 pipes with one of them moved (only what changed is built again) | 9 ms | | A route found round a 10 m wall | 26 ms | | An 8 m rope simulating, a step (60 a second) | 0.1 ms | | The same rope asleep | 0.0003 ms | | 20 ropes laid on each other, a step of all, until they fall asleep | 5 ms | ## Quick start: a machine room in 10 minutes 1. Enable **Pipecraft** and restart the editor. 2. Pick the **Pipecraft** mode in the modes menu (next to Landscape and Foliage). In its panel set **Kind** to **Pipe** and **Pipe Profile** to `/Pipecraft/Kits/Industrial/DA_PPC_Kit_Industrial`. 3. Click on the floor to place points. The second click makes the pipe, each click after it adds a corner. Points sit 50 cm over what you click. **Enter** finishes. 4. Start a second pipe on the side of the first and draw it away: it joins with a tee. Start one at the end of another: they join with a coupling. A click within 3 m of a pipe's end or centerline snaps to it. 5. Hold **Ctrl** and click a wall: the pipe runs along it, its supports bolted to the wall. 6. Type `250` before a click: the next piece is exactly 2.5 m long. 7. Set **Accessory Mesh** in the panel to `/Pipecraft/Accessories/SM_PPC_ValveWheel` and **Alt+click** the pipe: a valve wheel stands on it, without cutting it. 8. Pick another kit in the panel, hover over the pipes and press **K**: every pipe joined to the one under the cursor changes kit. 9. Click **Check Setup** in the panel and fix what the Message Log lists. 10. Press Play. The pipes are there on every client. ## Drawing in the viewport | Input | What it does | |---|---| | Click | Adds a point. The second one makes the pipe or the cable | | Ctrl + click | Adds a point along the surface clicked (wall, floor or ceiling), the pipe's half size plus **Surface Gap Cm** off it | | A number, then click or Enter | The next piece is that many centimeters long, toward the cursor. Up to 1 km | | Shift + click | Picks the pipe corner or end under the cursor. The next click moves it, with every pipe joined there; Esc lets go | | Alt + click | Puts the panel's **Accessory Mesh** on the pipe clicked | | K | Gives the panel's profile to the whole run of pipe under the cursor | | B | Bakes the run of pipe under the cursor to a plain actor (see Baking) | | Backspace | Takes the last point away, or the last digit typed | | Enter or Esc | Finishes the pipe or the cable | | Ctrl + Z | Undoes point by point | The panel sets what a click draws (**Pipe** or **Cable**), the profile for pipes and the style for cables, how high points sit over what you click (50 cm for pipes, 600 cm for cables), the snap distance (3 m), and **Straight Segments** for sharp corners instead of a curve. A blue line runs from the last point to where the next would go, and the keys are written in the corner of the viewport. Its buttons: **Bake All Pipes**, **Check Setup**, and **Rebuild Everything** after a wall or a floor the supports hold on to has moved. The same drawing is in Blueprint and Python as `PPC Drawing`, point by point, each point its own undo step. ## Pipes A **Pipecraft Pipe** is a spline whose points are corners, each turned with an elbow 1.5 times the pipe's size. A spline point's **Scale Y** sets the size from that point on, with a reducer where it changes. ### Profiles `PPCPipeProfile` is a Data Asset with everything about how a pipe looks: - **Shape**: Round, Rectangular (a duct) or Tray. **Diameter Cm**, or **Width Cm** and **Height Cm**. **Round Sides**. - **Bend Radius** in pipe sizes (1.5 is a long elbow, 1 a short one) and **Bend Sections**. - Flanges on both sides of every elbow and reducer (**Flanges At Fittings**) and every **Flange Every Meters** (6 m) of straight pipe. - **End Type** for an end that meets nothing: Open, Cap or Flange. - **Supports** every **Support Every Meters** (4 m) of straight run. Each one looks for the closest floor, wall or ceiling within **Support Reach Cm** (3 m) and makes a clamp, a rod and a base plate. - **Material**, **Fitting Material** and **Support Material**. One profile serves any number of pipes. A pipe without one is a 30 cm round pipe. ### Ready kits | Kit | Profile | | |---|---|---| | PVC | `/Pipecraft/Kits/PVC/DA_PPC_Kit_PVC` | Thin white plumbing, 10 cm, short elbows with socket hubs | | Industrial | `/Pipecraft/Kits/Industrial/DA_PPC_Kit_Industrial` | Painted steel, 30 cm, bolted flanges, two straight variants | | Large | `/Pipecraft/Kits/Large/DA_PPC_Kit_Large` | An 80 cm trunk line, flanges with 12 bolts, stiffening rings | | Duct | `/Pipecraft/Kits/Duct/DA_PPC_Kit_Duct` | Galvanized ventilation duct, 60 x 40 cm, a seam every 1.2 m | | SciFi | `/Pipecraft/Kits/SciFi/DA_PPC_Kit_SciFi` | Dark alloy, 30 cm, heavy collars with glowing bands | | Tray | `/Pipecraft/Kits/Tray/DA_PPC_Kit_Tray` | A cable tray, 30 x 8 cm, open on top | Every kit uses instances of one material, `M_PPC_Surface`, with no textures: **Color**, **Metallic**, **Roughness**, **Wear** (darker, rougher patches over the world) and **Emissive Color**. Copy a profile or an instance to change it. ### Joins The pipe network (a world subsystem) looks at every pipe a moment after one changes, and joins them: - **Tee**: a pipe ends within 10 cm of another's side. The main pipe gets a sleeve, or the kit's tee when the branch comes in square and the same size. - **Cross**: two pipes end on the same spot of another from opposite sides. - **Coupling**: two pipes end together. Turn **Join Pipes** off on a pipe to keep it apart. Joins rebuild only the pipes they touch: a pipe is built again only when something it is built from changed. **Move Joint** on the network (Shift + click in the draw mode) moves a corner or an end with every pipe that meets there, and the branches on the runs that moved follow along them. **Set Profile On Network** gives a profile to a pipe and every pipe joined to it (K in the draw mode). ### Accessories **Accessories** on a pipe are static meshes held on its runs without cutting it, each with a distance along the pipe, a roll round it and the pipe size it was made for (it scales with the pipe). **Add Accessory At** puts one at the place on the pipe nearest a location; **Remove Accessory** takes it off. They replicate and go into saves. Three come with the plugin, made for a 30 cm pipe, in `/Pipecraft/Accessories`: `SM_PPC_ValveWheel`, `SM_PPC_Gauge` and `SM_PPC_Tag`. An accessory is only a mesh: a valve that shuts the flow is **Set Carrying**, below. ### Straight variants A profile's **Kit Straight Variants** are more straights the same length as **Kit Straight**. Each length of a run takes one of them, picked by the pipe's **Variant Seed**, the same on every build and every client, so a long run doesn't repeat. The Industrial kit has two: a weld band and two clamps. ### Your own kit A kit is a profile with static meshes for its pieces: - **Kit Straight**: a length of straight pipe along X, laid end to end and stretched a little to fill each run. - **Kit Elbows**: elbows with sockets `In` and `Out`. A corner takes the one whose angle is within **Kit Angle Tolerance Degrees**; other corners get a built elbow. - **Kit Tee** with sockets `In`, `Out` and `Branch`, **Kit Cap** with socket `In`, and **Kit Flange** centered on its pivot. Sockets sit at the openings with X pointing out of the piece. **Kit Size Cm** is the pipe size the meshes were made for; they scale by the pipe's size over it, so one kit serves every size. A piece left empty, or missing a socket, is built instead, and Check Setup says so. ## Ducts and cable trays A **Rectangular** profile makes a duct. It stays level through its bends: it never twists, whatever the corners do. A **Tray** profile makes a channel open on top, **Width** by **Height**, its bottom and sides **Tray Wall Cm** thick. It takes elbows, supports and joins like any pipe. **Lay Cables In Tray** lays a number of cables side by side on its bottom, following it round its bends, each a little off straight so they don't look ruled. **Get Centerline** gives the line down any pipe's middle, round its elbows, with its up at each point, to lay something of your own along it. The tray's ends are open, its walls ending in a face, and the cables in it are still cables, one actor each. ## Cables A **Pipecraft Cable** hangs between the points of its spline, each span as a catenary set by: - **Slack**: percent longer than the straight line (2% by default); - **Sag**: drop at the middle of each span; - **Tension**: pull in newtons and weight per meter, like a power line. It is a tube or a **chain** of links. **Wind Sway Cm** sways the middle of each span in the plugin's cable material, the ends never moving; any material reading UV channel 1 can do the same. **Attach Point To** holds a spline point to another actor, at a socket or bone or at its root, with an offset. In the editor the cable follows when you move the actor, and undo takes it back; in the game call **Rebuild Cable**, or simulate it. **Collision** makes a still cable or chain block like any mesh; it is off by default. ### Physics Tick **Physics > Simulate** and the cable becomes a rope in the game, starting at rest in its hanging shape: - **Free End** lets the last point hang, like a rope down a wall. - It rests on the world and on other cables, and pawns and physics bodies push it aside. Held points follow their actors. - **Cut At** cuts it, **Reel** lets it out or pulls it in at **Reel Speed Cm Per Second**, **Add Impulse** pushes it, and **Break Stretch Percent** has the server cut it where it is pulled too far. - **Pull Held Bodies** (on by default) makes a taut rope pull the physics bodies that hold its points: a crate hangs from it, a negative **Reel** lifts the crate like a winch, a rope between two vehicles tows one with the other. **Get Tension Newtons** reads the pull, 980 N for 100 kg hanging still. - It sleeps when nothing has moved for a second and costs nothing then. It wakes when a held point moves, something comes near, or it is cut, reeled or pushed. - Each machine simulates it from the same start, anchors, length and cuts, so it looks the same everywhere without sending its points. A client joining late gets the rope as long and as cut as the server's. Simulated cables don't block and are not baked. ## Routing a pipe or a cable by itself **Route Pipe** and **Route Cable** take a start and an end and lay the pipe or the cable round what is in between, with square bends: connecting two machines is one call. **Find Route** gives only the corners. - The route keeps **Clearance Cm** from anything that blocks, and a bend costs **Turn Cost Cm** of length, so it prefers long straight runs. A pipe widens the clearance and the grid to fit its own size. - **Allow Diagonals** adds 45 degree runs. - It looks no farther than **Margin Cm** past the box around the two ends and gives up after **Max Steps**, so a route that doesn't exist costs a known time. - Put the two machines in **Ignored Actors** when the route should start and end on them. It works in the editor and in the game; on a server, what it lays reaches the clients like any other pipe or cable. ## What is connected to what: the line graph **Get Line Graph** gives every pipe and cable of the level as networks. Pipes are joined where the network joined them. Cables are joined where a point of one is within 30 cm of a point of another, or where the same actor holds both. - **Are Connected**, **Get Connected Lines**, **Get Network Id** and **Get Networks** answer what is joined to what. - **Set Carrying** on a pipe or a cable shuts it: the network splits there, like a shut valve or a switch turned off. A cut cable carries nothing. - Add a **Pipecraft Connector** component to a pump, a tank, a generator or a lamp, at a pipe's end or a cable's point. Its **Supply** gives to the network, a negative Supply takes. **Is Supplied** is true while the network gives something and at least as much as is taken, **Is Connected To** says whether two connectors share a network, and **On Network Changed** fires when any of that changes. - A connector touching two pipes, or two cables, joins them while it carries: put one between two pipe ends and **Set Carrying** on it is a valve. Every machine works the graph out from what it has, so clients read the same networks as the server. The graph counts and compares; it does not simulate flow, pressure or direction. ## Building in the game `Spawn Actor` a Pipecraft Pipe or Cable on the server, set its spline points and profile, and call **Rebuild Pipes** (or let the network rebuild on the next frame). The clients build the same; a client joining late gets everything as it is. Profiles, kit meshes and materials have to be assets to reach the clients. ### Preview **Set Preview** with a material makes a pipe a preview of one about to be placed: drawn whole in that material, blocking nothing, joining no pipe, not sent to the clients and left out of the line graph. **Set Preview Color** tints it (green where it fits, red where it doesn't) and **Is Path Blocked** says whether something of the world is in its way, other pipes left out. `M_PPC_Preview` is a translucent material ready for it. Show the preview on the player's machine while they aim, then spawn the real pipe on the server. **Set Preview** with none makes it a pipe again. ### Save and load `PPC Save Library`: - **Save To Slot** and **Load From Slot** write and read a save slot in one call. - **Capture Save** and **Apply Save** give a save object, to keep inside a save game of your own. With **Only Spawned In Game** (the default) the pipes and cables placed in the level are left out, since the level brings them back itself, and **Remove Spawned First** clears what the game spawned before loading. Accessories, cuts, reeling and the rope's length are kept. A cable held by an actor spawned in the game loses that hold, since the actor will be another one after loading. Load on the server. ## Baking **Bake Meshes** on a pipe or a cable makes a Nanite static mesh of it, with complex collision, in **Bake Folder** (`/Game/Pipecraft/Baked` by default). The bake is shown while the pipe would build the same; change it and the built mesh comes back until you bake again. **Clear Bake** goes back to the built mesh. For a level that is done, `PPC Bake Library` (Blueprint and Python, in the editor) bakes pipes to plain actors with no Pipecraft in them: - **Bake To Actor** and **Bake Network To Actor** make one actor: what the pipes build becomes a Nanite static mesh, kit pieces and accessories become static mesh components, instances or hierarchical instances. - **Bake To Blueprint** does the same and makes a Blueprint of it, to place again anywhere. - **Keep Pipes** leaves the pipes in the level, hidden and editor only, to change and bake again. In the draw mode, **B** bakes the run under the cursor and **Bake All Pipes** bakes every run of the level, one actor each, as the panel's **Bake Output** and **Keep Pipes When Baking** say. ## Check Setup **Check Setup** (on the draw mode's panel, and on every pipe) lists in the Message Log what will not work or look right: kit pieces without their sockets, supports with nothing to hold on to, and cable points held by an actor or a socket that is gone. ## Limits - Pipes join at their ends only: two pipes crossing in the middle pass through each other. - A support holds on to the surface it found when the pipe was built. Move the wall and click **Rebuild Everything**. - Kit straights, elbows and tees are picked by the kit; there are no variants of elbows and tees. - The line graph counts supply and demand; it does not simulate flow. - A cable tray's cables are separate actors, not one bundle. - Save and load are for the game, from Blueprint; Bake To Blueprint is from Blueprint and Python only. - A pipe or cable spawned while the game runs sends its spline points to the clients in one piece, which fits up to about 500 points. Split longer runs into more pipes. Support: contato@tessaroapps.com