Modding:Fish data

From Stardew Valley Wiki
Jump to: navigation, search

Modding:Index

This page explains how the game stores and parses fish data, including spawning mechanics. This is an advanced guide for mod developers.

Parsing fish spawn conditions

The game checks two places to determine which fish to spawn when the player is fishing. This only applies to normal fish; the chance of spawning a legendary fish is calculated separately by the location code, before following the rules below. (Reverse engineered from BobberBar and GameLocation::getFish.)

Spawn locations

Each fish is assigned to an area within the location, and will only spawn if the player is within that area. The tile coordinates for each area is defined by GameLocation::getFishingLocation, which can be overridden for each game location. The following areas are defined:

  • Cindersap Forest:
    • pond (area #1 for tiles (0, 0) through (52, 42) inclusively);
    • river (area #0 matching any other part of the forest).
  • All other locations only have area -1, so where you fish from has no impact.

The fish that can be spawned in a given location are defined in the slash-delimited data from Data\Locations.xnb, specifically field indexes 4 (spring), 5 (summer), 6 (fall), and 7 (winter). Each field contains any number of <int fishID> (matching Data\Fish.xnb) + <int areaID> (or -1 for any area) pairs. For example, Cindersap Forest has this fish data for summer: 153 -1 145 0 144 -1 138 0 132 0 706 0 704 0 702 0. That can be parsed as:

value fish area
153 -1 Green Algae any (pond or river)
145 0 Sunfish river
144 -1 Pike any (pond or river)
138 0 Rainbow Trout river
132 0 Bream river
706 0 Shad river
704 0 Dorado river
702 0 Chub river

Fish data and spawn criteria

The fish data and spawn criteria is stored as thirteen slash-delimited fields in Data\Fish.xnb:

index syntax example content
0 name Pufferfish The fish name.
1 number 80 How often the fish darts in the fishing minigame; between 15 (carp) and 100 (glacierfish).
2 "mixed|dart|smooth|floater|sinker" floater How the bobber behaves during the fishing minigame.
3 int 1 The minimum fish size (in inches).
4 int 36 The maximum fish size (in inches).
5 [min time max time]+ 1200 1600 The time of day when they spawn. The min time is inclusive, max time is exclusive. May specify multiple ranges.
6 ["spring|summer|fall|winter"]+ season ID The seasons when they spawn. May specify multiple. (This is ignored. Seasons are taken from Locations.xnb instead)
7 "sunny|rainy|both" sunny The weather when they spawn.
8 690 .4 685 .1 unused?
9 number 4 The minimum water depth.
10 number .3 Spawn multiplier; used in spawn rate calculation (see below).
11 number .5 Depth multiplier; used in spawn rate calculation (see below).
12 level 0 The minimum fishing level.

Spawn rate

If a fish matches the spawn criteria, the probability that it will spawn is {spawn multiplier} - max(0, {minimum depth} - {actual depth}) × {depth multiplier} × {spawn multiplier} + {fishing level} / 50, up to a maximum of 90%. The actual depth is the bobber's tile distance from land.