Skip to content

Latest commit

 

History

History
188 lines (141 loc) · 5.73 KB

File metadata and controls

188 lines (141 loc) · 5.73 KB

Assignments

Source: Decompiled from HytaleServer.jar (pre-release 2026.02.05-9ce2783f7)

Assignments are prop distribution strategies that determine which prop to place at each candidate position. They are the selection layer between position providers (where) and props (what). There are 5 registered assignment types.


Common Fields

Field Type Required Default Description
Skip boolean No false If true, assignment is disabled
ExportAs string No "" Name for Export/Import reuse

Runtime Interface

At runtime, assignments implement:

Prop propAt(Vector3d position, WorkerIndexer.Id id, double distanceToBiomeEdge)

This returns the prop to place at a given position, or NoProp if nothing should be placed.


Assignment Types

Type: Constant

Always returns the same prop at every position.

Field Type Required Default Description
Prop PropAsset Yes NoProp The prop to place
{
  "Type": "Constant",
  "Prop": {
    "Type": "Prefab",
    "WeightedPrefabPaths": {
      "tree": { "Weight": 1.0, "Path": "Trees/OakTree.prefab" }
    }
  }
}

Type: FieldFunction

Selects assignments based on a density function value falling within delimiter ranges. The density context includes distanceToBiomeEdge.

Field Type Required Default Description
FieldFunction DensityAsset Yes Constant(0) Density function to evaluate
Delimiters DelimiterAsset[] Yes [] Range-to-assignment mappings

Each delimiter contains:

Field Type Required Default Description
Assignments AssignmentsAsset Yes Assignment for this range
Min double Yes Minimum value (inclusive)
Max double Yes Maximum value (exclusive)

Returns NoProp if no delimiter matches.

{
  "Type": "FieldFunction",
  "FieldFunction": { "Type": "SimplexNoise2D", "Seed": "biome_blend", "Scale": 0.01 },
  "Delimiters": {
    "sparse": {
      "Min": -1.0, "Max": 0.0,
      "Assignments": { "Type": "Constant", "Prop": { "Type": "Box", "Skip": true } }
    },
    "dense": {
      "Min": 0.0, "Max": 1.0,
      "Assignments": {
        "Type": "Constant",
        "Prop": { "Type": "Prefab", "WeightedPrefabPaths": { "tree": { "Weight": 1.0, "Path": "Trees/Pine.prefab" } } }
      }
    }
  }
}

Type: Sandwich

Selects assignments based on Y coordinate, creating vertical layers (sandwiched zones).

Field Type Required Default Description
Delimiters DelimiterAsset[] Yes [] Y-range-to-assignment mappings

Each delimiter contains:

Field Type Required Default Description
Assignments AssignmentsAsset Yes Assignment for this Y range
MinY double Yes Minimum Y (inclusive)
MaxY double Yes Maximum Y (exclusive)

Returns NoProp if no delimiter matches.

{
  "Type": "Sandwich",
  "Delimiters": {
    "underground": {
      "MinY": 0.0, "MaxY": 50.0,
      "Assignments": { "Type": "Constant", "Prop": { "Type": "Box", "Range": { "X": 1, "Y": 1, "Z": 1 }, "Material": { "Solid": "stone" } } }
    },
    "surface": {
      "MinY": 50.0, "MaxY": 200.0,
      "Assignments": { "Type": "Constant", "Prop": { "Type": "Prefab", "WeightedPrefabPaths": {} } }
    }
  }
}

Type: Weighted

Randomly selects from weighted assignment options using position-based randomization.

Field Type Required Default Description
SkipChance double No 0.0 Probability of returning NoProp (0.0–1.0)
Seed string No "" Random seed
WeightedAssignments WeightedAssets[] Yes [] Weighted options

Each weighted entry contains:

Field Type Required Default Description
Weight double No 1.0 Relative weight
Assignments AssignmentsAsset Yes Assignment for this weight

Behavior:

  • Converts position to grid coordinates: (x*10000, y*10000, z*10000)
  • Creates position-based seed for deterministic per-position randomization
  • First checks SkipChance — if random value < skipChance, returns NoProp
  • Otherwise selects from weighted options
{
  "Type": "Weighted",
  "Seed": "vegetation",
  "SkipChance": 0.3,
  "WeightedAssignments": {
    "trees": {
      "Weight": 2.0,
      "Assignments": { "Type": "Constant", "Prop": { "Type": "Prefab", "WeightedPrefabPaths": {} } }
    },
    "flowers": {
      "Weight": 5.0,
      "Assignments": { "Type": "Constant", "Prop": { "Type": "Box", "Range": { "X": 1, "Y": 1, "Z": 1 } } }
    }
  }
}

Type: Imported

References an exported assignment by name.

Field Type Required Default Description
Name string Yes Name of the exported assignment
{ "Type": "Imported", "Name": "forest_vegetation" }

Source files: AssignmentsAsset.java, Assignments.java, ConstantAssignmentsAsset.java, ConstantAssignments.java, FieldFunctionAssignmentsAsset.java, FieldFunctionAssignments.java, SandwichAssignmentsAsset.java, SandwichAssignments.java, WeightedAssignmentsAsset.java, WeightedAssignments.java, ImportedAssignmentsAsset.java