Mods / Manifold Sample

Tags:
Worldgen Travel & Exploration Teleport
Author:
Pixnop
Side:
Both
Created:
May 20th at 8:45 PM
Last modified:
Jun 12th at 9:22 PM
Downloads:
154
For testers:
ManifoldSample-0.4.1.zip

Manifold Sample is a small demo mod that shows how to build custom dimensions with the Manifold library. It is a working example and smoke test - not a content mod.

Vintage Story 1.21+ Universal Copy-paste friendly MIT

Manifold logo

Requires Manifold.
Install the library alongside this demo.

What it adds

  • A void dimension (empty air) - /voiddim. Always lands you at a fixed spawn point.
  • A flat dimension (granite floor) - /flatdim. Returns you to your last position there.
  • A streaming dimension - /streamdim. Demonstrates opt-in streaming worldgen: chunks generate on demand as you walk, with no fixed region edge.
  • A vault dimension (0.3.0) - /vaultdim. Demonstrates the per-dimension separate inventory: your overworld items wait safely while you are inside, and the vault inventory is returned on re-entry.
  • /overworlddim - travels back to the overworld, to your last position.
  • /sendtestitem (0.3.0) - spawns a test item entity at your position and teleports it to the flat dimension, demonstrating the non-player entity transit API.
  • /sendtestblock (0.4.0) - teleports the block you are looking at (with its BlockEntity contents) to the flat dimension. Place a chest, put items in it, look at it, run the command, then check it under /flatdim at the announced coordinates.
  • /createtempdim and /destroytempdim (0.4.1) - create and destroy an ephemeral dimension at runtime, demonstrating the ephemeral lifecycle and the Destroyed signal that companions (like Chart) react to.
  • The sample also subscribes to the 0.4.0 PlayerArriving and EntityChangedDimension events and logs them to the server console, so the new transit lifecycle is observable in-game.
  • A simple portal block built on Manifold's PortalBlockBase.

For developers

Read the source as a copy-paste starting point for your own dimension mod: samples/ManifoldSample. It covers registering dimensions, picking a spawn behavior, opting into streaming worldgen, opting into a separate per-dimension inventory, registering chat commands via DimensionCommandBuilder, calling TeleportEntity and TeleportBlock, and subscribing to the transit events.

Compatibility

Vintage Story 1.21+. Universal. MIT licensed. Requires Manifold 0.4.0 or later.

Mod Version Downloads Released Changelog Download
0.4.1 49 Jun 12th at 9:22 PM ManifoldSample-0.4.1.zip

