Add your biome to FINAL ASCENT
With the TFA biome API your mod can add its own biome to the FINAL ASCENT island. In the classic climb it replaces one stage - say, the Tropics; in the Builder it is a block that players stack into their own mountain. Players pick it in the map setup, in the list at the biome's heading, or add it as a block in the Builder. The stage then carries your biome's name. Your biome can also tell TFA what its stage needs: which weather of its frame to drop, how fast the fog closes in, which of TFA's weathers roll there, and how much taller or lower the stage is. As the first block of a Builder mountain it can also dress the start plateau the players wake up on.
- Frames your biome can fill: Tropics, Roots, Alpine, Mesa - the PEAK biome whose length, height and campfires your stage uses. In the classic climb your biome replaces that stage; in the Builder players put it anywhere in their own mountain, also more than once (up to
MaxPerRun), in one of its frames. - Never on the daily map - its times have to stay comparable.
- Everyone in the lobby needs your mod in the same version. Otherwise the host can't start with your biome.
- Normal PEAK runs stay yours: TFA only calls your mod when a FINAL ASCENT island is built.
Quick start
1. Reference True Final Ascent
Install True Final Ascent with r2modman and reference its DLL from your profile. Don't ship it in your package.
<Reference Include="TrueFinalAscent">
<HintPath>...\BepInEx\plugins\CptPICHU-TrueFinalAscent\TrueFinalAscent.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>...\steamapps\common\PEAK\PEAK_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
The second reference is PEAK's own Assembly-CSharp.dll (plus the UnityEngine modules you use, all in
PEAK_Data/Managed). TfaBiomeSlot exposes PEAK types such as Campfire
(slot.EndCampfire) and DayNightProfile (slot.Sky); without it the compiler
stops with CS0012 as soon as you touch them.
2. Make it an optional dependency
Your mod should still run without TFA. Declare a soft dependency and only touch TFA's types when TFA 3.0.0 or newer is there - in a separate class, so .NET never loads them otherwise. TFA's API types first exist in 3.0.0; on an older TFA they are missing, and the first touch throws.
using System;
using BepInEx;
using BepInEx.Bootstrap;
[BepInPlugin("you.crystalcaves", "Crystal Caves", "1.0.0")]
[BepInDependency("com.CptPICHU.peak.truefinalascent", BepInDependency.DependencyFlags.SoftDependency)]
public class CrystalCavesPlugin : BaseUnityPlugin
{
private void Awake()
{
// Touch TFA's types only when TFA 3.0.0 or newer is installed: on an older one they are missing and the first touch
// throws. Without TFA your mod keeps working as before.
if (Chainloader.PluginInfos.TryGetValue("com.CptPICHU.peak.truefinalascent", out PluginInfo tfa)
&& tfa.Metadata.Version >= new Version(2, 10, 0))
{
TfaBridge.Register();
}
}
}
Check TfaBiomes.ApiVersion (3 in TFA 3.0.0) before you use anything newer than your minimum: members of a
higher API exist only when it says so. Set them in a separate method marked
[MethodImpl(MethodImplOptions.NoInlining)] - .NET resolves a method's members when it first runs, so one
unknown member in your registration method would fail the whole registration
(MissingMethodException). This page is API 2, except the chapter
Your start plateau, which is API 3.
3. Register your biome
Once, in Awake. Id is short and unique, Version must match on every player,
Names needs at least English. The API 2 fields at the end are optional.
using System.Collections;
using System.Collections.Generic;
using TrueFinalAscent.Api;
using UnityEngine;
internal static class TfaBridge
{
public static void Register()
{
TfaBiomes.Register(new TfaBiome
{
Id = "crystalcaves",
Version = "1.0.0", // raise it whenever your generation changes
Replaces = new[] { "Tropics", "Roots" },
Names = new Dictionary<string, string>
{
["en"] = "Crystal Caves",
["de"] = "Kristallhöhlen",
["cn"] = "水晶洞穴",
},
Ink = new Color(0.55f, 0.85f, 1f),
Build = Build,
PlayersHere = OnPlayersHere,
// API 2 - all optional, each one is explained below
ApiLevel = 2, // may also stand first in the climb (Builder)
DropFromFrame = TfaFrameParts.Weather, // underground: no rain, no gusts
FogPace = 0.8f, // a twistier way up - a little more time
Weathers = new Dictionary<string, int> { ["*"] = 0, ["quake"] = 2, ["dark"] = 1, ["poison"] = 1 },
});
}
// Build and OnPlayersHere: see below.
}
4. Build it
TFA calls Build on every player while the island loads. This example lays a rough ramp of rock from the
start campfire up to the end campfire:
private static IEnumerator Build(TfaBiomeSlot slot)
{
// Root sits at the start campfire, +Z points towards the end campfire, +Y is up.
Transform root = slot.Root.transform;
Vector3 goal = root.InverseTransformPoint(slot.EndCampfire.transform.position);
// Borrow a material from PEAK's terrain of the stage you replace.
Material rock = slot.VanillaTerrain.GetComponentInChildren<MeshRenderer>(true).sharedMaterial;
int ground = LayerMask.NameToLayer("Terrain");
const int steps = 60;
for (int i = 0; i <= steps; i++)
{
float t = i / (float)steps;
GameObject step = GameObject.CreatePrimitive(PrimitiveType.Cube);
step.layer = ground;
step.GetComponent<MeshRenderer>().sharedMaterial = rock;
step.transform.SetParent(root, false);
step.transform.localPosition = Vector3.Lerp(Vector3.zero, goal, t)
+ Vector3.right * Random.Range(-4f, 4f); // seeded by TFA: the same on every player
step.transform.localScale = new Vector3(10f, 1f, 9f);
if (i % 15 == 0)
{
yield return null; // spread the work, the loading screen stays smooth
}
}
}
Where you build
Your Build gets a TfaBiomeSlot:
Rootstands at the start campfire and faces the end campfire (+Z forward, +Y up). Build everything under it - TFA shows and hides it together with the stage.StartCampfireis where players come from,EndCampfireis where they have to get to. Both stay as they are. Your way up must reach the end campfire. In the BuilderStartCampfirecan be null (see below).StartPointis where players enter your stage (the start campfire's fire, where there is one),EndPointthe fire of the end campfire, where your way up must arrive. Build from one to the other and your biome works everywhere.EndCampfireGroupis the whole campfire with its rock. Things you put under it appear and disappear with the campfire - good for a gate or a shrine right at the goal.VanillaTerrainis PEAK's terrain of the stage. TFA hides it after your build. Read it for templates (rocks, luggage, materials), never change it.
Same world for everyone
There is no download of your biome: every player builds it. So the build has to give exactly the same result everywhere.
- Randomness: inside
Build, TFA seedsUnityEngine.Randomfromslot.Seed- use it freely. Never time, frame counts or randomness from other places. - Raycasts: physics can round differently from CPU to CPU. Measure the world only in
Measure- it runs on the host, and every player gets its text inslot.Measured. - Networking: PhotonViews under
Rootget their view ids from TFA. Leave them at 0. - Version: raise
Versionwhenever your generation changes. Players with another version can't start with your biome together.
Measure = slot =>
{
// Host only. Raycasts can differ by a hair between CPUs - TFA ships this text to every player.
Vector3 above = slot.EndCampfire.transform.position + Vector3.up * 3f;
Physics.Raycast(above, Vector3.down, out RaycastHit hit, 20f);
return hit.point.y.ToString(System.Globalization.CultureInfo.InvariantCulture);
},
// ...and in Build, on every player - null if no host value arrived:
float endGround = slot.Measured != null
? float.Parse(slot.Measured, System.Globalization.CultureInfo.InvariantCulture)
: slot.EndCampfire.transform.position.y;
Your biome in the Builder
In the Builder players stack their own mountain from biome blocks. Your biome is a block too: it is built in one of
its Replaces frames (the host picks which one per block, the first is the default), wherever the player
puts it - also more than once, up to MaxPerRun.
slot.InBuilderis true there.slot.Positionis the place in the chain, the frame may be a copy, andPreviousandNextcan be any biome,mod:plus an id,""(first) orPeak(last).- First in the climb, or right after the Kiln, the Citadel or the Nadir, no campfire leads into your stage:
StartCampfireis null. Start atslot.StartPointinstead. TFA only puts your biome there if you setApiLevelto 2 or higher. First in the climb the players wake up on a start plateau in front of your ground - Your start plateau shows how to dress it. slot.StartPointandslot.EndPointare where players enter and where your way up must arrive (the end campfire's fire). They are set in the classic FINAL ASCENT too - build from one to the other and your biome works everywhere.- Last block: when
NextisPeak, TFA takes fire, luggage and statue off your end campfire after your build. The rock stays, and the bridge to the PEAK starts right behind it (+Z) - keep that side free. InBuilder = falsekeeps your biome out of the Builder, for builds that only work at their classic place.Fits(frame, previous, next)is optional: return false where your biome can't stand. It is asked while the host edits the chain, so it must be quick and answer the same on every player. If it throws, TFA treats it as true.
biome.ApiLevel = 2;
biome.Fits = (frame, previous, next) => previous != "Kiln"; // our entrance needs solid ground, not a lava rim
Your start plateau (API 3)
When a Builder mountain doesn't begin at the Shore, the players wake up after the plane crash on a
start plateau: a wide, flat piece of ground that TFA lays in front of the first biome, with the wreck, the spawn
spots, two luggage cases, a path to the way up and a fog wall behind. If the first block is yours, the plateau wears
your biome. It already does without any work from you (see Automatic dressing); with API 3
you describe the look yourself, as data in Start and, for set pieces, as code in
DressStart.
- Builder, first block only. The classic FINAL ASCENT, the daily map and a Shore start get no plateau; API 3 changes nothing there.
- Needs
ApiLevel2 or 3. Both place your biome first; set 3 once your code usesStartorDressStart, so the registration line shows it.StartwithApiLevel1 is never used, and TFA says so in the log. - Same world for everyone applies. Every player builds the plateau from the same numbers and the same seed. The host's fingerprint of it travels with the island, and every guest compares its own (see Testing).
What stays TFA's
Whatever you declare, these parts are TFA's. Your layers and your DressStart keep out of them. The numbers
point into the drawing under Zones.
slot.Anchor. In the bed (30 m around the wreck) only ground cover grows; cover keeps 6 m off the hull, solid copies 14 m.slot.PathX). The trough stays free, nothing taller than 1.5 m stands within 12 m of its axis, and up to 18 m only low things.Standing first: your ground
TFA lays the plateau in front of the first row of your ground. To find that row, the host looks from
slot.StartPoint for walkable ground on layer Terrain under your Root:
- from 40 m behind to 160 m ahead of
StartPoint, and between 30 m above and 160 m below it; - the first row where at least 8 of 25 sample points across a strip 96 m wide (one every 4 m) have such ground is the
front. For a mod, rocks on layer
Mapdon't count as ground; - without such ground TFA lays a flat plateau at
StartPointand says so in the log - your biome never fails because of it.
The plateau reaches up to 124 m behind the front (more where your ground lies lower). Keep that strip empty: anything of yours there lies under the wreck and the spawn spots.
Automatic dressing
Without a Start - or with a Start whose Layers is null - TFA dresses
the plateau itself from what your biome carries:
- It reads the PEAK spawners under
slot.Root(PropSpawner,DecorSpawnerandSpawnList, inactive variants too) and sorts their prefabs by size and shape into rocks, tall things, plants and ground cover. Everything is scattered at TFA's usual density. - Rocks come from your spawners first, then from the boulders you built on layer
Map, then from the camp of your frame. TFA never uses the plants of your frame. - The plateau takes the ground material of your biome and your frame's relief. It gets none of the frame's landmark, light marks or ponds. Your own ground in front of the plateau stays untouched.
- A biome made entirely in code, without PEAK spawners, gets relief and rocks only. Give it layers.
Describing the look: TfaStartStyle
Set Start on your TfaBiome and TFA turns it into the plateau. It is plain data - no code runs
per object - so it is the same on every player. TFA clamps every number to its range and skips what it can't use, with
one log line each. As for every newer API, put the API 3 members in a method of their own (quick start, step 2):
using System.Runtime.CompilerServices;
using TrueFinalAscent.Api;
internal static class TfaBridge
{
public static void Register()
{
TfaBiome biome = new TfaBiome
{
Id = "crystalcaves",
Version = "1.1.0", // Start and DressStart are content: raise it when you change them
Replaces = new[] { "Tropics", "Roots" },
// ... Names, Ink, Build, ApiLevel = 2 and the rest, as in step 3 ...
};
// API 3 members exist only in a TFA whose ApiVersion says so - keep them out of this method.
if (TfaBiomes.ApiVersion >= 3)
{
AddStart(biome);
}
TfaBiomes.Register(biome);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void AddStart(TfaBiome biome)
{
biome.ApiLevel = 3; // placed like 2; 3 says your code knows the start plateau
biome.Start = CrystalStart.Style(); // the look as data
biome.DressStart = CrystalStart.Dress; // set pieces as code (optional)
}
}
This is the style of the example biome: a ground material, a gentle relief, three layers, a landmark with a light and a
sound, and an ambience. Two layers and the landmark name templates your Build
makes (next section); the third layer takes a PEAK plant.
using System.Collections.Generic;
using TrueFinalAscent.Api;
using UnityEngine;
internal static partial class CrystalStart
{
// Loaded from your asset bundle in Awake.
public static Material Floor, Glass;
public static AudioClip Hum, Chime;
// Plain data: TFA clamps it and builds the same plateau on every player.
public static TfaStartStyle Style()
{
return new TfaStartStyle
{
Ground = Floor, // null = the largest ground material under your Root
Relief = new TfaStartRelief { Hill = 2.5f, Rough = 0.6f, Mounds = 18 }, // fields left at -1 keep the frame's value
Layers = new List<TfaStartLayer>
{
// Tall crystals as the plateau's walls, from templates your Build makes (next section).
new TfaStartLayer
{
Find = "Props/T_crystal_tall", Kind = TfaStartKind.Tall,
Zones = TfaStartZone.Back | TfaStartZone.Sides, Density = 12f, ScaleMin = 0.9f, ScaleMax = 1.5f,
},
// Boulders in loose groups across the field; they keep your own glow script.
new TfaStartLayer
{
Find = "Props/T_boulder", Kind = TfaStartKind.Rock, Zones = TfaStartZone.Field,
Density = 8f, Cluster = 0.7f, Keep = new[] { "CrystalGlow" },
},
// Ground cover from PEAK's own Roots pool: nothing to ship.
new TfaStartLayer
{
Vanilla = "Roots:Fern", Kind = TfaStartKind.Cover,
Zones = TfaStartZone.Field | TfaStartZone.Path | TfaStartZone.Bed, Density = 40f,
},
},
Landmark = new TfaStartLandmark
{
Find = "Props/T_crystal_spire", Scale = 1.2f, Radius = 9f, Sink = 1.5f, Sound = Chime,
Glow = new Color(0.45f, 0.8f, 1f, 1f), // alpha above 0: a light marker, like TFA's darkness lamps
},
RockMax = 6f,
Ambience = Hum,
AmbienceVolume = 0.4f,
ClimbPractice = true, // two stacked rocks with a luggage case on top
};
}
}
- Layers grow in the zones you name at the density you give. Several small layers read better than one big
one; at most 16 count. Once you give a list - even an empty one - it replaces the automatic dressing: TFA adds no
rocks or plants of its own, so bring your rocks as a
Rocklayer. TFA keeps the view from the wreck to the end of the path open: nothing taller than 6 m stands within 25 degrees of that line, and a copy that would is moved sideways or skipped. - The landmark stands in TFA's slot on a flat podium that blends into the ground, so it never floats. Choose a model with a clear silhouette: players see it from the wreck. TFA sets its mesh bottom on the podium, wherever its pivot is; the side grove adds 3 to 7 copies of your plants.
- The two kit cases and the climbing practice are TFA's, with the loot of your frame; you choose only whether
the practice is built (
ClimbPractice). - Ponds need
AllowWaterand aWatermaterial; TFA lays them and gives them a real water zone. - Sound: without
AmbienceTFA lends a looping ambience bed it finds under your root.
Templates: Template, Find, Vanilla
Every layer and the landmark names exactly one model:
Template- a prefab from your asset bundle, or a scene object (inactive is fine).Find- a path under yourRoot, resolved afterBuild. For models yourBuildmakes itself: make them once, inactive, under a "Props" object and give them plain names.Vanilla- a PEAK prefab named by that biome's spawners, such as"Tropics:Jungle_Willow_Big". Nothing to ship. Copies start at the size and turn its spawner gives it, and your scale works on top.
// In your Build (every player): make the templates once, inactive, under your Root. Find reads them after Build.
private static IEnumerator Build(TfaBiomeSlot slot)
{
Transform props = new GameObject("Props").transform;
props.SetParent(slot.Root.transform, false);
props.gameObject.SetActive(false); // templates only: never seen, never walked on themselves
Template(props, "T_crystal_tall", PrimitiveType.Capsule, new Vector3(2.5f, 8f, 2.5f));
Template(props, "T_crystal_spire", PrimitiveType.Capsule, new Vector3(5f, 21f, 5f));
Template(props, "T_boulder", PrimitiveType.Sphere, new Vector3(3f, 2f, 3f));
// ... then the ground and the way up, as in the quick start ...
yield return null;
}
private static void Template(Transform parent, string name, PrimitiveType shape, Vector3 size)
{
GameObject model = GameObject.CreatePrimitive(shape);
model.name = name; // plain name: "Props/T_crystal_tall" finds it
model.layer = LayerMask.NameToLayer("Map"); // props on Map, walkable ground on Terrain
model.transform.SetParent(parent, false);
model.transform.localScale = size;
model.GetComponent<Renderer>().sharedMaterial = CrystalStart.Glass;
}
TFA measures a model from its meshes, not from Renderer.bounds (which is zero for inactive objects). Every
copy is made by TFA: it keeps meshes, materials, colliders and the scripts you list in Keep, and strips
the rest (see What TFA removes). LOD groups on the root stay.
Zones
A layer says in which zones it grows. The drawing shows the plateau from above, your ground at the top; numbers 1 to 6
are the zones in the table, 7 to 10 are TFA's own parts from the table above. How a copy sits on the ground, and which
kind may stand where, is the TfaStartKind of the layer (see the Reference).
| No. | Value | Where | Allowed kinds |
|---|---|---|---|
| 1 | TfaStartZone.Back | The strip along the back edge, 36 m deep, in front of the fog wall - the place for a skyline. | Rock, Plant, Cover, Tall |
| 2 | TfaStartZone.Sides | The outer 42 m of each side, on the berms - your biome's walls. | Rock, Plant, Cover, Tall |
| 3 | TfaStartZone.Field | The open middle: the ring around the wreck, the band before the front and everything between the berms and the back. | Rock, Plant, Cover |
| 4 | TfaStartZone.Bed | Within 30 m of the wreck. Ground cover only, and never closer than 6 m to the hull. | Cover |
| 5 | TfaStartZone.Path | Beside the path, 4 to 18 m from its axis, from 20 m ahead of the wreck to the front: up to 1.5 m high within 12 m of the axis, up to 6 m beyond. The trough itself always stays free. | Plant, Cover |
| 6 | TfaStartZone.Front | On your own ground in front of the plateau, up to 72 m past its first row, where the host measured it; a lane 12 m wide to each side of the path end stays free. Off unless a layer asks for it: TFA does not decorate your own ground otherwise. | Rock, Plant, Cover |
Set pieces: DressStart
For what data can't say - a ring of crystals round the landmark, a bridge, a signpost - DressStart runs your
code once on every player. It runs after TFA has laid the plateau and its own parts (wreck, spawn fan, kit, path,
landmark) and before TFA scatters your layers, so your set pieces get the first claim on the ground and TFA fills the
space around them. With Layers null, TFA's automatic layers already stand when it runs.
using TrueFinalAscent.Api;
using UnityEngine;
internal static partial class CrystalStart
{
// Loaded from your asset bundle in Awake: content bound to your Version, the same on every player.
public static GameObject CrystalPrefab;
// A ring of 8 spots as literal numbers: Sin and Cos may round differently per CPU, a table cannot.
private static readonly Vector2[] Ring =
{
new Vector2(16f, 0f), new Vector2(11.3f, 11.3f), new Vector2(0f, 16f), new Vector2(-11.3f, 11.3f),
new Vector2(-16f, 0f), new Vector2(-11.3f, -11.3f), new Vector2(0f, -16f), new Vector2(11.3f, -11.3f),
};
// Every player, after TFA laid the plateau and its own parts, before TFA scatters. Pure: only the slot and Random.
public static void Dress(TfaStartSlot slot)
{
if (CrystalPrefab == null || float.IsNaN(slot.Landmark.x))
{
return; // nothing to copy, or this style has no landmark to put a ring around
}
foreach (Vector2 offset in Ring)
{
// UnityEngine.Random is seeded from slot.Seed in here: the same numbers on every player.
float x = slot.Landmark.x + offset.x + Random.Range(-1.5f, 1.5f);
float z = slot.Landmark.z + offset.y + Random.Range(-1.5f, 1.5f);
float y = slot.Height(x, z);
if (float.IsNaN(y) || !slot.IsFree(x, z, 2.5f))
{
continue; // off the plateau, or TFA's wreck, fan, path or landmark is there
}
GameObject crystal = slot.Copy(CrystalPrefab, "ring crystal"); // TFA's stripped copy under slot.Holder
if (crystal == null)
{
continue;
}
crystal.transform.position = new Vector3(x, y - 0.4f, z);
crystal.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
crystal.transform.localScale *= Random.Range(0.8f, 1.3f);
slot.Reserve(x, z, 2.5f); // TFA's own scatter keeps out of the disc
}
}
}
The contract is that of Build, but stricter, because TFA compares the result (see
Testing):
- Pure. Compute only from the
TfaStartSlot- its seed, its samplers, the host's text inslot.Measured- and from content bound to yourVersion. Your own configuration, the scene, the time and frame counts differ from player to player and make the plateau differ. - Randomness.
UnityEngine.Randomis seeded fromslot.SeedinsideDressStart; TFA restores its own state afterwards. Use no other source, no iteration over sets keyed by Unity objects, nothing that depends on the order ofFindObjectsByType. - No physics. The plateau is inactive while you run, so a raycast can't hit it. Use
Height,NormalandLowest: they are the same on every player. - Only under
Holder(slot.Copyputs its copies there). No PhotonViews, rigidbodies, items or spawners; walkable colliders on layerTerrain, props onMap. - Scripts you keep or add wake when the whole plateau stands. They run on every player, must be local and must not move colliders.
- Maths. TFA compares positions to 1/16 m. Prefer
+ - * /,Sqrt,FloorandAbs; avoidSin,Cos,Powand Perlin noise for positions, or a CPU that rounds differently shows up as a mismatch. A literal table, as in the example, is the safest. - Quick. It runs inside the loading screen without yielding. Stay under 250 ms; at most 400 objects with renderers count.
- Fail together. If it throws, everything it made is removed on that player. Make it fail everywhere or nowhere.
Does your set piece need the real shape of the world, such as your ground ahead of the plateau? Raycasts are the
host's job, as for Measure: set MeasureStart. It runs once on the host before the plateau is
shaped (slot.Measuring is true, the samplers answer NaN) and returns text; every player reads that text in
slot.Measured. Keep it short: over 2 KB as Base64 TFA drops it, and Measured is null.
What TFA removes, clamps and refuses
TFA can't stop a raycast from your code, so it makes the result safe and the same on every player instead. This happens
after your style and after DressStart, before the plateau wakes:
PhotonView and Item (together with the part they sit on), Rigidbody, every Joint, ConstantForce, Cloth, every particle system and every Animator or Animation are removed from every copy and from everything under your DressStart group, before anything wakes. A script of yours that requires one of them ([RequireComponent]) is removed first. The log counts them.CollisionModifier, ...) are removed. Only harmless local ones stay: ClimbModifierSurface without status or petrify, WaterZone, AudioLoop, BakedVolumeLight, WobbleSpinBounce, cooling StatusEmitter and StatusField, and a CollisionModifier that hurts and pushes nobody. Your own scripts stay on Copy copies; on a layer's copies only those named in Keep stay, and triggers, lights and sounds are stripped there.DressStart whose footprint reaches the spawn fan, the wreck (with a margin of 6 m), the path trough or a disc TFA planned (kit, landmark, ponds) is hidden with everything under it. The same on every player.Layers null, TFA's automatic layers already stand when DressStart runs and count first.Reserve is for the room around your objects; its discs count only if DressStart returns.DressStart. A difference is logged as an error and left as it is: nothing is undone.DressStart throws, everything it made is removed - its pieces and its reservations - and the plateau stays as if you had no DressStart. Your style's layers and landmark stay. TFA logs the error and its stack. Make it fail everywhere or nowhere.m), the guest switches every collider under FA_StartMod off - your layers and your set pieces - so there are no invisible walls and no holes at the spawn, and logs it. The look may still differ, so make it identical.All together the plateau keeps to this budget. What is counted comes from the finished copies, so every player refuses the same copy.
| Limit | Cap | Beyond it |
|---|---|---|
| Copies on the plateau | 1000 | The next copies are refused, in placement order - the same copies on every player. |
| Rocks / big plants / ground cover | 320 / 420 / 480 | Per kind, as above. |
| Landmark, side grove | landmark 1 copy, side grove 3 to 7 | Both count in the copies above. |
| Shadow draws | 600 | Casting renderers x material slots. Beyond it shadows are switched off, nothing is hidden: the landmark keeps its shadows longest, then the biggest shadows nearest the way from the wreck along the trough and on past the front; ground cover never casts. |
| LOD0 renderers | 2500 | Ground cover, then plants, then rocks are refused. |
| LOD0 triangles | 2.5 million | Same order. |
| Colliders | 1500 | Same order; ground cover has none. |
| Glow marks | 4 | From the fifth on the light marker is removed. Yours and TFA's count together. |
| Water surfaces | 3 | No further ponds. |
| New sound sources | 4 | No further sources. |
| Particle systems | none for mods | Removed from every template and from DressStart. |
Your DressStart | 400 objects, 2 lights, 2 audio sources | The rest is hidden or switched off, the last first. Your set pieces also count in the plateau's copies, LOD0 renderers, triangles and colliders above: a top-level piece that no longer fits is hidden. Over 250 ms TFA warns in the log. |
| Placing the whole plateau | about 1 s | TFA's own time goal; it logs the time next to the numbers. |
Your stage, your rules
Your biome is built in a frame and inherits what the frame brings: its length and height, its campfires, its weather, its cold nights. With API 2 you can tell TFA what to drop from that frame, how fast the fog closes in, which of TFA's weathers roll in your stage in Apocalypse mode, and how tall your stage is. Everything is optional; a biome that sets none of it behaves exactly as before.
- Declare, don't patch. Tell TFA what your stage needs. TFA does it the same way on every player, for late joiners and after a host change. Don't switch PEAK's weather zones, the fog or the cold off yourself.
- Everyone needs your biome. A player who joins a run later without it is removed from the run: always in
the Builder, and in the classic climb as soon as your biome uses
Riseor any stage rule (DropFromFrame,FogPaceorWeathers). A biome that sets none of these keeps the old behaviour: a player without it climbs PEAK's own stage, the vanilla frame. - Weather at runtime - a storm when the group arrives - is TFA's Weather API (the Weather tab) or your own code, see Starting weather yourself. This part covers what your biome declares.
- Check the version before you touch anything newer than your minimum (quick start, step 2).
What you drop from the frame: DropFromFrame
By default your stage keeps what its PEAK biome brings. DropFromFrame names what it should not keep.
Default TfaFrameParts.None; combine parts with |.
WeatherPEAK's weather of the frame in normal FINAL ASCENT runs: rain in the Tropics, gusts in the Roots, the blizzard on the Alpine, the hot sun on the Mesa. In Apocalypse mode PEAK's zones are silent anyway; there it is TFA's permanent Mesa sun. Dropped, TFA holds that weather still in your stage, on every player.ColdNightCold nights, as from the shore up to the Mesa. Dropped, nights in your stage are mild, as from the Caldera on.biome.DropFromFrame = TfaFrameParts.Weather | TfaFrameParts.ColdNight; // a warm, sheltered valley
Don't switch PEAK's weather objects off yourself: TFA's rain borrows parts of them, and a zone switched off on one player still blows on the others. When the group leaves your stage, PEAK's weather simply carries on. New parts may join this list later; a biome only ever drops what it names.
Fog pace: FogPace
TFA gives every stage its own fog. It starts behind the campfire players come from and closes in at PEAK's pace. A
bigger or harder biome may need more time: FogPace multiplies the fog's speed while your stage is the one
the group is in. 1 is PEAK's pace, 0.5 half as fast, 2 twice as fast; TFA keeps it between 0.25 and 2 and logs a value
outside that range. If your stage is the last one, your pace holds until the fog ends at the PEAK.
biome.FogPace = 0.75f; // a third more time than PEAK's fog gives
Never change OrbFogHandler.speed yourself - your pace and TFA's would multiply.
TFA weather in your stage: Weathers
In Apocalypse mode the host rolls TFA's weather every few minutes from a table that says which weather can come in which
biome. Your stage uses the column of its frame. Weathers replaces it for your stage:
- The key is a TFA weather (list below), the value how likely it is:
0never,1the base likelihood (TFA's own table mostly uses 1, in a few places 2 or 3),2-5that many times as likely as a1. Values outside 0-5 are clamped and logged. TFA first rolls how rare the next weather is (common, rare or special), then picks among those that can come here. If none of that kind can, it tries the more common kinds first, then the rarer ones - so a list that allows only rare or special weathers makes every roll end up with one of them. - A weather you don't list keeps the frame's likelihood.
"*"sets every weather you don't list:["*"] = 0plus a few keys means "only these";["*"] = 0alone means no TFA weather in your stage - the cycle rests there, as it does in the Nadir. null(default) keeps the frame's column.
// A desert in a Tropics frame: sand instead of rain, no snow, no tsunami.
biome.Weathers = new Dictionary<string, int> { ["sand"] = 3, ["rain"] = 0, ["snow"] = 0, ["tsunami"] = 0 };
// Or only the weathers you name, nothing else (these are rare or special ones, so every roll ends at one of them):
// biome.Weathers = new Dictionary<string, int> { ["*"] = 0, ["quake"] = 2, ["dark"] = 1 };
// Or no TFA weather at all - the cycle rests in your stage:
// biome.Weathers = new Dictionary<string, int> { ["*"] = 0 };
- The dice and the ghosts' vote follow it. A perma weather and the host's manual menu don't.
- What the host switched off in the weather setup stays off, and a weather's own conditions still apply: moons only at night, the eruption only with a Kiln in the mountain, the Scoutmaster's Watch only with the Scoutmaster.
- In Chaos every weather is equally likely everywhere - but your
0stays0. Use it for weather that would break your stage, not for taste. - An unknown key is logged once and ignored, so a key from a newer TFA does no harm in an older one.
Outside Apocalypse mode TFA rolls no weather; there your stage gets the weather you start yourself (below), for example with the Weather API.
A taller or lower stage: Rise
Your stage is built in a frame: the length, height and campfires of a PEAK biome. Rise changes its height.
TFA raises (or lowers) the end campfire with its rock by that much, and every stage after yours moves along - nothing
hangs in the air, nothing has to climb down. It works in the classic climb and in the Builder.
// Registration: 40-60 units taller than the frame, a different height per run.
biome.Rise = seed => 40 + (int)(seed % 21);
// In Build: EndCampfire already stands at its new height, slot.Rise says by how much (after clamping).
int steps = 60 + slot.Rise; // a taller stage gets a longer ramp
seedis the seed yourBuildgets inslot.Seed, so your generator can work out its own summit from it.- World units, like transform positions - not metres. PEAK's altimeter shows about 1.6 m per unit.
- Range -30 to +100. TFA clamps anything else and writes a log line.
- Asked once, on the host, when the run starts - in the airport, before any island exists. Pure arithmetic
only: no scene, no physics, no
UnityEngine.Random. If it throws, the rise is 0. - The result travels with the run: every player builds the same mountain.
slot.Risetells yourBuildthe value TFA used, after clamping - read it there instead of calling your function again. - When
Buildruns,EndCampfirealready sits at its new height. Build fromslot.StartPointup toslot.EndPointas always. The stage's fog grows with it by itself. - Every player needs your biome in the same version to join a run that uses it. A player who joins later without it is removed from the run - also in the classic climb, because a rise changes the mountain (see Your stage, your rules).
The length of the frame stays. A longer way up is yours to wind inside it.
Starting weather yourself
PlayersHere runs on every player and tells you when the group enters (true) and leaves
(false) your stage - the moment to start and stop sounds, wind or storms. true comes when
the campfire before your stage is lit, or at the start of the run if your stage comes first. Your weather runs on
every player, so start and stop it the same way everywhere.
To use TFA's own 28 weathers - with a tier, single values, a lake to swim in - call the
TFA Weather API from here; it has its own tab. slot.OwnWeatherAllowed is
true in every run except the daily map, where mod biomes never appear anyway - Apocalypse mode included: TFA's dice and
your weather run side by side, and a weather you start through the Weather API takes over a colliding dice weather.
Steer the dice themselves in your stage with Weathers.
private static void OnPlayersHere(TfaBiomeSlot slot, bool here)
{
// Your own wind, sounds or storms: start with the group, stop when it leaves.
// To use one of TFA's 28 weathers instead, call TfaWeather.Start / Stop from here (Weather tab).
CrystalStorms.Running = here && slot.OwnWeatherAllowed;
}
Is your own weather or water part of the way up - a route players must swim? In Apocalypse mode other weather may run
next to it, and if another mod's weather holds TFA's weather slot, your start answers Busy - ask again
every few seconds (see the lake example on the Weather tab).
Want your own sky and light? Change slot.Sky during Build:
// In Build: start from PEAK's profile of this stage and make it your own.
DayNightProfile sky = UnityEngine.Object.Instantiate(slot.Sky);
// ... change colours and fog ...
slot.Sky = sky;
Rules of thumb
- Build only under
Root(orEndCampfireGroup). Don't touchMapHandler, its segments or PEAK's terrain - TFA wires the stage itself. - Walkable colliders on layer
Terrain, props onMap- TFA's rain, lightning and lava look for those. - Yield regularly. A build of several seconds in one frame freezes the loading screen.
- If
Buildthrows, TFA keeps PEAK's stage on that player and tells them - loading never hangs. Make sureBuildfails everywhere or nowhere, or that player climbs a different stage. - Build only relative to the slot, from
slot.StartPointtoslot.EndPoint.StartCampfirecan be null in the Builder (ApiLevel2 or 3). Your biome may fill different stages of a climb (in the Builder any place), and withMaxPerRunabove 1 more than once - keep everything that depends on the run in the slot, not in static fields: TFA asksRise,FitsandMeasureper slot. DropFromFrame,FogPace,Weathers,Rise,StartandDressStartare part of your content: every player needs the same, so raiseVersionwhen you change them.- Start plateau (API 3): describe it as data first and add
DressStartonly for what data can't say.DressStartis pure - it computes from the slot and the seed, never from your configuration or the scene - or the guests' plateau differs from the host's. - Heights are world units (about 1.6 m on PEAK's altimeter):
Rise,StartPoint,EndPoint. - Has your mod its own fog pace, cold or weather switches for normal PEAK runs? Keep them for normal runs, turn them
off in FINAL ASCENT (
TfaBiomes.IsFinalAscentRun) and declare the FINAL ASCENT values instead. - Does your mod normally replace a biome on its own? Keep doing that in normal runs and step aside in FINAL ASCENT:
// Your mod normally replaces a biome by itself? Step aside in FINAL ASCENT runs only:
if (TfaBiomes.IsFinalAscentRun)
{
return; // TFA calls your Build if the host picked your biome
}
Reference
Everything below is API 2 or API 3 (TfaBiomes.ApiVersion is 3), there since True Final Ascent 3.0.0. API 3 is
the start plateau: Start, DressStart, MeasureStart and the types
TfaStartStyle to TfaStartSlot.
TfaBiome - what you register
IdUnique id, 2-24 lowercase letters or digits.VersionContent version; must be the same on every player. No | or @.ReplacesFrames it fits: Tropics, Roots, Alpine, Mesa. In the Builder the host picks the frame per block, the first one is the default.MaxPerRunHow many copies one run may contain (default 1). Above 1, keep your state per slot.NamesName per language: en (required), de, cn.InkColour of your biome in the map setup and in the climb graph on this website.MeasureOptional, host only: measure the world, return text.BuildRequired: build under slot.Root; yield return null (or your own IEnumerator) to spread the work, never StartCoroutine.PlayersHereOptional: the group entered (true) or left (false) your stage.ApiLevelPlacement you accept: 1 (default) only after a campfire, 2 also first in the climb and right after the Kiln, Citadel or Nadir (Builder), 3 the same and your code knows the start plateau (API 3). Higher than ApiVersion is refused.InBuilderFalse keeps your biome out of the Builder (default true).FitsOptional (frame, previous, next) => bool: false where your biome can't stand in the Builder. Quick, the same on every player; if it throws, TFA treats it as true.DropFromFrameWhat your stage doesn't take from its frame: Weather, ColdNight (default None).FogPaceFog speed in your stage, 0.25-2 (default 1).WeathersOptional: TFA weather key to likelihood 0-5, "*" for the rest. Apocalypse dice and ghosts' vote only.RiseOptional seed => units: extra height of your stage, -30 to +100. Host only, once, at run start.StartOptional, API 3: TfaStartStyle, the look of the start plateau as data. Read after your Build, on every player, only when your biome stands first in a Builder mountain.DressStartOptional, API 3: Action<TfaStartSlot>, set pieces for the start plateau as code. On every player, pure, after TFA's own parts and before its scatter.MeasureStartOptional, API 3, host only: Func<TfaStartSlot, string>, measure what DressStart needs (raycasts) before the plateau is shaped and return it as text. Every player gets it in slot.Measured; over 2 KB as Base64 it is dropped.TfaBiomeSlot - what TFA gives you
RootBuild here. At the start campfire (or StartPoint), facing the end campfire.StartCampfire, EndCampfireThe campfires before and after your stage. StartCampfire is null where no campfire leads in (Builder, from ApiLevel 2 on).StartPointWhere players enter your stage: the start campfire's fire, else the summit camp of the Kiln or Citadel, the Nadir's bridge camp or the foot of the climb. First in the climb TFA lays the crash site just in front of it after your build (start plateau).EndPointThe fire of EndCampfire - where your way up must arrive.EndCampfireGroupThe whole end campfire with its rock.VanillaTerrainPEAK's terrain of the stage - templates only, hidden after your build.SeedSeed for this run, stage and biome, the same everywhere.MeasuredThe host's Measure result, or null.SkyLight and sky profile of the stage - replace it to change it.OwnWeatherAllowedFalse only on the daily map (which never has mod biomes); true in every other run, Apocalypse mode too, where TFA's dice and your weather run side by side. See the Weather API.InBuilderTrue in a Builder mountain: Position is the place in the chain, the frame may be a copy.RiseThe rise TFA used for this slot, after clamping; 0 without Rise.PositionPlace in the climb, 0 = first stage; in the Builder the place in the chain.OccurrenceWhich copy of your biome this is, from 1.Previous, NextThe stages around yours: Shore, Tropics, ... or mod: plus an id; "" at the start, Peak at the end. In the Builder Caldera, Kiln, Gloom and Citadel are separate blocks: Kiln or Citadel can be your neighbour with no Caldera or Gloom before it, and Caldera or Gloom with no Kiln or Citadel after it.Replaces, BiomeThe frame you build in, your registration.TfaFrameParts
None, Weather, ColdNightFlags for DropFromFrame: combine with |. A biome only drops what it names; new parts may join later.TfaStartStyle - your start plateau as data (API 3)
Set it as TfaBiome.Start. Every field is optional.
GroundMaterial. The plateau's ground. null = the largest material of your Terrain ground under slot.Root. It is projected from above (world x and z), so triplanar or world-space shaders look best.ReliefTfaStartRelief. Hills, roughness and mounds of the plateau ground. null = your frame's relief.LayersList<TfaStartLayer>. What grows on the plateau; at most 16 layers, more are ignored. null = TFA dresses the plateau itself from the spawners on your root. Any list, even an empty one, means only your layers: TFA then scatters no rocks or plants of its own.LandmarkTfaStartLandmark. One landmark in TFA's slot beside the path, optionally with a small grove opposite. null = none.RockMaxfloat, metres, 1.5 to 16. Largest radius of a rock in the field. -1 (default) = your frame's. Smaller makes a calmer plateau.AmbienceAudioClip. Your own ambience bed: a looping 3D sound at the wreck, full volume within 80 m, fading to nothing at 220 m. Replaces what TFA otherwise lends from a looping ambience bed under your root.AmbienceVolumefloat, 0 to 1 (default 0.5). Volume of Ambience; PEAK's ambience volume setting applies on top.AllowWaterbool (default false). TFA may lay 1 to 2 ponds of real water on the plateau (radius 6 to 10 m, 0.8 m deep) - water that slows swimmers. Needs Water; without it the setting is ignored (log line).WaterMaterial. Look of the pond surface. TFA finds it by name on a renderer under your Root, so a renderer there must carry this material.ClimbPracticebool (default true). TFA builds the climbing practice of your frame: two stacked rocks with a luggage case on top. Skipped when the frame's rocks can't be found on your plateau.TfaStartLayer
One layer of copies in TfaStartStyle.Layers. Numbers outside their range are clamped and logged.
TemplateGameObject. A prefab or scene object as the model (inactive is fine). Exactly one of Template, Find and Vanilla per layer; a layer with none or several is skipped, with a log line.Findstring. Path under your slot.Root in plain names ("Props/T_crystal"), resolved after your Build. For templates your Build makes itself.Vanillastring. A PEAK prefab that a PEAK biome's spawners name: "Tropics:Jungle_Willow_Big" = biome (Tropics, Roots, Alpine, Mesa, Caldera, Kiln, Gloom, Citadel), colon, plain prefab name. Lets you dress with PEAK's own plants and rocks without shipping them. A name TFA doesn't find skips the layer.KindTfaStartKind (default Plant). How the copies sit on the ground; see the kinds below.ZonesTfaStartZone (default Field | Sides). Where the layer may grow; combine with |. Kinds that are not allowed in a zone lose that bit, with one log line.Densityfloat, copies per hectare in its zones, 0 to 400. -1 (default) = TFA's density for the kind (rock 12, plant 25, cover 60, tall 40).Clusterfloat, 0 to 1 (default 0.5). 0 spreads the copies evenly, 1 gathers them into tight groups of 3 to 7.ScaleMin, ScaleMaxfloat, 0.25 to 4 (default 0.85 and 1.2). Scale range of the copies.Radiusfloat, metres. Footprint TFA keeps clear around a copy. -1 (default) = from the model's mesh bounds.Tiltfloat, degrees, 0 to 20. Largest tilt. -1 (default) = 8 for Rock, 0 for the rest.Sinkfloat, 0 to 0.8. Share of the height that sits in the ground. -1 (default) = the kind's own.ShadowsTfaShadow (default Auto). See below.Keepstring[]. Type names of your own scripts that survive the copy. Everything else on the template is stripped (see "What TFA removes").TfaStartLandmark
Template, Find, VanillaAs for a layer: exactly one source.Radiusfloat, 4 to 25 m. Footprint for the flat podium under the landmark and for the clearance around it. -1 (default) = measured from the model. A landmark never floats: TFA blends the ground up to it.Scalefloat, 0.05 to 20 (default 1). Scale on the template as authored.Sinkfloat, 0 to 5 m (default 0). How deep the landmark stands in the ground.SoundAudioClip. Optional looping 3D sound at the landmark, audible from 4 to 60 m.GlowColor. Alpha above 0 adds a light marker (BakedVolumeLight) at the landmark, like the lamps TFA uses in darkness. Default Color.clear = none.SideGrovebool (default true). A small grove opposite the landmark (60 to 90 m from the path), made from your Plant and Tall layers.TfaStartRelief
Every value defaults to -1: the relief of your frame. Terraces and dunes are not part of API 3.
Hillfloat, 0 to 8 m. Height of the broad hills.Roughfloat, 0 to 3 m. Height of the fine roughness.Moundsint, 0 to 40. Number of mounds.TfaStartZone
None, Back, Sides, Field, Bed, Path, FrontFlags 0, 1, 2, 4, 8, 16, 32: combine with |. The zones are drawn and described in "Zones" above.TfaStartKind
RockSunk 35 to 55 % into the ground and tilted. Rocks in the field are scaled down to RockMax. Not allowed in Bed and Path.PlantStands upright on the ground (sunk 0.15 m), keeps its colliders as authored. Not allowed in Bed.CoverGround cover: colliders removed, never casts a shadow; the only kind in the bed, where it may come to 6 m from the hull.TallSkyline: only in Back and Sides; casts no shadows unless the layer asks (TfaShadow.On).TfaShadow
Auto, On, OffAuto: big rocks and plants cast shadows, ground cover and skyline do not. On: always (never for ground cover). Off: never. TFA's budget of 600 shadow draws for the whole plateau applies on top.TfaStartSlot - what DressStart gets (API 3)
World coordinates; +z points towards your biome. The samplers (Height, Normal,
Lowest, ZoneAt, IsFree) are pure functions of the start line and the seed: the
same numbers on every player.
Idstring. Your biome's id.Seedulong. The seed of your start, the same on every player. UnityEngine.Random is seeded from it inside DressStart; TFA restores its own random state afterwards.Measuredstring. The text the host's MeasureStart returned, or null (none, or over 2 KB as Base64). Read it here instead of measuring.Measuringbool. True inside MeasureStart: the plateau is not shaped yet, the samplers answer NaN and Holder is null.HolderTransform. The inactive group for your set pieces under FA_StartMod on the plateau. Build only here; it wakes together with the finished plateau. Null while measuring.BoundsBounds. The plateau plus the measured band ahead of it (up to 72 m past Front).AnchorVector3. Centre of the wreck's bed.Floorfloat. Height of the plateau floor at the wreck.Frontfloat. The z of the first row of your own ground.LandmarkVector3. Where your landmark stands (the ground under its centre); NaN in every component without one.PathX(z)float. The x of the path axis at z.FrontAt(x)float. The z where the plateau meets your ground at x.Height(x, z)float. Height of the built ground (the plateau mesh, else your measured ground ahead of it), NaN outside.Normal(x, z)Vector3. Ground normal at the point; up where unknown.Lowest(x, z, r)float. The lowest ground of the centre and four points r away - the seat for a boulder. NaN outside.ZoneAt(x, z)TfaStartZone. The zone of a point; None on TFA's own ground and outside.IsFree(x, z, r)bool. Is the disc on ground and clear of TFA's ground, its copies and your reservations?Reserve(x, z, r)bool. Claims a free disc inside DressStart: TFA's scenery keeps off it. False if the disc was not free.Copy(template, name)GameObject. TFA's copy of a template under Holder, without network, physics, particle and animator parts and without PEAK's gameplay scripts (harmless local ones stay); your own scripts stay. Null if refused (a root with a PhotonView, rigidbody or item), and null outside DressStart. You place and turn it.TFA weather keys
The keys for Weathers. New weathers join this list; a key never changes.
stormWindstormrainRainsnowBlizzardsandSandstormsunBurning SunsleepfogSleeping FogsporesSpore CloudpoisonPoison FogshroomrainShroom RaincactusrainCactus RainfoodfrenzyFood FiestafloorlavaThe Floor Is LavadarkDarknessquakeEarthquakemoonBlue MoonbloodBlood MoonwispsWill-o'-WispsantigravAntigravitythunderThunderstormicefogFreezing fogpetrifyPetrifying SunwatchScoutmaster's WatchtsunamiTsunamifloodFlash FloodavalancheAvalanchevolcanoVolcanic EruptionshockfrostFlash FreezehayfeverPollen SeasonTfaBiomes
Register(biome)Registers your biome; false (with a log line) if something is missing.IsFinalAscentRunAsk it when an island scene loads: true if that island is a FINAL ASCENT island.ApiVersion3 since True Final Ascent 3.0.0 (2 was the API before the start plateau). Raised when the API changes in a way your code must follow; members of a higher API exist only when it says so.Testing
Set your fields, open the FINAL ASCENT map setup, pick your biome in the list at the stage's heading (or put it into a
Builder mountain), and start. TFA's log lines are in English. In BepInEx/LogOutput.log look for:
Mod biome registered: 'yourid' 1.0.0 for Tropics, Roots (API 2, without frame weather, fog pace x0.80, own weather weights, with rise).at game start. The API number is theApiLevelyou set; after it only what you set appears:DropFromFrame,FogPace,Weathers,Rise. ADropFromFrame,FogPaceorWeathersvalue TFA had to clamp, or an unknown weather key, is warned about right there.Riseis not checked at registration (see the next point).Mod biome 'yourid' 1.0.0 replaces Tropics (0.4s, seed 12345, rise +40).while the island builds, in the TFA BuilderMod biome 'yourid' 1.0.0 at place 3 in frame Tropics (0.4s, seed 12345, rise +40).It names the rise (rise +40), and on the hostMod biome 'yourid' raises Tropics by +40 (seed 12345).comes when the run starts. That is whereRiseis checked: a value outside -30..100 is warned about right before it (Mod biome 'yourid': rise 150 outside -30..100 - clamped to 100.), aRisethat throws is logged asMod biome 'yourid': Rise threw (...)and counts as 0. Errors from yourBuildshow up there in full.Mod biome 'yourid' in Tropics: frame weather held, mild nights, fog pace x0.80, own weather weights, rise +40.when the group enters your stage (in the Builderin place 3 (Tropics)), once per player and only with the parts you set.- In Apocalypse mode the host logs every roll, such as
Cycle rolls: quake (Rare) 12 s, Tropics, mod biome 'yourid', day, level Normal.Your id appears whenWeathersdecided the pot.
A start plateau (API 3) adds these lines. Put your biome first in a Builder mountain, with ApiLevel 2 or
3, and start:
Mod biome registered: 'yourid' 1.0.0 for Tropics, Roots (API 3, ..., own start: 3 layers, landmark, ambience, dress).at game start. The API number is yourApiLevel; afterown start:only what you set appears (3 layersorautomatic layers,landmark,ambience,water,dress,start measure). WithApiLevel1 TFA warns instead:Mod biome 'yourid': Start, DressStart and MeasureStart are never used - ApiLevel 1 never stands first.Start style of mod 'yourid': 3 layers, landmark 'Props/T_crystal_spire', ground Floor.while the island builds, on every player: what TFA read from yourStart. Problems are warned about once each, for exampleStart style 'yourid': layer 2 has no template - skipped.,Start style 'yourid': layer 1 template 'Props/T_x' not found - skipped.,Start style 'yourid': layer 3 zones Bed not allowed for Rock - using Field.orStart style 'yourid': AllowWater without Water - no ponds.Start measure 'yourid': 412 characters, 552 as Base64.on the host, when yourMeasureStartreturned text. Over 2 KB as Base64 TFA drops it withStart line key 'mod.yourid' over 2 KB - dropped, andslot.Measuredis null on every player. IfMeasureStartthrows:Start measure 'yourid' threw: ... - no measurement.Builder: start spot in front of Tropics (mod 'yourid'): ..., style 3 layers (412 copies), landmark at left, dress 37 objects in 4 ms, ..., as on the host.while the island builds, on every player. The numbers name your layers and their copies, the landmark's side and the objects of yourDressStartwith the time it took. Instead you may readstyle automatic layers,no landmark,landmark not planned,landmark refused by the budget,no dressordress removed (threw). On a guest the line ends withas on the hostwhen the plateau matches the host's; on the host nothing follows.Start mod 'yourid': style 3 layers (412 copies), landmark at left, dress 37 objects in 4 ms, side grove 5, own ambience hum, ground Floor on 38 renderers, host measure 412 characters; FA_StartMod: 0 rigidbodies, 0 joints, 0 PhotonViews.a few lines before theBuilder: start spotline, with the same numbers and what else TFA placed for you: the side grove, your ambience, the ground swap and the length of the host's measure text. Only the parts you set appear. After the semicolon: what is left of the network and physics parts underFA_StartMod- it should be 0 everywhere.Start dress 'yourid': 2 PhotonViews removed, 1 object in the spawn fan hidden, 120 over the budget hidden, 37 footprints reserved, 5 reservations by the mod.what TFA removed, hid or switched off after yourDressStart(nothing removedwhen it did nothing) and how many footprints it reserved. A script of yours that requires a removed part ([RequireComponent]) goes with it:1 script that required a removed part removed. A template whose root carries aPhotonView, a rigidbody or an item can't be copied:Start dress 'yourid': template 'x' has a network, body or item root - not copied.(for a layer or the landmarkStart style 'yourid': ...).Start dress 'yourid' threw: ... - removed, the plateau stays.yourDressStartthrew an exception (a stack follows as a warning). TFA removed what it made on that player. Slow runs are reported too:Start dress 'yourid' took 312 ms (over 250 ms)...., MISMATCH (host 1A2B3C4D) in mthe end of theBuilder: start spotline on a guest whose plateau differs from the host's. The letters name the parts that differ:mis your style and yourDressStart, the others are TFA's. A few lines before theBuilder: start spotline comesStart dress 'yourid' differs from the host - 37 colliders under FA_StartMod off.
Test once with a second player and once with a late joiner.
Questions or ideas for the API? Write to CptPICHU on the PEAK Modding Discord.
Dein Biom im FINALEN AUFSTIEG
Mit der TFA-Biom-Schnittstelle kann deine Mod ein eigenes Biom auf die Insel des FINALEN AUFSTIEGS bringen. Im klassischen Aufstieg ersetzt es eine Etappe - etwa die Tropen; im Baukasten ist es ein Baustein, den Spieler in ihren eigenen Berg stapeln. Spieler wählen es in der Kartenkonfiguration in der Liste an der Biom-Überschrift oder legen es im Baukasten als Baustein an. Die Etappe trägt dann den Namen deines Bioms. Dein Biom kann TFA auch sagen, was seine Etappe braucht: welches Wetter des Rahmens wegfällt, wie schnell der Nebel zuzieht, welche von TFAs Wettern dort würfeln und wie viel höher oder niedriger die Etappe liegt. Als erster Baustein eines Baukasten-Bergs kann es auch das Startplateau ausschmücken, auf dem die Spieler aufwachen.
- Rahmen für dein Biom: Tropen, Wurzeln, Alpen, Mesa - das PEAK-Biom, dessen Länge, Höhe und Lagerfeuer deine Etappe nutzt. Im klassischen Aufstieg ersetzt dein Biom diese Etappe; im Baukasten setzen Spieler es an jede Stelle ihres eigenen Bergs, auch mehrfach (bis
MaxPerRun), in einem seiner Rahmen. - Nie auf der Tageskarte - deren Zeiten müssen vergleichbar bleiben.
- Alle in der Lobby brauchen deine Mod in derselben Fassung. Sonst kann der Host mit deinem Biom nicht starten.
- Normale PEAK-Läufe bleiben deine: TFA ruft deine Mod nur, wenn eine Insel des FINALEN AUFSTIEGS gebaut wird.
Schnellstart
1. True Final Ascent einbinden
Installiere True Final Ascent mit r2modman und binde seine DLL aus deinem Profil ein. Liefere sie nicht in deinem Paket mit.
<Reference Include="TrueFinalAscent">
<HintPath>...\BepInEx\plugins\CptPICHU-TrueFinalAscent\TrueFinalAscent.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>...\steamapps\common\PEAK\PEAK_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
Die zweite Referenz ist PEAKs eigene Assembly-CSharp.dll (dazu die UnityEngine-Module, die du nutzt; alle
in PEAK_Data/Managed). TfaBiomeSlot zeigt PEAK-Typen wie Campfire
(slot.EndCampfire) und DayNightProfile (slot.Sky); ohne sie bricht der
Compiler mit CS0012 ab, sobald du sie anfasst.
2. Als optionale Abhängigkeit
Deine Mod soll auch ohne TFA laufen. Gib eine weiche Abhängigkeit an und fasse TFAs Typen nur an, wenn TFA 3.0.0 oder neuer da ist - in einer eigenen Klasse, dann lädt .NET sie sonst nie. TFAs Schnittstellentypen gibt es erst ab 3.0.0; in einem älteren TFA fehlen sie, und schon der erste Zugriff wirft einen Fehler.
using System;
using BepInEx;
using BepInEx.Bootstrap;
[BepInPlugin("you.crystalcaves", "Crystal Caves", "1.0.0")]
[BepInDependency("com.CptPICHU.peak.truefinalascent", BepInDependency.DependencyFlags.SoftDependency)]
public class CrystalCavesPlugin : BaseUnityPlugin
{
private void Awake()
{
// Touch TFA's types only when TFA 3.0.0 or newer is installed: on an older one they are missing and the first touch
// throws. Without TFA your mod keeps working as before.
if (Chainloader.PluginInfos.TryGetValue("com.CptPICHU.peak.truefinalascent", out PluginInfo tfa)
&& tfa.Metadata.Version >= new Version(2, 10, 0))
{
TfaBridge.Register();
}
}
}
Prüfe TfaBiomes.ApiVersion (in TFA 3.0.0 ist sie 3), bevor du etwas nutzt, das neuer ist als dein
Minimum: Mitglieder einer höheren API gibt es nur, wenn sie es sagt. Setz sie in einer eigenen Methode mit
[MethodImpl(MethodImplOptions.NoInlining)] - .NET löst die Mitglieder einer Methode auf, sobald sie zum
ersten Mal läuft; ein unbekanntes Mitglied in deiner Anmelde-Methode ließe sonst die ganze Anmeldung scheitern
(MissingMethodException). Diese Seite ist API 2, außer dem Kapitel
Dein Startplateau, das API 3 ist.
3. Biom anmelden
Einmal, in Awake. Id ist kurz und eindeutig, Version muss bei allen gleich sein,
Names braucht mindestens Englisch. Die API-2-Felder am Ende sind optional.
using System.Collections;
using System.Collections.Generic;
using TrueFinalAscent.Api;
using UnityEngine;
internal static class TfaBridge
{
public static void Register()
{
TfaBiomes.Register(new TfaBiome
{
Id = "crystalcaves",
Version = "1.0.0", // raise it whenever your generation changes
Replaces = new[] { "Tropics", "Roots" },
Names = new Dictionary<string, string>
{
["en"] = "Crystal Caves",
["de"] = "Kristallhöhlen",
["cn"] = "水晶洞穴",
},
Ink = new Color(0.55f, 0.85f, 1f),
Build = Build,
PlayersHere = OnPlayersHere,
// API 2 - all optional, each one is explained below
ApiLevel = 2, // may also stand first in the climb (Builder)
DropFromFrame = TfaFrameParts.Weather, // underground: no rain, no gusts
FogPace = 0.8f, // a twistier way up - a little more time
Weathers = new Dictionary<string, int> { ["*"] = 0, ["quake"] = 2, ["dark"] = 1, ["poison"] = 1 },
});
}
// Build and OnPlayersHere: see below.
}
4. Bauen
TFA ruft Build bei jedem Spieler auf, während die Insel lädt. Dieses Beispiel legt eine grobe Felsrampe vom
Start- zum Ziel-Lagerfeuer:
private static IEnumerator Build(TfaBiomeSlot slot)
{
// Root sits at the start campfire, +Z points towards the end campfire, +Y is up.
Transform root = slot.Root.transform;
Vector3 goal = root.InverseTransformPoint(slot.EndCampfire.transform.position);
// Borrow a material from PEAK's terrain of the stage you replace.
Material rock = slot.VanillaTerrain.GetComponentInChildren<MeshRenderer>(true).sharedMaterial;
int ground = LayerMask.NameToLayer("Terrain");
const int steps = 60;
for (int i = 0; i <= steps; i++)
{
float t = i / (float)steps;
GameObject step = GameObject.CreatePrimitive(PrimitiveType.Cube);
step.layer = ground;
step.GetComponent<MeshRenderer>().sharedMaterial = rock;
step.transform.SetParent(root, false);
step.transform.localPosition = Vector3.Lerp(Vector3.zero, goal, t)
+ Vector3.right * Random.Range(-4f, 4f); // seeded by TFA: the same on every player
step.transform.localScale = new Vector3(10f, 1f, 9f);
if (i % 15 == 0)
{
yield return null; // spread the work, the loading screen stays smooth
}
}
}
Wo du baust
Dein Build bekommt einen TfaBiomeSlot:
Rootsteht am Start-Lagerfeuer und schaut zum Ziel-Lagerfeuer (+Z vorwärts, +Y oben). Bau alles darunter - TFA blendet es mit der Etappe ein und aus.StartCampfireist, wo die Spieler herkommen,EndCampfire, wo sie hinmüssen. Beide bleiben, wie sie sind. Dein Weg nach oben muss das Ziel-Lagerfeuer erreichen. Im Baukasten kannStartCampfirenull sein (siehe unten).StartPointist, wo die Spieler deine Etappe betreten (das Feuer des Start-Lagerfeuers, wo es eins gibt),EndPointdas Feuer des Ziel-Lagerfeuers, wo dein Weg nach oben ankommen muss. Bau vom einen zum anderen, dann funktioniert dein Biom überall.EndCampfireGroupist das ganze Lagerfeuer samt Fels. Was du darunter hängst, erscheint und verschwindet mit dem Feuer - gut für ein Tor oder einen Schrein direkt am Ziel.VanillaTerrainist PEAKs Gelände der Etappe. TFA blendet es nach deinem Bau aus. Lies es als Vorlage (Felsen, Koffer, Materialien), ändere es nie.
Gleiche Welt für alle
Dein Biom wird nicht übertragen: Jeder Spieler baut es selbst. Der Bau muss also überall genau dasselbe ergeben.
- Zufall: In
Buildsetzt TFAUnityEngine.Randomaufslot.Seed- nutz es ruhig. Nie Uhrzeit, Bildzähler oder Zufall von anderswo. - Strahlen: Die Physik rundet von CPU zu CPU minimal anders. Vermiss die Welt nur in
Measure- das läuft beim Host, und jeder Spieler bekommt den Text inslot.Measured. - Netzwerk: PhotonViews unter
Rootbekommen ihre Nummern von TFA. Lass sie auf 0. - Version: Erhöhe
Version, sobald sich deine Generierung ändert. Spieler mit anderer Fassung können nicht gemeinsam mit deinem Biom starten.
Measure = slot =>
{
// Host only. Raycasts can differ by a hair between CPUs - TFA ships this text to every player.
Vector3 above = slot.EndCampfire.transform.position + Vector3.up * 3f;
Physics.Raycast(above, Vector3.down, out RaycastHit hit, 20f);
return hit.point.y.ToString(System.Globalization.CultureInfo.InvariantCulture);
},
// ...and in Build, on every player - null if no host value arrived:
float endGround = slot.Measured != null
? float.Parse(slot.Measured, System.Globalization.CultureInfo.InvariantCulture)
: slot.EndCampfire.transform.position.y;
Dein Biom im Baukasten
Im Baukasten stapeln Spieler ihren eigenen Berg aus Biom-Bausteinen. Dein Biom ist auch ein Baustein: Es wird in
einem seiner Replaces-Rahmen gebaut (der Host wählt ihn je Baustein, der erste ist der Standard), wo
immer der Spieler es hinsetzt - auch mehrfach, bis MaxPerRun.
- Dort ist
slot.InBuilderwahr.slot.Positionist der Platz in der Kette, der Rahmen kann eine Kopie sein, undPreviousundNextkönnen jedes Biom sein,mod:plus Kennung,""(erstes) oderPeak(letztes). - Als Erstes im Aufstieg oder direkt nach Kiln, Zitadelle oder Nadir führt kein Lagerfeuer in deine Etappe:
StartCampfireist null. Starte stattdessen beislot.StartPoint. TFA setzt dein Biom nur dorthin, wenn duApiLevelauf 2 oder höher setzt. Als Erstes im Aufstieg wachen die Spieler auf einem Startplateau vor deinem Boden auf - Dein Startplateau zeigt, wie du es ausschmückst. slot.StartPointundslot.EndPointsind, wo die Spieler einsteigen und wo dein Weg nach oben ankommen muss (das Feuer des Ziel-Lagerfeuers). Sie sind auch im klassischen FINALEN AUFSTIEG gesetzt - bau vom einen zum anderen, dann funktioniert dein Biom überall.- Letzter Baustein: Ist
NextgleichPeak, nimmt TFA nach deinem Bau Feuer, Koffer und Statue vom Ziel-Lagerfeuer. Der Fels bleibt, und die Brücke zum PEAK beginnt gleich dahinter (+Z) - halte diese Seite frei. InBuilder = falsehält dein Biom aus dem Baukasten heraus, für Bauten, die nur an ihrem klassischen Platz funktionieren.Fits(frame, previous, next)ist optional: Gib falsch zurück, wo dein Biom nicht stehen kann. Es wird gefragt, während der Host die Kette bearbeitet, muss also schnell sein und bei allen Spielern dasselbe antworten. Wirft es einen Fehler, behandelt TFA es als wahr.
biome.ApiLevel = 2;
biome.Fits = (frame, previous, next) => previous != "Kiln"; // our entrance needs solid ground, not a lava rim
Dein Startplateau (API 3)
Beginnt ein Berg im Baukasten nicht an der Küste, wachen die Spieler nach dem Flugzeugabsturz auf einem
Startplateau auf: einem breiten, flachen Stück Boden, das TFA vor das erste Biom legt, mit dem Wrack, den
Spawnpunkten, zwei Koffern, einem Weg zu deinem Aufstieg und einer Nebelwand dahinter. Ist der erste Baustein deiner,
trägt das Plateau dein Biom. Das tut es schon ohne Arbeit von dir (siehe
Automatisch ausgeschmückt); mit API 3 beschreibst du den Look selbst, als Daten in
Start und, für Schaustücke, als Code in DressStart.
- Nur im Baukasten, nur der erste Baustein. Der klassische Modus FINALER AUFSTIEG, die Tageskarte und ein Start an der Küste bekommen kein Plateau; API 3 ändert dort nichts.
- Braucht
ApiLevel2 oder 3. Beide setzen dein Biom an die erste Stelle; setz 3, sobald dein CodeStartoderDressStartnutzt, dann zeigt es die Anmeldezeile.StartmitApiLevel1 wird nie benutzt, und TFA sagt das im Log. - „Gleiche Welt für alle“ gilt. Jeder Spieler baut das Plateau aus denselben Zahlen und demselben Seed. Der Fingerabdruck des Hosts reist mit der Insel, und jeder Gast vergleicht seinen eigenen (siehe Testen).
Was TFA behält
Was du auch erklärst: Diese Teile gehören TFA. Deine Schichten und dein DressStart halten sich heraus. Die
Nummern zeigen in die Zeichnung unter Zonen.
slot.Anchor. Im Bett (30 m um das Wrack) wächst nur Bodendecker; er hält 6 m Abstand zum Rumpf, feste Kopien 14 m.slot.PathX). Die Mulde bleibt frei, im Umkreis von 12 m um ihre Achse steht nichts Höheres als 1,5 m, bis 18 m nur Niedriges.Als Erstes stehen: dein Boden
TFA legt das Plateau vor die erste Zeile deines Bodens. Um sie zu finden, sucht der Host von slot.StartPoint
aus nach begehbarem Boden auf der Ebene Terrain unter deiner Root:
- von 40 m hinter bis 160 m vor
StartPointund zwischen 30 m darüber und 160 m darunter; - die erste Zeile, in der mindestens 8 von 25 Messpunkten quer über einen 96 m breiten Streifen (alle 4 m einer) solchen
Boden haben, ist die Front. Felsen auf der Ebene
Mapzählen bei einer Mod nicht als Boden; - ohne solchen Boden legt TFA ein flaches Plateau an
StartPointund sagt es im Log - dein Biom scheitert deswegen nie.
Das Plateau reicht bis zu 124 m hinter die Front (mehr, wo dein Boden tiefer liegt). Lass diesen Streifen leer: Alles von dir, was dort liegt, steckt unter dem Wrack und den Spawnpunkten.
Automatisch ausgeschmückt
Ohne Start - oder mit einem Start, dessen Layers null ist - schmückt
TFA das Plateau selbst aus dem, was dein Biom mitbringt:
- Es liest die PEAK-Spawner unter
slot.Root(PropSpawner,DecorSpawnerundSpawnList, auch inaktive Varianten) und sortiert ihre Prefabs nach Größe und Form in Felsen, hohe Dinge, Pflanzen und Bodendecker. Alles wird in TFAs üblicher Dichte gestreut. - Felsen kommen zuerst aus deinen Spawnern, dann aus den Brocken, die du auf der Ebene
Mapgebaut hast, dann aus dem Lager deines Rahmens. Pflanzen deines Rahmens nutzt TFA nie. - Das Plateau übernimmt das Bodenmaterial deines Bioms und das Relief deines Rahmens. Landmarke, Lichtmarken und Teiche des Rahmens bekommt es nicht. Dein eigener Boden vor dem Plateau bleibt unberührt.
- Ein Biom, das ganz im Code entsteht, ohne PEAK-Spawner, bekommt nur Relief und Felsen. Gib ihm Schichten.
Den Look beschreiben: TfaStartStyle
Setz Start an deinem TfaBiome, und TFA macht daraus das Plateau. Es sind schlichte Daten - pro
Objekt läuft kein Code -, also ist es bei allen Spielern gleich. TFA klemmt jede Zahl auf ihren Bereich und überspringt,
was es nicht brauchen kann, mit je einer Logzeile. Wie bei jeder neueren API gehören die API-3-Mitglieder in eine eigene
Methode (Schnellstart, Schritt 2):
using System.Runtime.CompilerServices;
using TrueFinalAscent.Api;
internal static class TfaBridge
{
public static void Register()
{
TfaBiome biome = new TfaBiome
{
Id = "crystalcaves",
Version = "1.1.0", // Start and DressStart are content: raise it when you change them
Replaces = new[] { "Tropics", "Roots" },
// ... Names, Ink, Build, ApiLevel = 2 and the rest, as in step 3 ...
};
// API 3 members exist only in a TFA whose ApiVersion says so - keep them out of this method.
if (TfaBiomes.ApiVersion >= 3)
{
AddStart(biome);
}
TfaBiomes.Register(biome);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void AddStart(TfaBiome biome)
{
biome.ApiLevel = 3; // placed like 2; 3 says your code knows the start plateau
biome.Start = CrystalStart.Style(); // the look as data
biome.DressStart = CrystalStart.Dress; // set pieces as code (optional)
}
}
Das ist der Stil des Beispielbioms: ein Bodenmaterial, ein sanftes Relief, drei Schichten, eine Landmarke mit Licht und
Klang und ein Klangteppich. Zwei Schichten und die Landmarke nennen Vorlagen, die dein
Build macht (nächster Abschnitt); die dritte Schicht nimmt eine PEAK-Pflanze.
using System.Collections.Generic;
using TrueFinalAscent.Api;
using UnityEngine;
internal static partial class CrystalStart
{
// Loaded from your asset bundle in Awake.
public static Material Floor, Glass;
public static AudioClip Hum, Chime;
// Plain data: TFA clamps it and builds the same plateau on every player.
public static TfaStartStyle Style()
{
return new TfaStartStyle
{
Ground = Floor, // null = the largest ground material under your Root
Relief = new TfaStartRelief { Hill = 2.5f, Rough = 0.6f, Mounds = 18 }, // fields left at -1 keep the frame's value
Layers = new List<TfaStartLayer>
{
// Tall crystals as the plateau's walls, from templates your Build makes (next section).
new TfaStartLayer
{
Find = "Props/T_crystal_tall", Kind = TfaStartKind.Tall,
Zones = TfaStartZone.Back | TfaStartZone.Sides, Density = 12f, ScaleMin = 0.9f, ScaleMax = 1.5f,
},
// Boulders in loose groups across the field; they keep your own glow script.
new TfaStartLayer
{
Find = "Props/T_boulder", Kind = TfaStartKind.Rock, Zones = TfaStartZone.Field,
Density = 8f, Cluster = 0.7f, Keep = new[] { "CrystalGlow" },
},
// Ground cover from PEAK's own Roots pool: nothing to ship.
new TfaStartLayer
{
Vanilla = "Roots:Fern", Kind = TfaStartKind.Cover,
Zones = TfaStartZone.Field | TfaStartZone.Path | TfaStartZone.Bed, Density = 40f,
},
},
Landmark = new TfaStartLandmark
{
Find = "Props/T_crystal_spire", Scale = 1.2f, Radius = 9f, Sink = 1.5f, Sound = Chime,
Glow = new Color(0.45f, 0.8f, 1f, 1f), // alpha above 0: a light marker, like TFA's darkness lamps
},
RockMax = 6f,
Ambience = Hum,
AmbienceVolume = 0.4f,
ClimbPractice = true, // two stacked rocks with a luggage case on top
};
}
}
- Schichten wachsen in den Zonen, die du nennst, in der Dichte, die du angibst. Mehrere kleine Schichten wirken
besser als eine große; höchstens 16 zählen. Gibst du eine Liste an - auch eine leere -, ersetzt sie die automatische
Ausschmückung: TFA fügt keine eigenen Felsen oder Pflanzen hinzu, bring deine Felsen also als
Rock-Schicht mit. TFA hält den Blick vom Wrack zum Wegende frei: Im Umkreis von 25 Grad um diese Linie steht nichts Höheres als 6 m, und eine Kopie, die es täte, wird zur Seite verschoben oder übersprungen. - Die Landmarke steht in TFAs Platz auf einem flachen Podest, das in den Boden übergeht, sie schwebt also nie. Wähl ein Modell mit klarer Silhouette: Die Spieler sehen es vom Wrack aus. TFA setzt die Unterkante des Meshs auf das Podest, egal wo der Pivot liegt; der Nebenhain setzt 3 bis 7 Kopien deiner Pflanzen dazu.
- Die zwei Start-Koffer und die Kletterübung gehören TFA, mit der Beute deines Rahmens; du wählst nur, ob die
Übung gebaut wird (
ClimbPractice). - Teiche brauchen
AllowWaterund einWater-Material; TFA legt sie an und gibt ihnen eine echte Wasserzone. - Klang: Ohne
Ambienceleiht TFA einen Klangteppich, den es unter deiner Wurzel findet.
Vorlagen: Template, Find, Vanilla
Jede Schicht und die Landmarke nennt genau ein Modell:
Template- ein Prefab aus deinem Asset-Bundle oder ein Szenenobjekt (inaktiv ist in Ordnung).Find- ein Pfad unter deinerRoot, aufgelöst nachBuild. Für Modelle, die deinBuildselbst macht: Mach sie einmal, inaktiv, unter einem Objekt „Props“ und gib ihnen schlichte Namen.Vanilla- ein PEAK-Prefab, das die Spawner dieses Bioms nennen, etwa"Tropics:Jungle_Willow_Big". Nichts mitzuliefern. Kopien beginnen mit der Größe und Drehung, die ihr Spawner ihnen gibt, und deine Skalierung wirkt obendrauf.
// In your Build (every player): make the templates once, inactive, under your Root. Find reads them after Build.
private static IEnumerator Build(TfaBiomeSlot slot)
{
Transform props = new GameObject("Props").transform;
props.SetParent(slot.Root.transform, false);
props.gameObject.SetActive(false); // templates only: never seen, never walked on themselves
Template(props, "T_crystal_tall", PrimitiveType.Capsule, new Vector3(2.5f, 8f, 2.5f));
Template(props, "T_crystal_spire", PrimitiveType.Capsule, new Vector3(5f, 21f, 5f));
Template(props, "T_boulder", PrimitiveType.Sphere, new Vector3(3f, 2f, 3f));
// ... then the ground and the way up, as in the quick start ...
yield return null;
}
private static void Template(Transform parent, string name, PrimitiveType shape, Vector3 size)
{
GameObject model = GameObject.CreatePrimitive(shape);
model.name = name; // plain name: "Props/T_crystal_tall" finds it
model.layer = LayerMask.NameToLayer("Map"); // props on Map, walkable ground on Terrain
model.transform.SetParent(parent, false);
model.transform.localScale = size;
model.GetComponent<Renderer>().sharedMaterial = CrystalStart.Glass;
}
TFA misst ein Modell an seinen Meshes, nicht an Renderer.bounds (das ist bei inaktiven Objekten null). Jede
Kopie macht TFA: Sie behält Meshes, Materialien, Kollider und die Skripte, die du in Keep nennst, und
entfernt den Rest (siehe Was TFA entfernt). LOD-Gruppen an der Wurzel bleiben.
Zonen
Eine Schicht sagt, in welchen Zonen sie wächst. Die Zeichnung zeigt das Plateau von oben, dein Boden liegt oben; die
Nummern 1 bis 6 sind die Zonen der Tabelle, 7 bis 10 TFAs eigene Teile aus der Tabelle weiter oben. Wie eine Kopie auf
dem Boden sitzt und welche Art wo stehen darf, bestimmt das TfaStartKind der Schicht (siehe Übersicht).
| Nr. | Wert | Wo | Erlaubte Arten |
|---|---|---|---|
| 1 | TfaStartZone.Back | Der Streifen an der Rückkante, 36 m tief, vor der Nebelwand - der Platz für eine Skyline. | Rock, Plant, Cover, Tall |
| 2 | TfaStartZone.Sides | Die äußeren 42 m jeder Seite, auf den Wällen - die Wände deines Bioms. | Rock, Plant, Cover, Tall |
| 3 | TfaStartZone.Field | Die offene Mitte: der Ring um das Wrack, das Band vor der Front und alles zwischen Wällen und Rückwand. | Rock, Plant, Cover |
| 4 | TfaStartZone.Bed | Innerhalb von 30 m um das Wrack. Nur Bodendecker, und nie näher als 6 m am Rumpf. | Cover |
| 5 | TfaStartZone.Path | Neben dem Weg, 4 bis 18 m von seiner Achse, von 20 m vor dem Wrack bis zur Front: bis 1,5 m hoch im Umkreis von 12 m um die Achse, darüber hinaus bis 6 m. Die Mulde selbst bleibt immer frei. | Plant, Cover |
| 6 | TfaStartZone.Front | Auf deinem eigenen Boden vor dem Plateau, bis 72 m hinter seiner ersten Zeile, soweit der Host ihn vermessen hat; eine Gasse von 12 m zu jeder Seite des Wegendes bleibt frei. Aus, solange keine Schicht es verlangt: TFA schmückt deinen eigenen Boden sonst nicht. | Rock, Plant, Cover |
Schaustücke: DressStart
Für das, was Daten nicht sagen können - ein Kristallring um die Landmarke, eine Brücke, ein Wegweiser - läuft
DressStart einmal bei jedem Spieler mit deinem Code. Es läuft, nachdem TFA das Plateau und seine eigenen
Teile (Wrack, Spawn-Fächer, Koffer, Weg, Landmarke) gelegt hat, und bevor TFA deine Schichten streut: Deine Schaustücke
haben den ersten Zugriff auf den Boden, und TFA füllt den Platz drumherum. Ist Layers null, stehen TFAs
automatische Schichten schon, wenn es läuft.
using TrueFinalAscent.Api;
using UnityEngine;
internal static partial class CrystalStart
{
// Loaded from your asset bundle in Awake: content bound to your Version, the same on every player.
public static GameObject CrystalPrefab;
// A ring of 8 spots as literal numbers: Sin and Cos may round differently per CPU, a table cannot.
private static readonly Vector2[] Ring =
{
new Vector2(16f, 0f), new Vector2(11.3f, 11.3f), new Vector2(0f, 16f), new Vector2(-11.3f, 11.3f),
new Vector2(-16f, 0f), new Vector2(-11.3f, -11.3f), new Vector2(0f, -16f), new Vector2(11.3f, -11.3f),
};
// Every player, after TFA laid the plateau and its own parts, before TFA scatters. Pure: only the slot and Random.
public static void Dress(TfaStartSlot slot)
{
if (CrystalPrefab == null || float.IsNaN(slot.Landmark.x))
{
return; // nothing to copy, or this style has no landmark to put a ring around
}
foreach (Vector2 offset in Ring)
{
// UnityEngine.Random is seeded from slot.Seed in here: the same numbers on every player.
float x = slot.Landmark.x + offset.x + Random.Range(-1.5f, 1.5f);
float z = slot.Landmark.z + offset.y + Random.Range(-1.5f, 1.5f);
float y = slot.Height(x, z);
if (float.IsNaN(y) || !slot.IsFree(x, z, 2.5f))
{
continue; // off the plateau, or TFA's wreck, fan, path or landmark is there
}
GameObject crystal = slot.Copy(CrystalPrefab, "ring crystal"); // TFA's stripped copy under slot.Holder
if (crystal == null)
{
continue;
}
crystal.transform.position = new Vector3(x, y - 0.4f, z);
crystal.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
crystal.transform.localScale *= Random.Range(0.8f, 1.3f);
slot.Reserve(x, z, 2.5f); // TFA's own scatter keeps out of the disc
}
}
}
Der Vertrag ist der von Build, nur strenger, weil TFA das Ergebnis vergleicht (siehe
Testen):
- Nur Rechnung. Rechne nur aus dem
TfaStartSlot- seinem Seed, seinen Messfunktionen, dem Text des Hosts inslot.Measured- und aus Inhalt, der an deineVersiongebunden ist. Deine eigene Konfiguration, die Szene, die Uhrzeit und Bildzähler sind von Spieler zu Spieler verschieden und lassen das Plateau abweichen. - Zufall.
UnityEngine.Randomwird inDressStartausslot.Seedgesetzt; danach stellt TFA seinen eigenen Zustand wieder her. Nimm keine andere Quelle, keine Schleife über Mengen mit Unity-Objekten als Schlüssel, nichts, was an der Reihenfolge vonFindObjectsByTypehängt. - Keine Physik. Das Plateau ist inaktiv, solange du läufst; ein Strahl kann es nicht treffen. Nutz
Height,NormalundLowest: Sie sind bei allen Spielern gleich. - Nur unter
Holder(slot.Copysetzt seine Kopien dorthin). Keine PhotonViews, Rigidbodys, Items oder Spawner; begehbare Kollider auf die EbeneTerrain, Requisiten aufMap. - Skripte, die du behältst oder hinzufügst, wachen auf, wenn das ganze Plateau steht. Sie laufen bei jedem Spieler, müssen lokal sein und dürfen keine Kollider bewegen.
- Rechnen. TFA vergleicht Lagen auf 1/16 m. Nimm lieber
+ - * /,Sqrt,FloorundAbs; meideSin,Cos,Powund Perlin-Rauschen für Positionen, sonst zeigt eine CPU, die anders rundet, eine Abweichung. Eine Tabelle mit festen Zahlen, wie im Beispiel, ist am sichersten. - Schnell. Es läuft im Ladebildschirm, ohne Bilder abzugeben. Bleib unter 250 ms; höchstens 400 Objekte mit Renderern zählen.
- Gemeinsam scheitern. Wirft es einen Fehler, wird bei diesem Spieler alles entfernt, was es gemacht hat. Sorg dafür, dass es überall oder nirgends scheitert.
Braucht dein Schaustück die wirkliche Form der Welt, etwa deinen Boden vor dem Plateau? Strahlen sind wie bei
Measure Sache des Hosts: Setz MeasureStart. Es läuft einmal beim Host, bevor das Plateau
geformt wird (slot.Measuring ist wahr, die Messfunktionen antworten NaN), und liefert Text; jeder Spieler
liest diesen Text in slot.Measured. Halt ihn kurz: Über 2 KB als Base64 verwirft TFA ihn, und
Measured ist null.
Was TFA entfernt, klemmt und ablehnt
TFA kann einen Strahl aus deinem Code nicht aufhalten, also macht es das Ergebnis sicher und bei allen Spielern gleich.
Das geschieht nach deinem Stil und nach DressStart, bevor das Plateau aufwacht:
PhotonView und Item (samt dem Teil, an dem sie sitzen), Rigidbody, jedes Joint, ConstantForce, Cloth, jedes Partikelsystem und jeder Animator oder jede Animation werden aus jeder Kopie und allem unter deiner DressStart-Gruppe entfernt, bevor etwas aufwacht. Ein Skript von dir, das eines davon verlangt ([RequireComponent]), wird vorher entfernt. Das Log zählt sie.CollisionModifier, ...) werden entfernt. Nur harmlose lokale bleiben: ClimbModifierSurface ohne Status oder Versteinerung, WaterZone, AudioLoop, BakedVolumeLight, WobbleSpinBounce, kühlende StatusEmitter und StatusField und ein CollisionModifier, der niemanden verletzt oder wegstößt. Deine eigenen Skripte bleiben an Copy-Kopien; an den Kopien einer Schicht bleiben nur die in Keep genannten, und Trigger, Lichter und Klänge werden dort entfernt.DressStart, dessen Grundfläche den Spawn-Fächer, das Wrack (mit 6 m Rand), die Wegmulde oder eine von TFA geplante Scheibe (Koffer, Landmarke, Teiche) berührt, wird samt allem darunter ausgeblendet. Bei allen Spielern gleich.Layers null, stehen TFAs automatische Schichten schon, wenn DressStart läuft, und zählen zuerst.Reserve ist für den Platz um deine Objekte; seine Scheiben zählen nur, wenn DressStart zurückkehrt.DressStart. Eine Abweichung steht als Fehler im Log und bleibt, wie sie ist: Nichts wird zurückgenommen.DressStart einen Fehler, wird alles entfernt, was es gemacht hat - seine Stücke und seine Reservierungen -, und das Plateau bleibt, als hättest du kein DressStart. Die Schichten und die Landmarke deines Stils bleiben. TFA loggt den Fehler und seinen Stack. Sorg dafür, dass es überall oder nirgends scheitert.m des Fingerabdrucks) vom Host ab, schaltet der Gast alle Kollider unter FA_StartMod aus - deine Schichten und deine Schaustücke -, damit es keine unsichtbaren Wände und keine Löcher am Spawn gibt, und loggt es. Das Aussehen kann trotzdem abweichen, also mach es identisch.Alles zusammen hält sich das Plateau an dieses Budget. Gezählt wird an den fertigen Kopien, also lehnt jeder Spieler dieselbe Kopie ab.
| Grenze | Deckel | Darüber |
|---|---|---|
| Kopien auf dem Plateau | 1000 | Die nächsten Kopien werden abgelehnt, in der Reihenfolge des Platzierens - bei allen Spielern dieselben. |
| Felsen / große Pflanzen / Bodendecker | 320 / 420 / 480 | Je Art, wie oben. |
| Landmarke, Nebenhain | Landmarke 1 Kopie, Nebenhain 3 bis 7 | Beide zählen bei den Kopien oben mit. |
| Schattenwürfe | 600 | Werfende Renderer x Materialplätze. Darüber werden Schatten abgeschaltet, ausgeblendet wird nichts: Die Landmarke behält ihre Schatten am längsten, dann die größten Schatten nahe dem Weg vom Wrack durch die Mulde und über die Front hinaus; Bodendecker wirft nie. |
| LOD0-Renderer | 2500 | Erst Bodendecker, dann Pflanzen, dann Felsen werden abgelehnt. |
| LOD0-Dreiecke | 2,5 Millionen | Gleiche Reihenfolge. |
| Kollider | 1500 | Gleiche Reihenfolge; Bodendecker haben keine. |
| Lichtmarken | 4 | Ab der fünften wird die Lichtmarke entfernt. Deine und TFAs zählen zusammen. |
| Wasserflächen | 3 | Keine weiteren Teiche. |
| Neue Klangquellen | 4 | Keine weiteren Quellen. |
| Partikelsysteme | keine für Mods | Aus jeder Vorlage und aus DressStart entfernt. |
Dein DressStart | 400 Objekte, 2 Lichter, 2 Klangquellen | Der Rest wird ausgeblendet oder abgeschaltet, die letzten zuerst. Deine Schaustücke zählen auch bei den Kopien, LOD0-Renderern, Dreiecken und Kollidern des Plateaus oben mit: Ein Stück der obersten Ebene, das nicht mehr passt, wird ausgeblendet. Über 250 ms warnt TFA im Log. |
| Platzieren des ganzen Plateaus | etwa 1 s | TFAs eigenes Zeitziel; es loggt die Zeit neben den Zahlen. |
Deine Etappe, deine Regeln
Dein Biom wird in einem Rahmen gebaut und erbt, was der Rahmen mitbringt: Länge und Höhe, Lagerfeuer, Wetter, kalte Nächte. Mit API 2 sagst du TFA, was vom Rahmen wegfällt, wie schnell der Nebel zuzieht, welche von TFAs Wettern im Apokalypse-Modus in deiner Etappe würfeln und wie hoch deine Etappe liegt. Alles ist optional; ein Biom, das nichts davon setzt, verhält sich genau wie zuvor.
- Erklären, nicht patchen. Sag TFA, was deine Etappe braucht. TFA macht es bei allen Spielern gleich, auch bei Nachzüglern und nach einem Hostwechsel. Schalte PEAKs Wetterzonen, den Nebel und die Kälte nicht selbst ab.
- Alle brauchen dein Biom. Wer später ohne es in einen Lauf kommt, wird aus dem Lauf entfernt: im TFA
Baukasten immer, im klassischen Aufstieg, sobald dein Biom
Riseoder eine Etappen-Regel (DropFromFrame,FogPaceoderWeathers) nutzt. Ein Biom, das nichts davon setzt, verhält sich wie zuvor: Wer es nicht hat, klettert PEAKs eigene Etappe, den Vanilla-Rahmen. - Wetter zur Laufzeit - ein Sturm, wenn die Gruppe ankommt - ist TFAs Wetter-API (der Reiter Wetter) oder dein eigener Code, siehe Wetter selbst starten. Dieser Teil behandelt, was dein Biom erklärt.
- Prüfe die Version, bevor du etwas anfasst, das neuer ist als dein Minimum (Schnellstart, Schritt 2).
Was du vom Rahmen weglässt: DropFromFrame
Standardmäßig behält deine Etappe, was ihr PEAK-Biom mitbringt. DropFromFrame nennt, was sie nicht
behalten soll. Standard TfaFrameParts.None; Teile kombinierst du mit |.
WeatherPEAKs Wetter des Rahmens in normalen Läufen des FINALEN AUFSTIEGS: Regen in den Tropen, Böen in den Wurzeln, der Blizzard in den Alpen, die heiße Sonne auf der Mesa. Im Apokalypse-Modus sind PEAKs Zonen ohnehin still; dort ist es TFAs dauerhafte Mesa-Sonne. Weggelassen, hält TFA dieses Wetter in deiner Etappe bei allen Spielern still.ColdNightKalte Nächte, wie von der Küste bis zur Mesa. Weggelassen, sind die Nächte in deiner Etappe mild, wie ab der Caldera.biome.DropFromFrame = TfaFrameParts.Weather | TfaFrameParts.ColdNight; // a warm, sheltered valley
Schalte PEAKs Wetterobjekte nicht selbst ab: TFAs Regen leiht sich Teile davon, und eine Zone, die bei einem Spieler aus ist, weht bei den anderen weiter. Verlässt die Gruppe deine Etappe, läuft PEAKs Wetter einfach weiter. Neue Teile können später dazukommen; ein Biom lässt immer nur weg, was es nennt.
Nebeltempo: FogPace
TFA gibt jeder Etappe ihren eigenen Nebel. Er beginnt hinter dem Lagerfeuer, von dem die Spieler kommen, und zieht in
PEAKs Tempo zu. Ein größeres oder härteres Biom braucht vielleicht mehr Zeit: FogPace multipliziert die
Nebelgeschwindigkeit, solange deine Etappe die ist, in der die Gruppe steht. 1 ist PEAKs Tempo, 0,5 halb so schnell,
2 doppelt so schnell; TFA hält es zwischen 0,25 und 2 und meldet einen Wert außerhalb im Log. Ist deine Etappe die
letzte, gilt dein Tempo, bis der Nebel am PEAK endet.
biome.FogPace = 0.75f; // a third more time than PEAK's fog gives
Ändere OrbFogHandler.speed nie selbst - dein Tempo und TFAs würden sich multiplizieren.
TFA-Wetter in deiner Etappe: Weathers
Im Apokalypse-Modus würfelt der Host alle paar Minuten TFAs Wetter aus einer Tabelle, die sagt, welches Wetter in
welchem Biom kommen kann. Deine Etappe nutzt die Spalte ihres Rahmens. Weathers ersetzt sie für deine
Etappe:
- Der Schlüssel ist ein TFA-Wetter (Liste unten), der Wert, wie wahrscheinlich es ist:
0nie,1die Grundwahrscheinlichkeit (TFAs eigene Tabelle nimmt meist 1, an wenigen Stellen 2 oder 3),2-5so viel mal wahrscheinlicher wie eine1. Werte außerhalb von 0-5 werden geklemmt und gemeldet. TFA würfelt zuerst, wie selten das nächste Wetter ist (häufig, selten oder besonders), und wählt dann unter denen, die hier kommen können. Geht keins dieser Art, nimmt es erst eine häufigere Art, dann eine seltenere - eine Liste, die nur seltene oder besondere Wetter zulässt, würfelt also jedes Mal eines davon. - Ein Wetter, das du nicht nennst, behält die Wahrscheinlichkeit des Rahmens.
"*"setzt jedes Wetter, das du nicht nennst:["*"] = 0plus ein paar Schlüssel heißt „nur diese“;["*"] = 0allein heißt kein TFA-Wetter in deiner Etappe - der Zyklus ruht dort, wie im Nadir. null(Standard) behält die Spalte des Rahmens.
// A desert in a Tropics frame: sand instead of rain, no snow, no tsunami.
biome.Weathers = new Dictionary<string, int> { ["sand"] = 3, ["rain"] = 0, ["snow"] = 0, ["tsunami"] = 0 };
// Or only the weathers you name, nothing else (these are rare or special ones, so every roll ends at one of them):
// biome.Weathers = new Dictionary<string, int> { ["*"] = 0, ["quake"] = 2, ["dark"] = 1 };
// Or no TFA weather at all - the cycle rests in your stage:
// biome.Weathers = new Dictionary<string, int> { ["*"] = 0 };
- Die Würfel und die Wahl der Geister folgen ihm. Ein Permawetter und das Handmenü des Hosts nicht.
- Was der Host in der Wetter-Einrichtung abgeschaltet hat, bleibt aus, und die eigenen Bedingungen eines Wetters gelten weiter: Monde nur nachts, der Ausbruch nur mit einem Kiln im Berg, die Wacht des Feldmeisters nur mit dem Feldmeister.
- Im Chaos ist jedes Wetter überall gleich wahrscheinlich - aber deine
0bleibt0. Nutz sie für Wetter, das deine Etappe kaputt machen würde, nicht nach Geschmack. - Ein unbekannter Schlüssel wird einmal gemeldet und ignoriert, ein Schlüssel aus einem neueren TFA schadet in einem älteren also nicht.
Außerhalb des Apokalypse-Modus würfelt TFA kein Wetter; dort bekommt deine Etappe das Wetter, das du selbst startest (unten), zum Beispiel mit der Wetter-API.
Eine höhere oder tiefere Etappe: Rise
Deine Etappe wird in einem Rahmen gebaut: Länge, Höhe und Lagerfeuer eines PEAK-Bioms. Rise ändert ihre
Höhe. TFA hebt (oder senkt) das Ziel-Lagerfeuer samt Fels um diesen Betrag, und jede Etappe nach deiner wandert mit -
nichts hängt in der Luft, niemand muss absteigen. Es funktioniert im klassischen Aufstieg und im Baukasten.
// Registration: 40-60 units taller than the frame, a different height per run.
biome.Rise = seed => 40 + (int)(seed % 21);
// In Build: EndCampfire already stands at its new height, slot.Rise says by how much (after clamping).
int steps = 60 + slot.Rise; // a taller stage gets a longer ramp
seedist der Seed, den deinBuildinslot.Seedbekommt - dein Generator kann daraus seinen eigenen Gipfel errechnen.- Welteinheiten, wie Transform-Positionen - keine Meter. PEAKs Höhenmesser zeigt etwa 1,6 m je Einheit.
- Bereich -30 bis +100. TFA klemmt alles andere und schreibt eine Logzeile.
- Einmal beim Host gefragt, wenn der Lauf startet - im Flughafen, bevor es eine Insel gibt. Nur reine
Rechnung: keine Szene, keine Physik, kein
UnityEngine.Random. Wirft es einen Fehler, ist die Anhebung 0. - Das Ergebnis reist mit dem Lauf: Alle Spieler bauen denselben Berg.
slot.Risesagt deinemBuildden Wert, den TFA genommen hat, nach dem Klemmen - lies ihn dort, statt deine Funktion noch einmal zu rufen. - Wenn
Buildläuft, stehtEndCampfireschon auf seiner neuen Höhe. Bau wie immer vonslot.StartPointhinauf zuslot.EndPoint. Der Nebel der Etappe wächst von selbst mit. - Alle Spieler brauchen dein Biom in derselben Fassung, um einem Lauf beizutreten, der es nutzt. Wer später ohne es dazukommt, wird aus dem Lauf entfernt - auch im klassischen Aufstieg, weil eine Anhebung den Berg verändert (siehe Deine Etappe, deine Regeln).
Die Länge des Rahmens bleibt. Einen längeren Weg nach oben windest du selbst darin.
Wetter selbst starten
PlayersHere läuft bei jedem Spieler und sagt dir, wann die Gruppe deine Etappe betritt (true)
und verlässt (false) - der Moment, um Klänge, Wind oder Stürme zu starten und zu stoppen.
true kommt, wenn das Lagerfeuer vor deiner Etappe entzündet ist, oder beim Start des Laufs, wenn deine
Etappe zuerst kommt. Dein Wetter läuft bei jedem Spieler, also starte und stoppe es überall gleich.
Um TFAs eigene 28 Wetter zu nutzen - mit Stufe, Einzelwerten, einem See zum Schwimmen - ruf von hier aus die
TFA-Wetter-API auf; sie hat einen eigenen Reiter. slot.OwnWeatherAllowed ist
in jedem Lauf wahr außer auf der Tageskarte, wo ohnehin nie Mod-Biome vorkommen - auch im Apokalypse-Modus: TFAs Würfel und
dein Wetter laufen nebeneinander, und ein Wetter, das du über die Wetter-API startest, übernimmt ein kollidierendes
Würfelwetter. Die Würfel selbst steuerst du in deiner Etappe mit Weathers.
private static void OnPlayersHere(TfaBiomeSlot slot, bool here)
{
// Your own wind, sounds or storms: start with the group, stop when it leaves.
// To use one of TFA's 28 weathers instead, call TfaWeather.Start / Stop from here (Weather tab).
CrystalStorms.Running = here && slot.OwnWeatherAllowed;
}
Ist dein eigenes Wetter oder Wasser Teil des Wegs nach oben - eine Strecke, die man schwimmen muss? Im Apokalypse-Modus
kann anderes Wetter daneben laufen, und hält das Wetter einer anderen Mod TFAs Wetter-Platz, antwortet dein Start mit
Busy - frag alle paar Sekunden noch einmal (siehe das Seebeispiel im Reiter Wetter).
Eigener Himmel und eigenes Licht? Ändere slot.Sky während Build:
// In Build: start from PEAK's profile of this stage and make it your own.
DayNightProfile sky = UnityEngine.Object.Instantiate(slot.Sky);
// ... change colours and fog ...
slot.Sky = sky;
Faustregeln
- Bau nur unter
Root(oderEndCampfireGroup). FassMapHandler, seine Segmente und PEAKs Gelände nicht an - die Etappe verdrahtet TFA selbst. - Begehbare Kollider auf die Ebene
Terrain, Requisiten aufMap- danach suchen TFAs Regen, Blitze und Lava. - Gib regelmäßig Bilder ab. Ein Bau von mehreren Sekunden in einem Bild friert den Ladebildschirm ein.
- Wirft
Buildeinen Fehler, behält TFA bei diesem Spieler PEAKs Etappe und sagt es ihm - das Laden hängt nie. Sorg dafür, dassBuildüberall oder nirgends scheitert, sonst klettert dieser Spieler eine andere Etappe. - Bau nur relativ zum Slot, von
slot.StartPointbisslot.EndPoint.StartCampfirekann im Baukasten null sein (ApiLevel2 oder 3). Dein Biom kann verschiedene Etappen füllen (im Baukasten jede Stelle), mitMaxPerRunüber 1 auch mehrfach - halte alles, was vom Lauf abhängt, im Slot, nicht in statischen Feldern: TFA fragtRise,FitsundMeasureje Slot. DropFromFrame,FogPace,Weathers,Rise,StartundDressStartgehören zu deinem Inhalt: Alle Spieler brauchen dasselbe, also erhöheVersion, wenn du sie änderst.- Startplateau (API 3): Beschreib es erst als Daten und nimm
DressStartnur für das, was Daten nicht sagen können.DressStartist reine Rechnung - es rechnet aus dem Slot und dem Seed, nie aus deiner Konfiguration oder der Szene -, sonst weicht das Plateau der Gäste vom Plateau des Hosts ab. - Höhen sind Welteinheiten (etwa 1,6 m auf PEAKs Höhenmesser):
Rise,StartPoint,EndPoint. - Hat deine Mod eigene Schalter für Nebeltempo, Kälte oder Wetter in normalen PEAK-Läufen? Behalte sie für normale
Läufe, schalte sie im FINALEN AUFSTIEG aus (
TfaBiomes.IsFinalAscentRun) und erkläre stattdessen die Werte des FINALEN AUFSTIEGS. - Ersetzt deine Mod sonst selbst ein Biom? Mach das in normalen Läufen weiter und halte dich nur im FINALEN AUFSTIEG zurück:
// Your mod normally replaces a biome by itself? Step aside in FINAL ASCENT runs only:
if (TfaBiomes.IsFinalAscentRun)
{
return; // TFA calls your Build if the host picked your biome
}
Übersicht
Alles unten ist API 2 oder API 3 (TfaBiomes.ApiVersion ist 3), vorhanden seit True Final Ascent 3.0.0.
API 3 ist das Startplateau: Start, DressStart, MeasureStart und die Typen
TfaStartStyle bis TfaStartSlot.
TfaBiome - was du anmeldest
IdEindeutige Kennung, 2-24 Kleinbuchstaben oder Ziffern.VersionInhaltsfassung; muss bei allen gleich sein. Ohne | und @.ReplacesPassende Rahmen: Tropics, Roots, Alpine, Mesa. Im Baukasten wählt der Host den Rahmen je Baustein, der erste ist der Standard.MaxPerRunWie oft es in einem Lauf vorkommen darf (Standard 1). Darüber: Zustand je Slot halten.NamesName je Sprache: en (Pflicht), de, cn.InkFarbe deines Bioms in der Kartenkonfiguration und im Klettergraph dieser Webseite.MeasureOptional, nur Host: Welt vermessen, Text zurückgeben.BuildPflicht: unter slot.Root bauen; mit yield return null (oder eigenem IEnumerator) die Arbeit verteilen, nie StartCoroutine.PlayersHereOptional: Gruppe hat deine Etappe betreten (true) oder verlassen (false).ApiLevelPlatzierung, die du annimmst: 1 (Standard) nur nach einem Lagerfeuer, 2 auch als Erstes im Aufstieg und direkt nach Kiln, Zitadelle oder Nadir (Baukasten), 3 dasselbe und dein Code kennt das Startplateau (API 3). Höher als ApiVersion wird abgelehnt.InBuilderFalsch hält dein Biom aus dem Baukasten heraus (Standard wahr).FitsOptional (frame, previous, next) => bool: falsch, wo dein Biom im Baukasten nicht stehen kann. Schnell, bei allen Spielern gleich; wirft es einen Fehler, behandelt TFA es als wahr.DropFromFrameWas deine Etappe nicht vom Rahmen übernimmt: Weather, ColdNight (Standard None).FogPaceNebeltempo in deiner Etappe, 0,25-2 (Standard 1).WeathersOptional: TFA-Wetterschlüssel auf Wahrscheinlichkeit 0-5, "*" für den Rest. Nur Apokalypse-Würfel und Geisterwahl.RiseOptional seed => units: Zusatzhöhe deiner Etappe, -30 bis +100. Nur Host, einmal, beim Laufstart.StartOptional, API 3: TfaStartStyle, der Look des Startplateaus als Daten. Wird nach deinem Build gelesen, bei jedem Spieler, nur wenn dein Biom in einem Baukasten-Berg an erster Stelle steht.DressStartOptional, API 3: Action<TfaStartSlot>, Schaustücke für das Startplateau als Code. Bei jedem Spieler, nur Rechnung, nach TFAs eigenen Teilen und vor seiner Streuung.MeasureStartOptional, API 3, nur Host: Func<TfaStartSlot, string>, vermiss, was DressStart braucht (Strahlen), bevor das Plateau geformt wird, und gib es als Text zurück. Jeder Spieler bekommt ihn in slot.Measured; über 2 KB als Base64 wird er verworfen.TfaBiomeSlot - was TFA dir gibt
RootHier bauen. Am Start-Lagerfeuer (oder StartPoint), Blick zum Ziel-Lagerfeuer.StartCampfire, EndCampfireDie Lagerfeuer vor und nach deiner Etappe. StartCampfire ist null, wo kein Lagerfeuer hineinführt (Baukasten, ab ApiLevel 2).StartPointWo die Spieler deine Etappe betreten: das Feuer des Start-Lagerfeuers, sonst das Gipfellager von Kiln oder Zitadelle, das Brückenlager des Nadir oder der Fuß des Aufstiegs. Als Erstes im Aufstieg legt TFA nach deinem Bau die Absturzstelle direkt davor (Startplateau).EndPointDas Feuer von EndCampfire - wo dein Weg nach oben ankommen muss.EndCampfireGroupDas ganze Ziel-Lagerfeuer samt Fels.VanillaTerrainPEAKs Gelände der Etappe - nur als Vorlage, nach deinem Bau ausgeblendet.SeedSeed für diesen Lauf, diese Etappe und dein Biom, überall gleich.MeasuredErgebnis von Measure beim Host, oder null.SkyLicht- und Himmelsprofil der Etappe - zum Ändern ersetzen.OwnWeatherAllowedFalsch nur auf der Tageskarte (die nie Mod-Biome hat); wahr in jedem anderen Lauf, auch im Apokalypse-Modus, wo TFAs Würfel und dein Wetter nebeneinander laufen. Siehe die Wetter-API.InBuilderWahr in einem Baukasten-Berg: Position ist der Platz in der Kette, der Rahmen kann eine Kopie sein.RiseDie Anhebung, die TFA für diesen Slot genommen hat, nach dem Klemmen; 0 ohne Rise.PositionPlatz im Aufstieg, 0 = erste Etappe; im Baukasten der Platz in der Kette.OccurrenceDas wievielte Exemplar deines Bioms, ab 1.Previous, NextDie Etappen um deine herum: Shore, Tropics, ... oder mod: plus Kennung; "" am Anfang, Peak am Ende. Im Baukasten sind Caldera, Kiln, Düsternis und Zitadelle getrennte Bausteine: Kiln oder Citadel kann dein Nachbar sein, ohne dass Caldera oder Gloom davor steht, und Caldera oder Gloom, ohne dass Kiln oder Citadel danach folgt.Replaces, BiomeDer Rahmen, in dem du baust, deine Anmeldung.TfaFrameParts
None, Weather, ColdNightFlags für DropFromFrame: mit | kombinieren. Ein Biom lässt nur weg, was es nennt; neue Teile können später dazukommen.TfaStartStyle - dein Startplateau als Daten (API 3)
Setz es als TfaBiome.Start. Jedes Feld ist optional.
GroundMaterial. Der Boden des Plateaus. null = das größte Material deines Terrain-Bodens unter slot.Root. Es wird von oben projiziert (Welt-x und -z); Triplanar- oder Weltraum-Shader sehen am besten aus.ReliefTfaStartRelief. Hügel, Rauheit und Kuppen des Plateaubodens. null = das Relief deines Rahmens.LayersList<TfaStartLayer>. Was auf dem Plateau wächst; höchstens 16 Schichten, weitere werden ignoriert. null = TFA schmückt das Plateau selbst aus den Spawnern unter deiner Wurzel. Jede Liste, auch eine leere, heißt: nur deine Schichten; TFA streut dann keine eigenen Felsen oder Pflanzen.LandmarkTfaStartLandmark. Eine Landmarke in TFAs Platz neben dem Weg, auf Wunsch mit einem kleinen Hain gegenüber. null = keine.RockMaxfloat, Meter, 1,5 bis 16. Größter Radius eines Felsens im Feld. -1 (Standard) = der deines Rahmens. Kleiner macht das Plateau ruhiger.AmbienceAudioClip. Dein eigener Klangteppich: ein 3D-Loop am Wrack, volle Lautstärke bis 80 m, bei 220 m verklungen. Ersetzt, was TFA sonst von einem Klangteppich unter deiner Wurzel leiht.AmbienceVolumefloat, 0 bis 1 (Standard 0,5). Lautstärke von Ambience; PEAKs Umgebungslautstärke wirkt zusätzlich.AllowWaterbool (Standard falsch). TFA darf 1 bis 2 Teiche mit echtem Wasser auf das Plateau legen (Radius 6 bis 10 m, 0,8 m tief) - Wasser, das Schwimmende bremst. Braucht Water; ohne wird die Einstellung ignoriert (Logzeile).WaterMaterial. Aussehen der Teichoberfläche. TFA findet es über den Namen an einem Renderer unter deiner Root; dort muss also ein Renderer dieses Material tragen.ClimbPracticebool (Standard wahr). TFA baut die Kletterübung deines Rahmens: zwei gestapelte Felsen mit einem Koffer obenauf. Entfällt, wenn die Felsen des Rahmens auf deinem Plateau nicht zu finden sind.TfaStartLayer
Eine Schicht von Kopien in TfaStartStyle.Layers. Zahlen außerhalb ihres Bereichs werden geklemmt und gemeldet.
TemplateGameObject. Ein Prefab oder Szenenobjekt als Vorlage (inaktiv ist in Ordnung). Genau eins von Template, Find und Vanilla je Schicht; eine Schicht mit keinem oder mehreren wird übersprungen, mit Logzeile.Findstring. Pfad unter deinem slot.Root in schlichten Namen ("Props/T_crystal"), aufgelöst nach deinem Build. Für Vorlagen, die dein Build selbst macht.Vanillastring. Ein PEAK-Prefab, das die Spawner eines PEAK-Bioms nennen: "Tropics:Jungle_Willow_Big" = Biom (Tropics, Roots, Alpine, Mesa, Caldera, Kiln, Gloom, Citadel), Doppelpunkt, schlichter Prefab-Name. So schmückst du mit PEAKs eigenen Pflanzen und Felsen, ohne sie mitzuliefern. Findet TFA den Namen nicht, wird die Schicht übersprungen.KindTfaStartKind (Standard Plant). Wie die Kopien auf dem Boden sitzen; siehe die Arten unten.ZonesTfaStartZone (Standard Field | Sides). Wo die Schicht wachsen darf; mit | kombinieren. Arten, die in einer Zone nicht erlaubt sind, verlieren dieses Bit, mit einer Logzeile.Densityfloat, Kopien je Hektar in ihren Zonen, 0 bis 400. -1 (Standard) = TFAs Dichte für die Art (Fels 12, Pflanze 25, Bodendecker 60, hoch 40).Clusterfloat, 0 bis 1 (Standard 0,5). 0 verteilt die Kopien gleichmäßig, 1 sammelt sie zu dichten Gruppen aus 3 bis 7.ScaleMin, ScaleMaxfloat, 0,25 bis 4 (Standard 0,85 und 1,2). Größenbereich der Kopien.Radiusfloat, Meter. Grundfläche, die TFA um eine Kopie freihält. -1 (Standard) = aus den Mesh-Maßen des Modells.Tiltfloat, Grad, 0 bis 20. Größte Neigung. -1 (Standard) = 8 für Rock, 0 für den Rest.Sinkfloat, 0 bis 0,8. Anteil der Höhe, der im Boden steckt. -1 (Standard) = der Wert der Art.ShadowsTfaShadow (Standard Auto). Siehe unten.Keepstring[]. Typnamen deiner eigenen Skripte, die die Kopie überleben. Alles andere an der Vorlage wird entfernt (siehe „Was TFA entfernt“).TfaStartLandmark
Template, Find, VanillaWie bei einer Schicht: genau eine Quelle.Radiusfloat, 4 bis 25 m. Grundfläche für das flache Podest unter der Landmarke und für den freien Raum um sie. -1 (Standard) = am Modell gemessen. Eine Landmarke schwebt nie: TFA blendet den Boden bis zu ihr hoch.Scalefloat, 0,05 bis 20 (Standard 1). Größe der Vorlage, wie du sie gebaut hast.Sinkfloat, 0 bis 5 m (Standard 0). Wie tief die Landmarke im Boden steht.SoundAudioClip. Optionaler 3D-Loop an der Landmarke, hörbar von 4 bis 60 m.GlowColor. Alpha über 0 setzt eine Lichtmarke (BakedVolumeLight) an die Landmarke, wie TFAs Lampen in der Finsternis. Standard Color.clear = keine.SideGrovebool (Standard wahr). Ein kleiner Hain gegenüber der Landmarke (60 bis 90 m vom Weg), aus deinen Plant- und Tall-Schichten.TfaStartRelief
Jeder Wert ist standardmäßig -1: das Relief deines Rahmens. Terrassen und Dünen gehören nicht zu API 3.
Hillfloat, 0 bis 8 m. Höhe der breiten Hügel.Roughfloat, 0 bis 3 m. Höhe der feinen Rauheit.Moundsint, 0 bis 40. Anzahl der Kuppen.TfaStartZone
None, Back, Sides, Field, Bed, Path, FrontFlags 0, 1, 2, 4, 8, 16, 32: mit | kombinieren. Die Zonen sind oben unter „Zonen“ gezeichnet und beschrieben.TfaStartKind
Rock35 bis 55 % im Boden versenkt und geneigt. Felsen im Feld werden auf RockMax verkleinert. Nicht erlaubt in Bed und Path.PlantSteht aufrecht auf dem Boden (0,15 m versenkt), behält seine Kollider, wie du sie gebaut hast. Nicht erlaubt in Bed.CoverBodendecker: Kollider entfernt, wirft nie einen Schatten; die einzige Art im Bett, wo sie bis 6 m an den Rumpf heranreichen darf.TallSkyline: nur in Back und Sides; wirft keine Schatten, solange die Schicht es nicht verlangt (TfaShadow.On).TfaShadow
Auto, On, OffAuto: große Felsen und Pflanzen werfen Schatten, Bodendecker und Skyline nicht. On: immer (nie bei Bodendecker). Off: nie. TFAs Budget von 600 Schattenwürfen für das ganze Plateau gilt zusätzlich.TfaStartSlot - was DressStart bekommt (API 3)
Weltkoordinaten; +z zeigt zu deinem Biom. Die Messfunktionen (Height, Normal,
Lowest, ZoneAt, IsFree) sind reine Funktionen der Startzeile und des Seeds:
dieselben Zahlen bei jedem Spieler.
Idstring. Die Kennung deines Bioms.Seedulong. Der Seed deines Starts, bei allen Spielern gleich. UnityEngine.Random wird in DressStart daraus gesetzt; danach stellt TFA seinen eigenen Zufallszustand wieder her.Measuredstring. Der Text, den MeasureStart beim Host geliefert hat, oder null (keiner, oder über 2 KB als Base64). Lies ihn hier, statt selbst zu messen.Measuringbool. Wahr in MeasureStart: Das Plateau ist noch nicht geformt, die Messfunktionen antworten NaN und Holder ist null.HolderTransform. Die inaktive Gruppe für deine Schaustücke unter FA_StartMod auf dem Plateau. Bau nur hier; sie wacht mit dem fertigen Plateau auf. Null beim Messen.BoundsBounds. Das Plateau plus das gemessene Band davor (bis 72 m hinter Front).AnchorVector3. Mitte des Wrack-Betts.Floorfloat. Höhe des Plateaubodens am Wrack.Frontfloat. Das z der ersten Zeile deines eigenen Bodens.LandmarkVector3. Wo deine Landmarke steht (der Boden unter ihrer Mitte); NaN in jeder Komponente, wenn es keine gibt.PathX(z)float. Das x der Wegachse bei z.FrontAt(x)float. Das z, wo das Plateau bei x auf deinen Boden trifft.Height(x, z)float. Höhe des gebauten Bodens (das Plateau-Mesh, sonst dein gemessener Boden davor), NaN außerhalb.Normal(x, z)Vector3. Bodennormale am Punkt; nach oben, wo unbekannt.Lowest(x, z, r)float. Der tiefste Boden aus Mitte und vier Punkten im Abstand r - der Sitz für einen Felsen. NaN außerhalb.ZoneAt(x, z)TfaStartZone. Die Zone eines Punkts; None auf TFAs eigenem Boden und außerhalb.IsFree(x, z, r)bool. Liegt die Scheibe auf Boden und ist frei von TFAs Boden, seinen Kopien und deinen Reservierungen?Reserve(x, z, r)bool. Belegt eine freie Scheibe in DressStart: TFAs Deko hält sich heraus. Falsch, wenn die Scheibe nicht frei war.Copy(template, name)GameObject. TFAs Kopie einer Vorlage unter Holder, ohne Netzwerk-, Physik-, Partikel- und Animator-Teile und ohne PEAKs Spielskripte (harmlose lokale bleiben); deine eigenen Skripte bleiben. Null, wenn abgelehnt (eine Wurzel mit PhotonView, Rigidbody oder Item), und null außerhalb von DressStart. Setzen und Drehen machst du.TFA-Wetterschlüssel
Die Schlüssel für Weathers. Neue Wetter kommen zu dieser Liste dazu; ein Schlüssel ändert sich nie.
stormSturmrainRegensnowSchneesturmsandSandsturmsunBrennende SonnesleepfogSchlafnebelsporesSporenwolkepoisonGiftnebelshroomrainPilzregencactusrainKaktusregenfoodfrenzyFress-FiestafloorlavaDer Boden ist LavadarkFinsternisquakeErdbebenmoonBlauer MondbloodBlutmondwispsIrrlichterantigravAntigravitationthunderGewittericefogEisnebelpetrifyVersteinernde SonnewatchWacht des FeldmeisterstsunamiTsunamifloodSturzflutavalancheLawinevolcanoVulkanausbruchshockfrostSchockfrosthayfeverPollenflugTfaBiomes
Register(biome)Meldet dein Biom an; falsch (mit Logzeile), wenn etwas fehlt.IsFinalAscentRunFrag es, wenn eine Inselszene lädt: wahr, wenn es eine Insel des FINALEN AUFSTIEGS ist.ApiVersion3 seit True Final Ascent 3.0.0 (2 war die API vor dem Startplateau). Steigt, wenn sich die Schnittstelle so ändert, dass dein Code folgen muss; Mitglieder einer höheren API gibt es nur, wenn sie es sagt.Testen
Setz deine Felder, öffne die Kartenkonfiguration des FINALEN AUFSTIEGS, wähle dein Biom in der Liste an der Überschrift der
Etappe (oder setz es in einen Baukasten-Berg) und starte. TFAs Logzeilen sind englisch. In
BepInEx/LogOutput.log steht:
Mod biome registered: 'deineid' 1.0.0 for Tropics, Roots (API 2, without frame weather, fog pace x0.80, own weather weights, with rise).beim Spielstart. Die API-Nummer ist dasApiLevel, das du gesetzt hast; danach steht nur, was du gesetzt hast:DropFromFrame,FogPace,Weathers,Rise. Einen Wert vonDropFromFrame,FogPaceoderWeathers, den TFA klemmen musste, oder einen unbekannten Wetterschlüssel meldet es gleich dort als Warnung.Risewird bei der Anmeldung nicht geprüft (siehe nächster Punkt).Mod biome 'deineid' 1.0.0 replaces Tropics (0.4s, seed 12345, rise +40).beim Inselbau, im BaukastenMod biome 'deineid' 1.0.0 at place 3 in frame Tropics (0.4s, seed 12345, rise +40).Sie nennt die Anhebung (rise +40), und beim Host kommt beim LaufstartMod biome 'deineid' raises Tropics by +40 (seed 12345).Dort wirdRisegeprüft: einen Wert außerhalb von -30..100 meldet es direkt davor als Warnung (Mod biome 'deineid': rise 150 outside -30..100 - clamped to 100.), einRise, das einen Fehler wirft, steht alsMod biome 'deineid': Rise threw (...)im Log und gilt als 0. Fehler aus deinemBuildstehen dort vollständig.Mod biome 'deineid' in Tropics: frame weather held, mild nights, fog pace x0.80, own weather weights, rise +40.wenn die Gruppe deine Etappe betritt (im Baukastenin place 3 (Tropics)), einmal je Spieler und nur mit den Teilen, die du gesetzt hast.- Im Apokalypse-Modus loggt der Host jeden Wurf, etwa
Cycle rolls: quake (Rare) 12 s, Tropics, mod biome 'deineid', day, level Normal.Deine Kennung steht dort, wennWeathersden Topf bestimmt hat.
Ein Startplateau (API 3) bringt diese Zeilen dazu. Setz dein Biom mit ApiLevel 2 oder 3 an die erste Stelle
eines Baukasten-Bergs und starte:
Mod biome registered: 'deineid' 1.0.0 for Tropics, Roots (API 3, ..., own start: 3 layers, landmark, ambience, dress).beim Spielstart. Die API-Nummer ist deinApiLevel; nachown start:steht nur, was du gesetzt hast (3 layersoderautomatic layers,landmark,ambience,water,dress,start measure). BeiApiLevel1 warnt TFA stattdessen:Mod biome 'deineid': Start, DressStart and MeasureStart are never used - ApiLevel 1 never stands first.Start style of mod 'deineid': 3 layers, landmark 'Props/T_crystal_spire', ground Floor.während die Insel gebaut wird, bei jedem Spieler: was TFA aus deinemStartgelesen hat. Probleme werden je einmal gemeldet, etwaStart style 'deineid': layer 2 has no template - skipped.,Start style 'deineid': layer 1 template 'Props/T_x' not found - skipped.,Start style 'deineid': layer 3 zones Bed not allowed for Rock - using Field.oderStart style 'deineid': AllowWater without Water - no ponds.Start measure 'deineid': 412 characters, 552 as Base64.beim Host, wenn deinMeasureStartText geliefert hat. Über 2 KB als Base64 verwirft TFA ihn mitStart line key 'mod.deineid' over 2 KB - dropped, undslot.Measuredist bei allen Spielern null. WirftMeasureStarteinen Fehler:Start measure 'deineid' threw: ... - no measurement.Builder: start spot in front of Tropics (mod 'deineid'): ..., style 3 layers (412 copies), landmark at left, dress 37 objects in 4 ms, ..., as on the host.während die Insel gebaut wird, bei jedem Spieler. Die Zahlen nennen deine Schichten und ihre Kopien, die Seite der Landmarke und die Objekte deinesDressStartmit der Zeit, die es brauchte. Stattdessen kann dortstyle automatic layers,no landmark,landmark not planned,landmark refused by the budget,no dressoderdress removed (threw)stehen. Bei einem Gast endet die Zeile mitas on the host, wenn das Plateau dem des Hosts gleicht; beim Host folgt nichts.Start mod 'deineid': style 3 layers (412 copies), landmark at left, dress 37 objects in 4 ms, side grove 5, own ambience hum, ground Floor on 38 renderers, host measure 412 characters; FA_StartMod: 0 rigidbodies, 0 joints, 0 PhotonViews.ein paar Zeilen vor der ZeileBuilder: start spot, mit denselben Zahlen und dem, was TFA sonst für dich gesetzt hat: den Nebenhain, deinen Klangteppich, den Bodentausch und die Länge des Messtexts vom Host. Es erscheinen nur die Teile, die du gesetzt hast. Nach dem Semikolon: was von den Netzwerk- und Physikteilen unterFA_StartModübrig ist - überall sollte 0 stehen.Start dress 'deineid': 2 PhotonViews removed, 1 object in the spawn fan hidden, 120 over the budget hidden, 37 footprints reserved, 5 reservations by the mod.was TFA nach deinemDressStartentfernt, ausgeblendet oder abgeschaltet hat (nothing removed, wenn nichts) und wie viele Grundflächen es reserviert hat. Ein Skript von dir, das ein entferntes Teil verlangt ([RequireComponent]), geht mit:1 script that required a removed part removed. Eine Vorlage, deren Wurzel einPhotonView, einen Rigidbody oder ein Item trägt, lässt sich nicht kopieren:Start dress 'deineid': template 'x' has a network, body or item root - not copied.(bei einer Schicht oder der LandmarkeStart style 'deineid': ...).Start dress 'deineid' threw: ... - removed, the plateau stays.deinDressStarthat einen Fehler geworfen (ein Stack folgt als Warnung). TFA hat bei diesem Spieler entfernt, was es gemacht hat. Langsame Läufe werden auch gemeldet:Start dress 'deineid' took 312 ms (over 250 ms)...., MISMATCH (host 1A2B3C4D) in mdas Ende der ZeileBuilder: start spotbei einem Gast, dessen Plateau vom Host abweicht. Die Buchstaben nennen die abweichenden Teile:msind dein Stil und deinDressStart, die anderen gehören TFA. Ein paar Zeilen vor der ZeileBuilder: start spotstehtStart dress 'deineid' differs from the host - 37 colliders under FA_StartMod off.
Teste einmal mit einem zweiten Spieler und einmal mit einem Nachzügler.
Fragen oder Wünsche an die Schnittstelle? Schreib CptPICHU auf dem PEAK-Modding-Discord.
把你的地貌加入终极攀登
通过 TFA 地貌接口,你的模组可以把自己的地貌加入终极攀登岛。在经典攀登中它替换某一段——比如雨林;在积木里它是玩家堆进自己山峰的一块积木。玩家在地图设置中,从地貌标题处的列表里选择它,或在积木里把它加为一块积木。这一段随后会显示你的地貌名称。你的地貌还可以告诉 TFA 这一段需要什么:框架的哪种天气要去掉、迷雾收拢得多快、TFA 的哪些天气会在这里随机出现,以及这一段要抬高或降低多少。作为积木山峰的第一块积木,它还可以装饰玩家醒来时所在的起点台地。
- 你的地貌可使用的框架:雨林、森林、雪山、方山——你的路段所使用的那个 PEAK 地貌的长度、高度和营火。在经典攀登中你的地貌替换这一段;在积木里,玩家可以把它放在自己山峰的任意位置,也可以放多次(最多
MaxPerRun次),放进它的某个框架里。 - 每日地图上永远不可用——那里的用时必须保持可比。
- 房间里所有人都需要相同版本的你的模组。否则房主无法用你的地貌开局。
- 普通 PEAK 攀登照旧由你负责:只有在生成终极攀登岛时,TFA 才会调用你的模组。
快速上手
1. 引用 True Final Ascent
用 r2modman 安装 True Final Ascent,并从你的配置文件中引用这个 DLL。不要把它打包进你的模组。
<Reference Include="TrueFinalAscent">
<HintPath>...\BepInEx\plugins\CptPICHU-TrueFinalAscent\TrueFinalAscent.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>...\steamapps\common\PEAK\PEAK_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
第二个引用是 PEAK 自己的 Assembly-CSharp.dll(再加上你用到的 UnityEngine 模块,都在 PEAK_Data/Managed 里)。TfaBiomeSlot 会暴露 PEAK 的类型,例如 Campfire(slot.EndCampfire)和 DayNightProfile(slot.Sky);没有这个引用,一接触它们编译器就会报错 CS0012。
2. 设为可选依赖
你的模组在没有 TFA 时也应能运行。声明软依赖,只在安装了 TFA 3.0.0 或更高版本时才接触它的类型——放在单独的类里,这样 .NET 在其他情况下永远不会加载它们。TFA 的接口类型从 3.0.0 才开始存在;旧版 TFA 里没有这些类型,第一次接触就会抛出异常。
using System;
using BepInEx;
using BepInEx.Bootstrap;
[BepInPlugin("you.crystalcaves", "Crystal Caves", "1.0.0")]
[BepInDependency("com.CptPICHU.peak.truefinalascent", BepInDependency.DependencyFlags.SoftDependency)]
public class CrystalCavesPlugin : BaseUnityPlugin
{
private void Awake()
{
// Touch TFA's types only when TFA 3.0.0 or newer is installed: on an older one they are missing and the first touch
// throws. Without TFA your mod keeps working as before.
if (Chainloader.PluginInfos.TryGetValue("com.CptPICHU.peak.truefinalascent", out PluginInfo tfa)
&& tfa.Metadata.Version >= new Version(2, 10, 0))
{
TfaBridge.Register();
}
}
}
在使用比你的最低版本更新的内容之前,请检查 TfaBiomes.ApiVersion(TFA 3.0.0 中为 3):更高版本接口的成员只有在它这么说时才存在。请把它们放进单独的、标有 [MethodImpl(MethodImplOptions.NoInlining)] 的方法里——.NET 在方法第一次运行时才解析其中的成员,所以注册方法里只要有一个未知成员,整个注册就会失败(MissingMethodException)。本页是 API 2,只有你的起点台地这一章是 API 3。
3. 注册你的地貌
在 Awake 里注册一次。Id 简短且唯一,Version 在所有玩家处必须相同,Names 至少要有英文。末尾的 API 2 字段都是可选的。
using System.Collections;
using System.Collections.Generic;
using TrueFinalAscent.Api;
using UnityEngine;
internal static class TfaBridge
{
public static void Register()
{
TfaBiomes.Register(new TfaBiome
{
Id = "crystalcaves",
Version = "1.0.0", // raise it whenever your generation changes
Replaces = new[] { "Tropics", "Roots" },
Names = new Dictionary<string, string>
{
["en"] = "Crystal Caves",
["de"] = "Kristallhöhlen",
["cn"] = "水晶洞穴",
},
Ink = new Color(0.55f, 0.85f, 1f),
Build = Build,
PlayersHere = OnPlayersHere,
// API 2 - all optional, each one is explained below
ApiLevel = 2, // may also stand first in the climb (Builder)
DropFromFrame = TfaFrameParts.Weather, // underground: no rain, no gusts
FogPace = 0.8f, // a twistier way up - a little more time
Weathers = new Dictionary<string, int> { ["*"] = 0, ["quake"] = 2, ["dark"] = 1, ["poison"] = 1 },
});
}
// Build and OnPlayersHere: see below.
}
4. 建造
岛屿加载时,TFA 会在每位玩家处调用 Build。这个示例从起点营火到终点营火铺出一条粗糙的岩石坡道:
private static IEnumerator Build(TfaBiomeSlot slot)
{
// Root sits at the start campfire, +Z points towards the end campfire, +Y is up.
Transform root = slot.Root.transform;
Vector3 goal = root.InverseTransformPoint(slot.EndCampfire.transform.position);
// Borrow a material from PEAK's terrain of the stage you replace.
Material rock = slot.VanillaTerrain.GetComponentInChildren<MeshRenderer>(true).sharedMaterial;
int ground = LayerMask.NameToLayer("Terrain");
const int steps = 60;
for (int i = 0; i <= steps; i++)
{
float t = i / (float)steps;
GameObject step = GameObject.CreatePrimitive(PrimitiveType.Cube);
step.layer = ground;
step.GetComponent<MeshRenderer>().sharedMaterial = rock;
step.transform.SetParent(root, false);
step.transform.localPosition = Vector3.Lerp(Vector3.zero, goal, t)
+ Vector3.right * Random.Range(-4f, 4f); // seeded by TFA: the same on every player
step.transform.localScale = new Vector3(10f, 1f, 9f);
if (i % 15 == 0)
{
yield return null; // spread the work, the loading screen stays smooth
}
}
}
在哪里建造
你的 Build 会收到一个 TfaBiomeSlot:
Root位于起点营火,朝向终点营火(+Z 向前,+Y 向上)。所有东西都建在它下面——TFA 会随路段一起显示和隐藏它。StartCampfire是玩家来的地方,EndCampfire是他们要到达的地方。两者保持原样。你的上山路线必须通到终点营火。在积木里StartCampfire可能为 null(见下文)。StartPoint是玩家进入你的路段的位置(有起点营火时就是它的火堆),EndPoint是终点营火的火堆,你的上山路线必须在这里到达。从一个建到另一个,你的地貌在任何地方都能正常工作。EndCampfireGroup是整个营火连同它的岩石。挂在它下面的东西会随营火一起出现和消失——适合放在终点处的门或神社。VanillaTerrain是这一段的 PEAK 原版地形。你建造完成后 TFA 会隐藏它。可以读取它作为模板(岩石、行李箱、材质),但绝不要修改它。
所有人同一个世界
你的地貌不会被传输:每位玩家都自己建造。所以建造结果必须在每台电脑上完全一致。
- 随机:在
Build中,TFA 会用slot.Seed为UnityEngine.Random设定种子——放心使用。绝不要用时间、帧计数或来自别处的随机。 - 射线:物理计算在不同 CPU 上会有细微差别。只在
Measure里测量世界——它在房主处运行,每位玩家都会在slot.Measured里收到它返回的文本。 - 联网:
Root下的 PhotonView 由 TFA 分配编号。保持为 0。 - 版本:生成方式一改变就提高
Version。版本不同的玩家无法一起用你的地貌开局。
Measure = slot =>
{
// Host only. Raycasts can differ by a hair between CPUs - TFA ships this text to every player.
Vector3 above = slot.EndCampfire.transform.position + Vector3.up * 3f;
Physics.Raycast(above, Vector3.down, out RaycastHit hit, 20f);
return hit.point.y.ToString(System.Globalization.CultureInfo.InvariantCulture);
},
// ...and in Build, on every player - null if no host value arrived:
float endGround = slot.Measured != null
? float.Parse(slot.Measured, System.Globalization.CultureInfo.InvariantCulture)
: slot.EndCampfire.transform.position.y;
你的地貌在积木里
在积木里,玩家用地貌积木堆出自己的山峰。你的地貌也是一块积木:它会建在自己某个 Replaces 框架里(由房主为每块积木选择,第一个是默认值),玩家把它放在哪里都可以——也可以放多次,最多 MaxPerRun 次。
- 在那里
slot.InBuilder为 true。slot.Position是它在链中的位置,框架可能是副本,Previous和Next可以是任意地貌、mod:加标识、""(第一个)或Peak(最后一个)。 - 排在攀登最前面,或紧跟在熔炉、城塞、天底之后时,没有营火通向你的路段:
StartCampfire为 null。请改为从slot.StartPoint开始。只有把ApiLevel设为 2 或更高,TFA 才会把你的地貌放到那里。排在攀登最前面时,玩家会在你的地面前方的起点台地上醒来——你的起点台地讲解了怎么装饰它。 slot.StartPoint和slot.EndPoint是玩家进入的位置,以及你的上山路线必须到达的位置(终点营火的火堆)。经典终极攀登里它们同样会被设置——从一个建到另一个,你的地貌在任何地方都能正常工作。- 最后一块积木:当
Next为Peak时,TFA 会在你建造完成后拿走终点营火的火堆、行李箱和雕像。岩石保留,通往峰顶的桥紧接在它后面(+Z)开始——请把这一侧空出来。 InBuilder = false让你的地貌不进入积木模式,适用于只能在经典位置建造的地貌。Fits(frame, previous, next)是可选的:在你的地貌无法立足的地方返回 false。房主编辑链时会询问它,所以它必须很快,并且在每位玩家处给出相同的答案。如果它抛出异常,TFA 当作 true 处理。
biome.ApiLevel = 2;
biome.Fits = (frame, previous, next) => previous != "Kiln"; // our entrance needs solid ground, not a lava rim
你的起点台地(API 3)
当积木山峰不是从海岸开始时,玩家会在坠机之后醒来,身处一块起点台地:TFA 铺在第一个地貌前面的一大块平坦地面,上面有飞机残骸、出生点、两个行李箱、通往上山路线的小径,后面还有一堵雾墙。如果第一块积木是你的,台地就会穿上你的地貌。你什么都不做它也会这样(见自动装饰);有了 API 3,你可以自己描述它的样子:用 Start 提供数据,需要定制布景时用 DressStart 写代码。
- 仅限积木,仅限第一块积木。经典终极攀登、每日地图和从海岸开始的山峰都没有台地;API 3 对它们没有任何影响。
- 需要
ApiLevel为 2 或 3。两者都会把你的地貌放在最前面;你的代码一旦用到Start或DressStart,就设为 3,注册日志行里会显示出来。ApiLevel为 1 时设置Start永远不会被使用,TFA 会在日志里说明。 - “所有人同一个世界”同样适用。每位玩家用相同的数字和相同的种子来建造台地。房主算出的指纹随岛屿一起传递,每位客人把它与自己的指纹比对(见测试)。
TFA 自己保留什么
无论你怎么声明,这些部分都归 TFA。你的层和你的 DressStart 要避开它们。编号对应区域一节下面的图。
slot.Anchor 处的平地上。在这片平地上(残骸周围 30 米)只会长出地被;地被与机身保持 6 米距离,实心副本保持 14 米。slot.PathX)。浅沟本身始终空着,距其中轴 12 米内没有高于 1.5 米的东西,18 米内只有低矮的东西。排在最前面:你的地面
TFA 把台地铺在你的地面第一行的前面。为了找到这一行,房主会从 slot.StartPoint 出发,在你的 Root 下寻找 Terrain 层上可行走的地面:
- 范围是
StartPoint后方 40 米到前方 160 米,高度在StartPoint上方 30 米到下方 160 米之间; - 在一条 96 米宽的带上横向取 25 个采样点(每 4 米一个),其中至少 8 个有这样的地面的第一行,就是前缘。对模组来说,
Map层上的岩石不算地面; - 没有这样的地面时,TFA 会在
StartPoint铺一块平坦的台地并写入日志——你的地貌绝不会因此失败。
台地最远延伸到前缘后方 124 米(你的地面更低的地方更长)。请让这一段保持空着:你放在那里的东西会被压在残骸和出生点下面。
自动装饰
没有 Start——或者 Start 的 Layers 为 null——时,TFA 会根据你的地貌自带的东西自己装饰台地:
- 它读取
slot.Root下的 PEAK 生成器(PropSpawner、DecorSpawner和SpawnList,未激活的变体也算),按大小和形状把它们的预制体分成岩石、高大物、植物和地被。一切都按 TFA 通常的密度撒布。 - 岩石先取自你的生成器,然后是你在
Map层上建的巨石,最后是你的框架的营地。TFA 从不使用你的框架里的植物。 - 台地采用你的地貌的地面材质和你的框架的地势。框架的地标、光标记和池塘它都不会有。台地前方你自己的地面不受影响。
- 完全用代码生成、没有 PEAK 生成器的地貌,只会得到地势和岩石。请给它写层。
描述外观:TfaStartStyle
在你的 TfaBiome 上设置 Start,TFA 就会把它变成台地。它只是纯数据——不会对每个对象运行代码——所以在每位玩家处都一样。TFA 会把每个数字限制在其范围内,并跳过无法使用的内容,各写一行日志。和所有更新的接口一样,请把 API 3 的成员放进单独的方法里(快速上手,第 2 步):
using System.Runtime.CompilerServices;
using TrueFinalAscent.Api;
internal static class TfaBridge
{
public static void Register()
{
TfaBiome biome = new TfaBiome
{
Id = "crystalcaves",
Version = "1.1.0", // Start and DressStart are content: raise it when you change them
Replaces = new[] { "Tropics", "Roots" },
// ... Names, Ink, Build, ApiLevel = 2 and the rest, as in step 3 ...
};
// API 3 members exist only in a TFA whose ApiVersion says so - keep them out of this method.
if (TfaBiomes.ApiVersion >= 3)
{
AddStart(biome);
}
TfaBiomes.Register(biome);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void AddStart(TfaBiome biome)
{
biome.ApiLevel = 3; // placed like 2; 3 says your code knows the start plateau
biome.Start = CrystalStart.Style(); // the look as data
biome.DressStart = CrystalStart.Dress; // set pieces as code (optional)
}
}
这是示例地貌的样式:一种地面材质、平缓的地势、三个层、一个带灯光和声音的地标,以及一段环境音。其中两个层和地标使用你的 Build 做出来的模板(见下一节);第三个层使用一株 PEAK 的植物。
using System.Collections.Generic;
using TrueFinalAscent.Api;
using UnityEngine;
internal static partial class CrystalStart
{
// Loaded from your asset bundle in Awake.
public static Material Floor, Glass;
public static AudioClip Hum, Chime;
// Plain data: TFA clamps it and builds the same plateau on every player.
public static TfaStartStyle Style()
{
return new TfaStartStyle
{
Ground = Floor, // null = the largest ground material under your Root
Relief = new TfaStartRelief { Hill = 2.5f, Rough = 0.6f, Mounds = 18 }, // fields left at -1 keep the frame's value
Layers = new List<TfaStartLayer>
{
// Tall crystals as the plateau's walls, from templates your Build makes (next section).
new TfaStartLayer
{
Find = "Props/T_crystal_tall", Kind = TfaStartKind.Tall,
Zones = TfaStartZone.Back | TfaStartZone.Sides, Density = 12f, ScaleMin = 0.9f, ScaleMax = 1.5f,
},
// Boulders in loose groups across the field; they keep your own glow script.
new TfaStartLayer
{
Find = "Props/T_boulder", Kind = TfaStartKind.Rock, Zones = TfaStartZone.Field,
Density = 8f, Cluster = 0.7f, Keep = new[] { "CrystalGlow" },
},
// Ground cover from PEAK's own Roots pool: nothing to ship.
new TfaStartLayer
{
Vanilla = "Roots:Fern", Kind = TfaStartKind.Cover,
Zones = TfaStartZone.Field | TfaStartZone.Path | TfaStartZone.Bed, Density = 40f,
},
},
Landmark = new TfaStartLandmark
{
Find = "Props/T_crystal_spire", Scale = 1.2f, Radius = 9f, Sink = 1.5f, Sound = Chime,
Glow = new Color(0.45f, 0.8f, 1f, 1f), // alpha above 0: a light marker, like TFA's darkness lamps
},
RockMax = 6f,
Ambience = Hum,
AmbienceVolume = 0.4f,
ClimbPractice = true, // two stacked rocks with a luggage case on top
};
}
}
- 层按你给的密度,在你指定的区域里生长。几个小层比一个大层效果更好;最多算 16 个。只要你给了一个列表——哪怕是空的——它就会取代自动装饰:TFA 不会再加自己的岩石或植物,所以请把你的岩石做成
Rock层。TFA 会让从残骸到小径尽头的视线保持畅通:这条线两侧 25 度内没有高于 6 米的东西,会这样的副本会被横向移开或跳过。 - 地标站在 TFA 的位置上,脚下是与地面平缓衔接的平整台座,所以绝不会悬空。请选轮廓清晰的模型:玩家在残骸处就能看到它。无论轴心在哪里,TFA 都会把网格底部放在台座上;小树丛会再加 3 到 7 个你的植物副本。
- 两个起点行李箱和攀爬练习归 TFA,战利品取自你的框架;你只选是否搭建练习(
ClimbPractice)。 - 池塘需要
AllowWater和一个Water材质;TFA 负责铺设,并给它们真正的水域。 - 声音:没有
Ambience时,TFA 会借用它在你根节点下找到的循环环境音。
模板:Template、Find、Vanilla
每个层和地标只能指定一个模型:
Template——你的资源包里的预制体,或场景对象(未激活也可以)。Find——你的Root之下的路径,在Build之后解析。适合你的Build自己做出来的模型:把它们做一次,保持未激活,放在一个“Props”对象下,并取简单的名字。Vanilla——该生物群系的生成器所列出的 PEAK 预制体,例如"Tropics:Jungle_Willow_Big"。不需要打包。副本以其生成器给出的大小和朝向为起点,你的缩放在此基础上生效。
// In your Build (every player): make the templates once, inactive, under your Root. Find reads them after Build.
private static IEnumerator Build(TfaBiomeSlot slot)
{
Transform props = new GameObject("Props").transform;
props.SetParent(slot.Root.transform, false);
props.gameObject.SetActive(false); // templates only: never seen, never walked on themselves
Template(props, "T_crystal_tall", PrimitiveType.Capsule, new Vector3(2.5f, 8f, 2.5f));
Template(props, "T_crystal_spire", PrimitiveType.Capsule, new Vector3(5f, 21f, 5f));
Template(props, "T_boulder", PrimitiveType.Sphere, new Vector3(3f, 2f, 3f));
// ... then the ground and the way up, as in the quick start ...
yield return null;
}
private static void Template(Transform parent, string name, PrimitiveType shape, Vector3 size)
{
GameObject model = GameObject.CreatePrimitive(shape);
model.name = name; // plain name: "Props/T_crystal_tall" finds it
model.layer = LayerMask.NameToLayer("Map"); // props on Map, walkable ground on Terrain
model.transform.SetParent(parent, false);
model.transform.localScale = size;
model.GetComponent<Renderer>().sharedMaterial = CrystalStart.Glass;
}
TFA 根据模型的网格来测量它,而不是 Renderer.bounds(未激活的对象它为零)。每个副本都由 TFA 制作:它保留网格、材质、碰撞体和你在 Keep 里列出的脚本,其余全部剥掉(见TFA 会移除什么)。根节点上的 LOD 组会保留。
区域
一个层要说明它在哪些区域生长。图从上方看台地,你的地面在上方;编号 1 到 6 是表里的区域,7 到 10 是上面那张表里 TFA 自己的部分。副本如何放在地面上、哪种类型可以放在哪里,由该层的 TfaStartKind 决定(见参考)。
| 编号 | 值 | 位置 | 允许的种类 |
|---|---|---|---|
| 1 | TfaStartZone.Back | 沿后缘的一条带,深 36 米,位于雾墙之前——适合放天际线。 | Rock、Plant、Cover、Tall |
| 2 | TfaStartZone.Sides | 两侧最外的 42 米,在土埂上——你的地貌的“墙”。 | Rock、Plant、Cover、Tall |
| 3 | TfaStartZone.Field | 开阔的中部:残骸周围的环带、前缘之前的带状区,以及土埂和后部之间的一切。 | Rock、Plant、Cover |
| 4 | TfaStartZone.Bed | 残骸周围 30 米内。只能放地被,且离机身不少于 6 米。 | Cover |
| 5 | TfaStartZone.Path | 小径两侧,距中轴 4 到 18 米,从残骸前 20 米到前缘:距中轴 12 米内最高 1.5 米,再往外最高 6 米。浅沟本身始终空着。 | Plant、Cover |
| 6 | TfaStartZone.Front | 在台地前方你自己的地面上,到其第一行之后 72 米为止,以房主测量过的范围为限;小径尽头两侧各 12 米的通道保持空着。除非某个层要求,否则不启用:TFA 默认不装饰你自己的地面。 | Rock、Plant、Cover |
定制布景:DressStart
对于数据说不清的东西——地标周围的一圈水晶、一座桥、一块路牌——DressStart 会在每位玩家处运行一次你的代码。它在 TFA 铺好台地和它自己的部分(残骸、出生点扇形、行李箱、小径、地标)之后、TFA 撒布你的层之前运行,所以你的定制布景最先占用地面,TFA 再填满周围的空间。Layers 为 null 时,它运行前 TFA 的自动层已经放好。
using TrueFinalAscent.Api;
using UnityEngine;
internal static partial class CrystalStart
{
// Loaded from your asset bundle in Awake: content bound to your Version, the same on every player.
public static GameObject CrystalPrefab;
// A ring of 8 spots as literal numbers: Sin and Cos may round differently per CPU, a table cannot.
private static readonly Vector2[] Ring =
{
new Vector2(16f, 0f), new Vector2(11.3f, 11.3f), new Vector2(0f, 16f), new Vector2(-11.3f, 11.3f),
new Vector2(-16f, 0f), new Vector2(-11.3f, -11.3f), new Vector2(0f, -16f), new Vector2(11.3f, -11.3f),
};
// Every player, after TFA laid the plateau and its own parts, before TFA scatters. Pure: only the slot and Random.
public static void Dress(TfaStartSlot slot)
{
if (CrystalPrefab == null || float.IsNaN(slot.Landmark.x))
{
return; // nothing to copy, or this style has no landmark to put a ring around
}
foreach (Vector2 offset in Ring)
{
// UnityEngine.Random is seeded from slot.Seed in here: the same numbers on every player.
float x = slot.Landmark.x + offset.x + Random.Range(-1.5f, 1.5f);
float z = slot.Landmark.z + offset.y + Random.Range(-1.5f, 1.5f);
float y = slot.Height(x, z);
if (float.IsNaN(y) || !slot.IsFree(x, z, 2.5f))
{
continue; // off the plateau, or TFA's wreck, fan, path or landmark is there
}
GameObject crystal = slot.Copy(CrystalPrefab, "ring crystal"); // TFA's stripped copy under slot.Holder
if (crystal == null)
{
continue;
}
crystal.transform.position = new Vector3(x, y - 0.4f, z);
crystal.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
crystal.transform.localScale *= Random.Range(0.8f, 1.3f);
slot.Reserve(x, z, 2.5f); // TFA's own scatter keeps out of the disc
}
}
}
约定与 Build 相同,但更严格,因为 TFA 会比对结果(见测试):
- 纯。只根据
TfaStartSlot来计算——它的种子、它的采样函数、slot.Measured里房主的文本——以及与你的Version绑定的内容。你自己的配置、场景、时间和帧计数在不同玩家处各不相同,会让台地出现差异。 - 随机。在
DressStart里,UnityEngine.Random由slot.Seed设定种子;之后 TFA 会恢复它自己的状态。不要用别的来源,不要遍历以 Unity 对象为键的集合,也不要依赖FindObjectsByType的顺序。 - 没有物理。你运行时台地是未激活的,射线打不到它。请用
Height、Normal和Lowest:它们在每位玩家处都相同。 - 只放在
Holder下(slot.Copy会把副本放在那里)。不要有 PhotonView、刚体、物品或生成器;可行走的碰撞体放在Terrain层,道具放在Map层。 - 你保留或添加的脚本在整个台地建成后唤醒。它们在每位玩家处运行,必须是本地的,不能移动碰撞体。
- 数学。TFA 把位置比对到 1/16 米。优先用
+ - * /、Sqrt、Floor和Abs;位置计算避免用Sin、Cos、Pow和 Perlin 噪声,否则舍入方式不同的 CPU 会显示为不一致。像示例那样用写死的数字表最安全。 - 要快。它在加载画面里运行,不会让出帧。请控制在 250 毫秒以内;带渲染器的对象最多算 400 个。
- 一起失败。如果它抛出异常,它在这位玩家处做出的一切都会被移除。请确保它要么在所有人处失败,要么都不失败。
你的定制布景需要世界的真实形状吗,比如台地前方你的地面?和 Measure 一样,射线是房主的事:设置 MeasureStart。它在台地成形之前由房主运行一次(此时 slot.Measuring 为 true,采样函数返回 NaN),返回一段文本;每位玩家在 slot.Measured 里读取这段文本。请保持简短:以 Base64 计超过 2 KB 时 TFA 会丢弃它,Measured 为 null。
TFA 会移除、限制和拒绝什么
TFA 拦不住你代码里的射线,所以它转而让结果安全,并在每位玩家处保持一致。这发生在你的样式之后、DressStart 之后、台地唤醒之前:
PhotonView 和 Item(连同它们所在的部分)、Rigidbody、所有 Joint、ConstantForce、Cloth、所有粒子系统以及所有 Animator 或 Animation,都会在任何东西被唤醒之前,从每个副本和你的 DressStart 组下的一切中移除。你的脚本若要求其中之一([RequireComponent]),会先被移除。日志会统计数量。CollisionModifier 等)会被移除。只保留无害的本地脚本:不带状态或石化的 ClimbModifierSurface、WaterZone、AudioLoop、BakedVolumeLight、WobbleSpinBounce、降温的 StatusEmitter 和 StatusField,以及不伤人也不推人的 CollisionModifier。你自己的脚本会保留在 Copy 的副本上;层的副本上只保留 Keep 里列出的,触发器、灯光和声音在那里会被剥掉。DressStart 中,只要某个部件的占地碰到出生点扇形、残骸(6 米边距)、小径浅沟或 TFA 规划好的圆盘(行李箱、地标、池塘),它就会连同其下的一切被隐藏。所有玩家相同。Layers 为 null 时,DressStart 运行前 TFA 的自动层已经放好,并且先计入。Reserve 用来为你的对象周围留出空间;只有 DressStart 正常返回时,它占用的圆盘才算数。DressStart 前后比较残骸、它自己的各个组和已占用的位置。有差异时记为错误写入日志,并保持原样:不会撤销任何东西。DressStart 抛出异常,它做出的一切——它的部件和它的预留——都会被移除,台地就像你没有 DressStart 一样保留。你的样式里的层和地标会保留。TFA 会记录错误及其堆栈。请确保它要么在所有人处失败,要么都不失败。m 段)与房主不同,这位客人会关闭 FA_StartMod 下的所有碰撞体——你的层和你的定制布景——这样出生点不会出现隐形墙或空洞,并写入日志。外观仍可能不同,所以请让它完全一致。整个台地都遵守下面的预算。计数来自建好的副本,所以每位玩家拒绝的是同样的副本。
| 限制 | 上限 | 超出后 |
|---|---|---|
| 台地上的副本 | 1000 | 后面的副本会被拒绝,按放置顺序——所有玩家被拒绝的是同样的副本。 |
| 岩石 / 大型植物 / 地被 | 320 / 420 / 480 | 按种类,同上。 |
| 地标、小树丛 | 地标 1 个副本,小树丛 3 到 7 个 | 两者都计入上面的副本数。 |
| 投影绘制 | 600 | 投影渲染器数 × 材质槽数。超出后阴影会被关掉,不会隐藏任何东西:地标最后失去阴影,其次是离从残骸经浅沟、越过前缘的路线最近的最大阴影;地被从不投影。 |
| LOD0 渲染器 | 2500 | 先拒绝地被,再拒绝植物,最后拒绝岩石。 |
| LOD0 三角面 | 250 万 | 顺序相同。 |
| 碰撞体 | 1500 | 顺序相同;地被没有碰撞体。 |
| 光标记 | 4 | 从第五个起光标记会被移除。你的和 TFA 的一起计算。 |
| 水面 | 3 | 不再增加池塘。 |
| 新增声源 | 4 | 不再增加声源。 |
| 粒子系统 | 模组没有 | 从每个模板和 DressStart 中移除。 |
你的 DressStart | 400 个对象、2 个灯光、2 个音频源 | 其余的会被隐藏或关掉,从最后的开始。你的定制布景也计入上面台地的副本、LOD0 渲染器、三角面和碰撞体:放不下的顶层布景会被隐藏。超过 250 毫秒时 TFA 会在日志里警告。 |
| 放置整个台地 | 约 1 秒 | TFA 自己的耗时目标;它会把用时和数字一起写进日志。 |
你的路段,你的规则
你的地貌建在一个框架里,并继承框架带来的一切:它的长度和高度、营火、天气和寒夜。有了 API 2,你可以告诉 TFA:从该框架去掉什么、迷雾收拢得多快、末日模式下 TFA 的哪些天气会在你的路段里随机出现,以及你的路段有多高。一切都是可选的;不设置其中任何一项的地貌,行为与以前完全一样。
- 声明,不要打补丁。告诉 TFA 你的路段需要什么。TFA 会在每位玩家处用同样的方式处理,对中途加入的玩家和换房主之后也一样。不要自己关闭 PEAK 的天气区域、迷雾或寒冷。
- 每个人都需要你的地貌。之后在没有它的情况下加入攀登的玩家会被移出这次攀登:在积木里一律如此,在经典攀登里则是只要你的地貌使用了
Rise或任何路段规则(DropFromFrame、FogPace或Weathers)。不设置其中任何一项的地貌行为不变:没有它的玩家攀登的是 PEAK 自己的路段,即原版框架。 - 运行时的天气——队伍到达时来一场风暴——要么用 TFA 的天气接口(天气标签页),要么是你自己的代码,见自己启动天气。这一部分讲的是你的地貌声明的内容。
- 先检查版本,再去使用比你的最低版本更新的内容(快速上手,第 2 步)。
从框架去掉什么:DropFromFrame
默认情况下,你的路段保留其 PEAK 地貌带来的一切。DropFromFrame 指明哪些不要保留。默认值 TfaFrameParts.None;多个部分用 | 组合。
Weather普通终极攀登中该框架的 PEAK 天气:雨林的降雨、森林的阵风、雪山的暴风雪、方山的烈日。末日模式下 PEAK 的区域本来就是静止的;那里指的是 TFA 的方山常驻烈日。去掉后,TFA 会在每位玩家处让这种天气在你的路段里保持静止。ColdNight寒夜,从海岸一直到方山。去掉后,你的路段里夜晚温和,和火山口之后一样。biome.DropFromFrame = TfaFrameParts.Weather | TfaFrameParts.ColdNight; // a warm, sheltered valley
不要自己关闭 PEAK 的天气对象:TFA 的降雨会借用它们的一部分,而在一位玩家处被关掉的区域在其他玩家处仍会吹风。队伍离开你的路段后,PEAK 的天气会自行继续。以后可能会加入新的部分;地貌只会去掉它指明的部分。
迷雾速度:FogPace
TFA 为每一段提供它自己的迷雾。它从玩家来的那个营火后面开始,按 PEAK 的速度收拢。更大或更难的地貌可能需要更多时间:当队伍所在的路段是你的路段时,FogPace 会乘以迷雾的速度。1 是 PEAK 的速度,0.5 是一半的速度,2 是两倍;TFA 会把它限制在 0.25 到 2 之间,超出范围的值会写入日志。如果你的路段是最后一段,你的速度会一直保持到迷雾在峰顶结束。
biome.FogPace = 0.75f; // a third more time than PEAK's fog gives
不要自己修改 OrbFogHandler.speed——你的速度和 TFA 的会相乘。
你的路段里的 TFA 天气:Weathers
在末日模式下,房主每隔几分钟会从一张表中随机选出 TFA 的天气,这张表规定了哪个地貌里可以出现哪种天气。你的路段使用其框架对应的那一列。Weathers 会为你的路段替换它:
- 键是某种 TFA 天气(见下方列表),值是它出现的可能性:
0永不出现,1是基准可能性(TFA 自己的表大多用 1,少数地方用 2 或 3),2-5是1的相应倍数。超出 0-5 的值会被限制并写入日志。TFA 先随机决定下一个天气有多稀有(常见、稀有或特殊),再从可以在这里出现的天气中挑选。如果这一类都不行,就先改用更常见的类别,再改用更稀有的类别——所以一份只允许稀有或特殊天气的列表,每次随机都会落在其中之一。 - 你没有列出的天气保持框架的可能性。
"*"设置所有你没有列出的天气:["*"] = 0再加几个键表示“只要这些”;单独的["*"] = 0表示你的路段里没有任何 TFA 天气——天气循环在那里休息,就像在天底一样。 null(默认)保持框架的那一列。
// A desert in a Tropics frame: sand instead of rain, no snow, no tsunami.
biome.Weathers = new Dictionary<string, int> { ["sand"] = 3, ["rain"] = 0, ["snow"] = 0, ["tsunami"] = 0 };
// Or only the weathers you name, nothing else (these are rare or special ones, so every roll ends at one of them):
// biome.Weathers = new Dictionary<string, int> { ["*"] = 0, ["quake"] = 2, ["dark"] = 1 };
// Or no TFA weather at all - the cycle rests in your stage:
// biome.Weathers = new Dictionary<string, int> { ["*"] = 0 };
- 随机和幽灵投票都会遵循它。常驻天气和房主的手动菜单不会。
- 房主在天气设置里关掉的天气仍然是关的,天气自身的条件也继续有效:月亮只在夜里,火山爆发只在山里有熔炉时,侦察长之守望只在有侦察长时。
- 混沌模式下每种天气在任何地方的可能性相同——但你的
0仍然是0。用它来排除会毁掉你路段的天气,而不是出于口味。 - 未知的键只会写入一次日志并被忽略,所以来自较新 TFA 的键在较旧的 TFA 里不会造成问题。
在末日模式之外,TFA 不会随机天气;那里你的路段得到的是你自己启动的天气(见下文),例如通过天气接口。
更高或更低的路段:Rise
你的路段建在一个框架里:一个 PEAK 地貌的长度、高度和营火。Rise 会改变它的高度。TFA 会把终点营火连同它的岩石抬高(或降低)相应的量,你之后的每一段也随之移动——不会有东西悬在半空,也不用往下爬。它在经典攀登和积木里都有效。
// Registration: 40-60 units taller than the frame, a different height per run.
biome.Rise = seed => 40 + (int)(seed % 21);
// In Build: EndCampfire already stands at its new height, slot.Rise says by how much (after clamping).
int steps = 60 + slot.Rise; // a taller stage gets a longer ramp
seed就是你的Build在slot.Seed里拿到的种子,所以你的生成器可以据此算出自己的山顶。- 世界单位,和 transform 位置一样——不是米。PEAK 的高度计大约每单位显示 1.6 米。
- 范围 -30 到 +100。超出的值 TFA 会限制并写入日志。
- 由房主在攀登开始时询问一次——在机场,任何岛屿出现之前。只能是纯运算:不能用场景、物理或
UnityEngine.Random。如果它抛出异常,抬升量为 0。 - 结果随这次攀登一起传递:每位玩家建造同一座山。
slot.Rise会告诉你的BuildTFA 实际使用的值(限制之后)——在那里读取它,不要再调用一次你的函数。 Build运行时,EndCampfire已经位于新的高度。照常从slot.StartPoint向上建到slot.EndPoint。这一段的迷雾会自动随之变大。- 每位玩家都需要相同版本的你的地貌才能加入使用它的攀登。之后加入但没有它的玩家会被移出这次攀登——在经典攀登里也一样,因为抬升会改变山体(见你的路段,你的规则)。
框架的长度不变。更长的上山路线由你在其中自己蜿蜒。
自己启动天气
PlayersHere 在每位玩家处运行,会告诉你队伍何时进入(true)和离开(false)你的路段——这是开始和停止声音、风或风暴的时机。true 在你的路段之前的营火被点燃时到来;如果你的路段排在最前面,则在攀登开始时到来。你的天气在每位玩家处运行,所以请在所有地方用同样的方式启动和停止它。
要使用 TFA 自己的 28 种天气——带难度、单个数值,或一片可以游泳的湖——请从这里调用 TFA 天气接口;它有自己的标签页。slot.OwnWeatherAllowed 在除每日地图之外的所有攀登中都为 true(每日地图本来就不会出现模组地貌),末日模式也一样:TFA 的随机和你的天气并行运行,你通过天气接口启动的天气会接管与之冲突的随机天气。随机本身仍用 Weathers 在你的路段里控制。
private static void OnPlayersHere(TfaBiomeSlot slot, bool here)
{
// Your own wind, sounds or storms: start with the group, stop when it leaves.
// To use one of TFA's 28 weathers instead, call TfaWeather.Start / Stop from here (Weather tab).
CrystalStorms.Running = here && slot.OwnWeatherAllowed;
}
你自己的天气或水是否属于上山路线的一部分——一段必须游过去的路?在末日模式下,旁边可能还有别的天气在运行;如果别的模组的天气占着 TFA 的天气位置,你的启动会回答 Busy——每隔几秒再问一次(见天气标签页里的湖示例)。
想要自己的天空和光照?在 Build 中修改 slot.Sky:
// In Build: start from PEAK's profile of this stage and make it your own.
DayNightProfile sky = UnityEngine.Object.Instantiate(slot.Sky);
// ... change colours and fog ...
slot.Sky = sky;
基本规则
- 只在
Root(或EndCampfireGroup)下建造。不要动MapHandler、它的分段或 PEAK 的地形——路段由 TFA 自己连接。 - 可行走的碰撞体放在
Terrain层,道具放在Map层——TFA 的雨、闪电和岩浆会寻找这些层。 - 经常让出帧。一帧里建造好几秒会让加载画面卡住。
- 如果
Build抛出异常,TFA 会在这位玩家处保留 PEAK 原来的路段并告知他——加载永远不会卡住。请确保Build要么在所有人处失败,要么都不失败,否则这位玩家攀登的是另一段路。 - 只相对于 slot 建造,从
slot.StartPoint建到slot.EndPoint。StartCampfire在积木里可能为 null(ApiLevel2 或 3)。你的地貌可能出现在攀登的不同路段(在积木里可在任意位置),MaxPerRun大于 1 时还能出现多次——所有取决于本次攀登的状态都按 slot 保存,不要放在静态字段里:TFA 对每个 slot 单独询问Rise、Fits和Measure。 DropFromFrame、FogPace、Weathers、Rise、Start和DressStart都属于你的内容:所有玩家必须相同,所以修改它们时请提高Version。- 起点台地(API 3):先用数据描述,只有数据说不清的东西才用
DressStart。DressStart必须是纯的——只根据 slot 和种子计算,绝不根据你的配置或场景——否则客人处的台地会与房主的不同。 - 高度都是世界单位(PEAK 高度计上约 1.6 米):
Rise、StartPoint、EndPoint。 - 你的模组在普通 PEAK 攀登里有自己的迷雾速度、寒冷或天气开关?普通攀登里保留它们,在终极攀登中关掉(
TfaBiomes.IsFinalAscentRun),改为在这里声明终极攀登的数值。 - 你的模组平时会自己替换地貌?在普通攀登中照旧,只在终极攀登中让路:
// Your mod normally replaces a biome by itself? Step aside in FINAL ASCENT runs only:
if (TfaBiomes.IsFinalAscentRun)
{
return; // TFA calls your Build if the host picked your biome
}
参考
下面的一切都是 API 2 或 API 3(TfaBiomes.ApiVersion 为 3),自 True Final Ascent 3.0.0 起提供。API 3 就是起点台地:Start、DressStart、MeasureStart,以及从 TfaStartStyle 到 TfaStartSlot 的各个类型。
TfaBiome——你注册的内容
Id唯一标识,2-24 个小写字母或数字。Version内容版本;所有玩家必须相同。不能包含 | 或 @。Replaces适合的框架:Tropics、Roots、Alpine、Mesa。在积木里由房主为每块积木选择框架,第一个是默认值。MaxPerRun一次攀登中最多出现几次(默认 1)。大于 1 时请按 slot 保存状态。Names各语言名称:en(必填)、de、cn。Ink你的地貌在地图设置和本网站攀登图中的颜色。Measure可选,仅房主:测量世界,返回文本。Build必填:在 slot.Root 下建造;用 yield return null(或你自己的 IEnumerator)分摊工作,绝不要用 StartCoroutine。PlayersHere可选:队伍进入(true)或离开(false)了你的路段。ApiLevel你接受的放置方式:1(默认)只在营火之后,2 还可排在攀登最前面,以及紧跟在熔炉、城塞或天底之后(积木),3 与 2 相同,并表示你的代码了解起点台地(API 3)。高于 ApiVersion 会被拒绝。InBuilderfalse 让你的地貌不进入积木(默认 true)。Fits可选 (frame, previous, next) => bool:在你的地貌无法立足的积木位置返回 false。要快,且在每位玩家处结果相同;如果它抛出异常,TFA 当作 true。DropFromFrame你的路段不从框架继承的内容:Weather、ColdNight(默认 None)。FogPace你的路段里的迷雾速度,0.25-2(默认 1)。Weathers可选:TFA 天气键对应可能性 0-5,"*" 代表其余。只影响末日模式的随机和幽灵投票。Rise可选 seed => units:你的路段额外的高度,-30 到 +100。仅房主,在攀登开始时调用一次。Start可选,API 3:TfaStartStyle,以数据形式描述起点台地的外观。在你的 Build 之后、在每位玩家处读取,仅当你的地貌排在积木山峰最前面时才用。DressStart可选,API 3:Action<TfaStartSlot>,以代码为起点台地做定制布景。在每位玩家处运行,必须是纯的,在 TFA 自己的部分之后、它的撒布之前。MeasureStart可选,API 3,仅房主:Func<TfaStartSlot, string>,在台地成形之前测量 DressStart 需要的东西(射线),并以文本返回。每位玩家在 slot.Measured 里拿到它;以 Base64 计超过 2 KB 时会被丢弃。TfaBiomeSlot——TFA 提供给你的内容
Root在这里建造。位于起点营火(或 StartPoint),朝向终点营火。StartCampfire、EndCampfire你的路段之前和之后的营火。没有营火通向你的路段时 StartCampfire 为 null(积木,ApiLevel 2 起)。StartPoint玩家进入你的路段的位置:起点营火的火堆,否则是熔炉或城塞的山顶营地、天底的桥边营地,或攀登的起点脚下。排在攀登最前面时,TFA 会在你建造完成后把坠机点铺在它的正前方(起点台地)。EndPointEndCampfire 的火堆——你的上山路线必须到达的位置。EndCampfireGroup整个终点营火连同岩石。VanillaTerrain这一段的 PEAK 地形——仅作模板,建造后隐藏。Seed本次攀登、这一段和你的地貌的种子,所有人相同。Measured房主 Measure 的结果,或 null。Sky路段的光照和天空配置——替换它即可修改。OwnWeatherAllowed只在每日地图上为 false(那里从不出现模组地貌);在其他所有攀登中为 true,末日模式也一样——TFA 的随机和你的天气并行运行。见天气接口。InBuilder在积木山峰里为 true:Position 是它在链中的位置,框架可能是副本。RiseTFA 为这个 slot 实际使用的抬升量(限制之后);没有 Rise 时为 0。Position在攀登中的位置,0 = 第一段;在积木里是它在链中的位置。Occurrence这是你的地貌的第几个副本,从 1 开始。Previous、Next你前后的路段:Shore、Tropics 等,或 mod: 加标识;开头为 "",结尾为 Peak。在积木里,火山口(Caldera)、熔炉(Kiln)、雾沼(Gloom)和城塞(Citadel)是各自独立的积木:你的邻居可以是前面没有 Caldera 或 Gloom 的 Kiln 或 Citadel,也可以是后面没有 Kiln 或 Citadel 的 Caldera 或 Gloom。Replaces、Biome你建造所用的框架、你的注册信息。TfaFrameParts
None、Weather、ColdNightDropFromFrame 的标志位:用 | 组合。地貌只会去掉它指明的部分;以后可能加入新的部分。TfaStartStyle——以数据描述你的起点台地(API 3)
把它设为 TfaBiome.Start。每个字段都是可选的。
GroundMaterial。台地的地面。null = slot.Root 下 Terrain 地面中最大的材质。它从上方投射(世界 x 和 z),所以三向(triplanar)或世界空间着色器效果最好。ReliefTfaStartRelief。台地地面的丘陵、粗糙度和土丘。null = 你的框架的地势。LayersList<TfaStartLayer>。台地上生长的东西;最多 16 层,多出的会被忽略。null = TFA 根据你根节点下的生成器自己装饰台地。任何列表,哪怕是空的,都表示只用你的层:TFA 不会再撒自己的岩石或植物。LandmarkTfaStartLandmark。放在 TFA 的位置、小径旁的一个地标,也可在对面带一片小树丛。null = 没有。RockMaxfloat,米,1.5 到 16。场地里一块岩石的最大半径。-1(默认)= 沿用你的框架的值。越小,台地越平静。AmbienceAudioClip。你自己的环境音:残骸处的循环 3D 声音,80 米内全音量,到 220 米渐弱至无。会取代 TFA 平时从你根节点下的循环环境音借用的声音。AmbienceVolumefloat,0 到 1(默认 0.5)。Ambience 的音量;PEAK 的环境音量设置会在此基础上生效。AllowWaterbool(默认 false)。TFA 可以在台地上铺 1 到 2 个真实水体的池塘(半径 6 到 10 米,深 0.8 米)——会让游泳者减速。需要 Water;没有它,该设置会被忽略(写入日志)。WaterMaterial。池塘水面的外观。TFA 通过名称在你的 Root 下的某个渲染器上找到它,所以那里必须有一个渲染器使用这个材质。ClimbPracticebool(默认 true)。TFA 搭你的框架的攀爬练习:两块叠起来的岩石,顶上放一个行李箱。在你的台地上找不到框架的岩石时跳过。TfaStartLayer
TfaStartStyle.Layers 里的一个副本层。超出范围的数字会被限制并写入日志。
TemplateGameObject。作为模型的预制体或场景对象(未激活也可以)。每层 Template、Find、Vanilla 三选一;一个都没有或有多个的层会被跳过并写入日志。Findstring。slot.Root 之下用简单名称写的路径("Props/T_crystal"),在你的 Build 之后解析。适合你的 Build 自己做出来的模板。Vanillastring。某个 PEAK 地貌的生成器所引用的 PEAK 预制体:"Tropics:Jungle_Willow_Big" = 地貌(Tropics、Roots、Alpine、Mesa、Caldera、Kiln、Gloom、Citadel)、冒号、简单的预制体名。这样可以直接用 PEAK 自己的植物和岩石来装饰而不必打包。TFA 找不到的名称会让该层被跳过。KindTfaStartKind(默认 Plant)。副本如何放在地面上;见下面的种类。ZonesTfaStartZone(默认 Field | Sides)。该层可以生长的位置;用 | 组合。某个区域里不允许的种类会丢掉那一位,并写入一行日志。Densityfloat,该层各区域内每公顷的副本数,0 到 400。-1(默认)= TFA 对该种类的默认密度(岩石 12、植物 25、地被 60、高大物 40)。Clusterfloat,0 到 1(默认 0.5)。0 让副本均匀分布,1 把它们聚成 3 到 7 个一组的紧密小团。ScaleMin, ScaleMaxfloat,0.25 到 4(默认 0.85 和 1.2)。副本的缩放范围。Radiusfloat,米。TFA 在副本周围留空的占地范围。-1(默认)= 取模型网格的边界。Tiltfloat,度,0 到 20。最大倾斜角。-1(默认)= Rock 为 8,其余为 0。Sinkfloat,0 到 0.8。高度中埋进地里的比例。-1(默认)= 该种类自己的值。ShadowsTfaShadow(默认 Auto)。见下文。Keepstring[]。能在复制中保留下来的你自己脚本的类型名。模板上的其他一切都会被剥掉(见“TFA 会移除什么”)。TfaStartLandmark
Template, Find, Vanilla与层相同:只能指定一个来源。Radiusfloat,4 到 25 米。地标下平整台座和周围留空区域的占地。-1(默认)= 按模型测量。地标不会悬空:TFA 会把地面平缓过渡到它。Scalefloat,0.05 到 20(默认 1)。相对于你制作的模板的缩放。Sinkfloat,0 到 5 米(默认 0)。地标埋进地里多深。SoundAudioClip。可选,地标处的循环 3D 声音,在 4 到 60 米范围内可听到。GlowColor。Alpha 大于 0 时在地标处放一个光标记(BakedVolumeLight),就像 TFA 在漆黑天气里用的灯。默认 Color.clear = 没有。SideGrovebool(默认 true)。地标对面(距小径 60 到 90 米)的一片小树丛,由你的 Plant 和 Tall 层构成。TfaStartRelief
每个值默认为 -1:沿用你的框架的地势。梯田和沙丘不属于 API 3。
Hillfloat,0 到 8 米。宽阔丘陵的高度。Roughfloat,0 到 3 米。细微起伏的高度。Moundsint,0 到 40。土丘的数量。TfaStartZone
None, Back, Sides, Field, Bed, Path, Front标志位 0、1、2、4、8、16、32:用 | 组合。各区域见上文“区域”中的图和说明。TfaStartKind
Rock35% 到 55% 埋进地里并倾斜。场地里的岩石会缩小到 RockMax。不能放在 Bed 和 Path。Plant直立在地面上(埋进 0.15 米),保留你做的碰撞体。不能放在 Bed。Cover地被:移除碰撞体,从不投射阴影;平地区域里唯一允许的种类,可以靠近到离机身 6 米。Tall天际线:只能放在 Back 和 Sides;除非该层要求(TfaShadow.On),否则不投影。TfaShadow
Auto, On, OffAuto:大型岩石和植物会投影,地被和天际线不投影。On:总是投影(地被除外)。Off:从不投影。TFA 为整个台地设定的 600 次投影绘制预算另外生效。TfaStartSlot——DressStart 拿到的内容(API 3)
世界坐标;+z 指向你的地貌。采样函数(Height、Normal、Lowest、ZoneAt、IsFree)是起点行和种子的纯函数:在每位玩家处结果相同。
Idstring。你的地貌的标识。Seedulong。你的起点的种子,所有玩家相同。UnityEngine.Random 在 DressStart 里由它设定;之后 TFA 会恢复它自己的随机状态。Measuredstring。房主的 MeasureStart 返回的文本,或 null(没有,或以 Base64 计超过 2 KB)。请在这里读取它,不要自己测量。Measuringbool。在 MeasureStart 里为 true:台地尚未成形,采样函数返回 NaN,Holder 为 null。HolderTransform。台地上 FA_StartMod 之下、用于你的定制布景的未激活组。只在这里建造;它会随完成的台地一起被唤醒。测量期间为 null。BoundsBounds。台地加上其前方测量过的带状区(到 Front 之后 72 米)。AnchorVector3。残骸平地的中心。Floorfloat。残骸处台地地面的高度。Frontfloat。你自己的地面第一行的 z。LandmarkVector3。你的地标所在位置(其中心下的地面);没有地标时各分量都是 NaN。PathX(z)float。小径中轴在 z 处的 x。FrontAt(x)float。台地在 x 处与你的地面相接的 z。Height(x, z)float。已建成地面的高度(台地网格,否则是前方测量过的你的地面),范围之外为 NaN。Normal(x, z)Vector3。该点的地面法线;未知处为向上。Lowest(x, z, r)float。中心和距离 r 的四个点中最低的地面——放置巨石的底座。范围之外为 NaN。ZoneAt(x, z)TfaStartZone。某点所在的区域;在 TFA 自己的地面上和范围之外为 None。IsFree(x, z, r)bool。该圆盘是否落在地面上,并避开了 TFA 的地面、它的副本和你的预留?Reserve(x, z, r)bool。在 DressStart 里占用一个空闲圆盘:TFA 的布景会避开它。圆盘不空时返回 false。Copy(template, name)GameObject。TFA 在 Holder 下做的模板副本,不含网络、物理、粒子和动画组件,也不含 PEAK 的玩法脚本(无害的本地脚本保留);你自己的脚本会保留。被拒绝时(根节点带 PhotonView、刚体或物品)为 null,在 DressStart 之外也为 null。位置和朝向由你来设。TFA 天气键
Weathers 使用的键。新天气会加入这个列表;已有的键永不改变。
storm狂风rain降雨snow暴雪sand沙暴sun烈日sleepfog眠雾spores孢子云poison毒雾shroomrain蘑菇雨cactusrain仙人掌雨foodfrenzy暴食狂欢floorlava地板是岩浆dark漆黑quake地震moon蓝月blood血月wisps鬼火antigrav反重力thunder雷暴icefog寒雾petrify石化日光watch侦察长之守望tsunami海啸flood山洪avalanche雪崩volcano火山爆发shockfrost急冻hayfever花粉季TfaBiomes
Register(biome)注册你的地貌;缺少内容时返回 false(并写入日志)。IsFinalAscentRun在岛屿场景加载时询问:这座岛是终极攀登岛时为 true。ApiVersion自 True Final Ascent 3.0.0 起为 3(2 是起点台地之前的接口)。接口出现需要你的代码跟进的改动时会提高;更高版本接口的成员只有在它这么说时才存在。测试
设置好你的字段,打开终极攀登的地图设置,在该路段标题处的列表里选择你的地貌(或把它放进积木山峰),然后开局。TFA 的日志是英文的。在 BepInEx/LogOutput.log 中可以看到:
- 游戏启动时:
Mod biome registered: 'yourid' 1.0.0 for Tropics, Roots (API 2, without frame weather, fog pace x0.80, own weather weights, with rise).API 编号就是你设置的ApiLevel;之后只会出现你设置过的内容:DropFromFrame、FogPace、Weathers、Rise。DropFromFrame、FogPace或Weathers中 TFA 不得不限制的值,或未知的天气键,会在这里直接给出警告。Rise在注册时不检查(见下一条)。 - 岛屿生成时:
Mod biome 'yourid' 1.0.0 replaces Tropics (0.4s, seed 12345, rise +40).,在积木里是Mod biome 'yourid' 1.0.0 at place 3 in frame Tropics (0.4s, seed 12345, rise +40).。其中会写出抬升量(rise +40),房主在攀登开始时还会看到Mod biome 'yourid' raises Tropics by +40 (seed 12345).Rise就是在这时检查的:超出 -30..100 的值会在这一行之前给出警告(Mod biome 'yourid': rise 150 outside -30..100 - clamped to 100.),抛出异常的Rise会记为Mod biome 'yourid': Rise threw (...)并按 0 处理。你的Build抛出的错误也会完整地记录在那里。 - 队伍进入你的路段时:
Mod biome 'yourid' in Tropics: frame weather held, mild nights, fog pace x0.80, own weather weights, rise +40.(在积木里是in place 3 (Tropics)),每位玩家一次,且只包含你设置过的部分。 - 末日模式下,房主会记录每一次随机,例如
Cycle rolls: quake (Rare) 12 s, Tropics, mod biome 'yourid', day, level Normal.当Weathers决定了候选池时,你的 id 会出现在其中。
起点台地(API 3)会多出这些行。把 ApiLevel 设为 2 或 3,把你的地貌放在积木山峰的最前面,然后开局:
Mod biome registered: 'yourid' 1.0.0 for Tropics, Roots (API 3, ..., own start: 3 layers, landmark, ambience, dress).游戏启动时。API 编号就是你设置的ApiLevel;own start:之后只会出现你设置过的内容(3 layers或automatic layers、landmark、ambience、water、dress、start measure)。ApiLevel为 1 时 TFA 会改为警告:Mod biome 'yourid': Start, DressStart and MeasureStart are never used - ApiLevel 1 never stands first.Start style of mod 'yourid': 3 layers, landmark 'Props/T_crystal_spire', ground Floor.岛屿生成时,每位玩家处都有:TFA 从你的Start里读到了什么。问题各警告一次,例如Start style 'yourid': layer 2 has no template - skipped.、Start style 'yourid': layer 1 template 'Props/T_x' not found - skipped.、Start style 'yourid': layer 3 zones Bed not allowed for Rock - using Field.或Start style 'yourid': AllowWater without Water - no ponds.Start measure 'yourid': 412 characters, 552 as Base64.在房主处,当你的MeasureStart返回了文本时。以 Base64 计超过 2 KB 时 TFA 会丢弃它,并写出Start line key 'mod.yourid' over 2 KB - dropped,所有玩家的slot.Measured都为 null。如果MeasureStart抛出异常:Start measure 'yourid' threw: ... - no measurement.Builder: start spot in front of Tropics (mod 'yourid'): ..., style 3 layers (412 copies), landmark at left, dress 37 objects in 4 ms, ..., as on the host.岛屿生成时,每位玩家处都有。数字依次是你的层及其副本数、地标所在的一侧,以及你的DressStart的对象数和耗时。这里也可能是style automatic layers、no landmark、landmark not planned、landmark refused by the budget、no dress或dress removed (threw)。在客人处,如果台地与房主的一致,这一行以as on the host结尾;房主处后面没有内容。Start mod 'yourid': style 3 layers (412 copies), landmark at left, dress 37 objects in 4 ms, side grove 5, own ambience hum, ground Floor on 38 renderers, host measure 412 characters; FA_StartMod: 0 rigidbodies, 0 joints, 0 PhotonViews.在Builder: start spot那一行之前几行,带着同样的数字,以及 TFA 还为你放置了什么:小树丛、你的环境音、地面材质替换,以及房主测量文本的长度。只会出现你设置过的部分。分号之后:FA_StartMod下还剩多少网络和物理组件——应当全部为 0。Start dress 'yourid': 2 PhotonViews removed, 1 object in the spawn fan hidden, 120 over the budget hidden, 37 footprints reserved, 5 reservations by the mod.TFA 在你的DressStart之后移除、隐藏或关掉了什么(什么都没做时是nothing removed),以及预留了多少占地。你的脚本若要求一个被移除的组件([RequireComponent]),会一起被移除:1 script that required a removed part removed。根节点带PhotonView、刚体或物品的模板无法复制:Start dress 'yourid': template 'x' has a network, body or item root - not copied.(层或地标则是Start style 'yourid': ...)。Start dress 'yourid' threw: ... - removed, the plateau stays.你的DressStart抛出了异常(堆栈会作为警告紧随其后)。TFA 在这位玩家处移除了它做出的东西。运行太慢时也会报告:Start dress 'yourid' took 312 ms (over 250 ms)...., MISMATCH (host 1A2B3C4D) in m在台地与房主不同的客人处,Builder: start spot那一行的结尾。字母指出哪些部分不同:m是你的样式和DressStart,其他的属于 TFA。在Builder: start spot那一行之前几行会出现Start dress 'yourid' differs from the host - 37 colliders under FA_StartMod off.
请用第二位玩家测试一次,再用一位中途加入的玩家测试一次。
对接口有疑问或建议?在 PEAK Modding Discord 上联系 CptPICHU。