Rebuilt against Manifold 0.4.1; adds /createtempdim and /destroytempdim.

  • /createtempdim creates the ephemeral manifoldsample:tempdim at runtime and teleports you in; /destroytempdim removes it. Together they demonstrate the runtime ephemeral lifecycle (Define().Ephemeral().Create() and Registry.TryRemove) and are handy for testing companions that react to dimension destruction (e.g. Chart's map cache cleanup).
  • Rebuilt against Manifold 0.4.1 so ephemeral dimensions fire Destroyed on graceful server shutdown.

Requires Manifold 0.4.1+. For Vintage Story 1.21+.

0.4.0 24 May 30th at 8:47 PM ManifoldSample-0.4.0.zip

Rebuilt against Manifold 0.4.0; adds /sendtestblock and transit-event logging.

  • /sendtestblock teleports the block the caller is looking at (and its BlockEntity contents) to the sample flat dimension. Place a chest, put items in it, look at it, then run the command and check it under /flatdim at the announced coordinates.
  • The sample subscribes to the new PlayerArriving and EntityChangedDimension events and logs them to the server console, so the 0.4.0 transit lifecycle is observable in-game during /flatdim, /voiddim, /sendtestitem, etc.
  • Dependency floor raised to manifold >= 0.4.0 in modinfo (was 0.3.0), since the sample uses the 0.4.0 TeleportBlock and event APIs.

Requires Manifold 0.4.0+. For Vintage Story 1.21+.

0.3.1 21 May 23rd at 3:03 PM ManifoldSample-0.3.1.zip

Rebuilt against Manifold 0.3.1 (crash fix on Vintage Story 1.22.x).

  • No gameplay changes. The sample is rebuilt against Manifold 0.3.1 so it picks up the Entity.Pos binary-compat fix for 1.22.x and ships against VS 1.22.2 like the library.
  • Dependency floor raised to manifold >= 0.3.0 in modinfo (was 0.2.0), since the sample uses the 0.3.0 TeleportEntity and WithSeparateInventory APIs.

Requires Manifold 0.3.1+. For Vintage Story 1.21+.

0.3.0 16 May 23rd at 10:04 AM ManifoldSample-0.3.0.zip

Adds a separate-inventory dimension and an entity-transit demo.

  • /vaultdim - a flat dimension with a fully separate inventory (hotbar, backpack and character); your overworld items wait safely while you are inside, and the vault inventory is returned on re-entry.
  • /sendtestitem - spawns a test item entity at your position and teleports it to the flat dimension, demonstrating the new non-player entity transit API.

Requires Manifold 0.3.0+. For Vintage Story 1.21+.

0.2.0 21 May 21st at 11:24 PM ManifoldSample-0.2.0.zip

Adds a streaming dimension demo.

  • /streamdim - a flat dimension with streaming worldgen; walk to watch chunks generate around you.

Requires Manifold 0.2.0+. For Vintage Story 1.21+.

0.1.0 23 May 20th at 8:49 PM ManifoldSample-0.1.0.zip

First public release — a demo for the Manifold dimension API.

  • Void dimension (/voiddim) with a fixed spawn point.
  • Flat dimension (/flatdim) with last-visited spawn.
  • /overworlddim to travel back to the overworld.
  • A portal block built on PortalBlockBase.

Requires Manifold. Built against 1.21.0, validated in-game on 1.22.2 (works on 1.21 and 1.22).


9 Comments (oldest first | newest first) (threaded | flat)

DilanRona, Jun 23rd at 6:18 PM

Can you add a custom dimension to the list for mining purposes, that can be reset, without affecting the main overworld dimension (overworlddim)?

Pixnop , Jun 27th at 2:53 PM
@DilanRona: Can you add a custom dimension to the list for mining purposes, that can be reset, without affecting the main overworld dimension (overworlddim)?

Hi DilanRona, thanks for the interest. Quick clarification: Manifold is a library for mod authors, and ManifoldSample is just a small showcase of what the API can do, not a content mod we keep adding features to. So I won't be adding a mining dimension to the sample itself, but what you're describing is exactly the kind of thing the library is built for, and it's fully doable today.

A custom dimension is completely isolated from the overworld: it gets its own dimension id, so generating it, filling it, or wiping it never touches overworld terrain or chunks. "Resetting" a mining dimension just means destroying it and recreating it. When a dimension is destroyed, Manifold drops its generated-column records, so the recreated dimension runs its worldgen again from scratch (fresh layout and ores) instead of reloading the old chunks.

The sample already demonstrates the two building blocks you'd combine:

  • a persistent, generated dimension (see /flatdim, registered with .Persistent().WithWorldgen(...)), and
  • a destroy-then-recreate teardown (see /destroytempdim, which calls ForceRemoveDimension to evacuate any players first, then removes the dimension).

So a resettable mining world is essentially a persistent dimension whose worldgen strategy places stone and ores, plus a command that calls ForceRemoveDimension and re-registers it. The overworld is never affected. If you (or a modder) want to build that as its own mod on top of Manifold, that's the intended path, and I'm happy to help point you to the right API bits.

DilanRona, Jun 29th at 10:03 AM
@Pixnop: Hi DilanRona, thanks for the interest. Quick clarification: Manifold is a library for mod authors, and ManifoldSample is just a small showcase of what the API can do, not a content mod we keep adding features to. So I won't be adding a mining dimension to

Played some more with it today, and noticed a problem with the void dim. i filled it with a cube with dirt. and when i went back to the overworld, it placed me back where I was. Going back to the void dim placed me at y axis 1, and i started to fall into the void. Another problem I encountered is that if I use for example the portal mod, or something similar, it doesnt work between overworld and void dimensions. The void dimensions would be perfect for one particular megabuild project with a lot of space ships and a space station.

WACninja, May 25th at 6:14 AM (modified May 25th at 6:15 AM)

would it be possible for this to work with teleporters/translocators vanilla/modded? or perhaps have players trigger this without commands much like the time shift you see within the vannila game at the devastation?

Pixnop , May 25th at 1:48 PM
@WACninja: would it be possible for this to work with teleporters/translocators vanilla/modded? or perhaps have players trigger this without commands much like the time shift you see within the vannila game at the devastation?

Hi! Yes to both.

Block-triggered transit (no commands) is the main path I designed Manifold around: it ships a `PortalBlockBase` helper class. A mod just registers a block that extends it; when a player touches or interacts with the block, Manifold runs the transit for you. ManifoldSample does this with a single demo portal block. The same hook works for a runic gate, a teleporter pad, a devastation-style proximity zone, anything visual the mod wants. No chat commands needed.

Vanilla translocators specifically are a bit more involved. Their teleport logic lives in the survival mod and isn't dimension-aware, so wiring them into Manifold means either a small Harmony patch on the translocator block-entity (totally fine for a companion mod, just not for Manifold core which is zero-Harmony) or a parallel translocator-style block that uses Manifold under the hood. I'd lean toward the second option so vanilla translocators keep working inside the overworld and your cross-dim hops live in a clearly-marked block.

If you want to take a swing at either, the API surface is small: `manifold.Transitions.TeleportPlayer(player, dimensionCode, options)` from any block-entity is enough. Happy to help via GitHub issues if you have a specific design in mind.

WACninja, May 26th at 8:11 AM
@Pixnop: Hi! Yes to both. Block-triggered transit (no commands) is the main path I designed Manifold around: it ships a `PortalBlockBase` helper class. A mod just registers a block that extends it; when a player touches or interacts with the block, Manifold runs t

Thanks for the quick response! This is great to know as I would love to try and mess around with the manifold system for something i have in mind in the future, as for a specific design being set in mind i dont have on quite yet 😅. This is mainly me planning for the far future. im curios to see how your current mod and future mods develop!

Frepo, May 22nd at 9:00 AM

Interesting, most interesting.

El_Neuman, May 21st at 11:51 PM

Here's a bit of errors 
Can I integrate the code into BotaniaStory in the future?

Pixnop , May 22nd at 4:33 PM
@El_Neuman: Here's a bit of errors Can I integrate the code into BotaniaStory in the future?

Hi! Yes, please do. ManifoldSample is MIT-licensed and meant exactly as a template / starting point, so you are welcome to reuse or integrate its code into BotaniaStory. That is what it is there for.

Thanks for the error report as well. I'll dig into the logs and follow up here.