Imported from Path-of-Terraria/PathOfTerraria (
AGENTS.md). Install upstream withnpx skills add Path-of-Terraria/PathOfTerraria. Copyright stays with the author.
AGENTS.md
Project Summary
Path of Terraria is a large tModLoader mod that replaces a lot of vanilla Terraria progression with ARPG systems inspired by Diablo, Path of Exile, and Last Epoch.
Major pillars in this repo:
- Gear/itemization with affixes, rarity, implicits, sockets, maps, and unique items
- Active skills, skill trees, augments, passives, and class-adjacent progression
- A separate passive tree system driven by JSON data
- Quest-driven progression centered around Ravencrest and boss domains
- Mapping/subworld content, including reusable
MappingWorldand boss domain subworlds - Extensive custom UI and interaction layers
This is a large codebase. Do not start by reading random files under Assets/. Start from the subsystem relevant to the task.
High-Level Layout
PoTMod.cs- Mod entry point.
- Important:
CreateDefaultContentSource()redirectsContent/...asset requests toAssets/....
Common/- Shared gameplay systems, registries, mechanics, mod players, questing, mapping, subworlds, worldgen, utilities.
- This is where most reusable logic lives.
Content/- Concrete game content: items, NPCs, skills, passives, projectiles, tiles, subworld-specific content.
- If
Commonis framework/base logic,Contentis the actual mod content built on top of it.
Core/- Infrastructure: UI manager, item hook plumbing, graphics, commands, low-level helpers, camera/audio/time/pathfinding.
Assets/- Textures, sounds, effects, structures, load screens, UI art.
Localization/- HJSON localization split by topic and language.
Common/Data/- JSON-backed registries and data definitions.
Where To Look By Task
Itemization, affixes, rarity, gear, sockets
Start here:
Core/Items/PoTItemHelper.cs- Central helper for item level selection, affix rolling, rerolling, and affix application.
Core/Items/PoTGlobalItem.cs- Broad Path of Terraria item behavior for all supported items.
Core/Items/GearGlobalItem.cs- Socket behavior, gear prefix/suffix pools, equip/unequip handling, tooltip insertion.
Core/Items/ItemDatabase.cs- Registers droppable items and maps vanilla items into PoT itemization.
Content/Items/Gear/Gear.cs- Base class for modded gear items.
Common/Systems/Affixes/- Affix base classes and player-side affix tracking.
Common/Data/AffixRegistry.cs- Loads affix distributions from JSON and resolves tier/value data.
Important patterns:
- Item behavior is split between base item classes and global item systems.
- Affix data is partly data-driven:
- code type in
Common/Systems/Affixes/ItemTypes/*.cs - roll/tier metadata in
Common/Data/Affixes/*.json
- code type in
- Vanilla items can be opted into the gear system through
ItemDatabase. - Sockets are handled through
GearGlobalItemandContent/Socketables.
Skills, skill trees, augments, skill passives, skill specials
Start here:
Common/Mechanics/Skill.cs- Base active skill abstraction.
Common/Systems/Skills/SkillTree.cs- Singleton-style definition of a skill tree.
Common/Systems/Skills/SkillTreePlayer.cs- Multiplayer sync and per-player cached skill tree state.
Common/Systems/ModPlayers/SkillPlayers/SkillCombatPlayer.cs- Hotbar skill slots, keybinds, using/equipping skills.
Common/Mechanics/SkillPassive.csCommon/Mechanics/SkillSpecial.csCommon/Mechanics/SkillAugment.cs
Concrete content lives in:
Content/Skills/Content/SkillPassives/Content/SkillSpecials/Content/SkillAugments/Content/SkillTrees/
Important gotchas:
SkillTreeinstances are effectively shared definitions. Player-specific load state is delayed and applied throughSkillTreePlayer.- Do not treat
SkillTreefields as safe per-player mutable storage outside the established load/sync flow. - If a skill changes visuals or localization based on specialization, inspect
Skill.Texture,Skill.DisplayName, andSkill.Description.
Passive tree
Start here:
Common/Systems/PassiveTreeSystem/PassiveTreePlayer.csCommon/Systems/PassiveTreeSystem/Passive.csCommon/Data/PassiveRegistry.csCommon/Data/Passives/Passives.json
Important patterns:
- The passive tree is heavily data-driven from JSON.
- Node definitions, positions, and connections come from the registry JSON.
- Code for actual effects lives in
Content/Passives/. PassiveTreePlayer.StrengthByPassiveis the fast path for "what does this player currently have allocated?"
Quests and progression
Start here:
Common/Systems/Questing/Quest.csCommon/Systems/Questing/QuestModPlayer.csCommon/Systems/Questing/QuestSystem.csCommon/Systems/Questing/QuestStepTypes/Common/Systems/Questing/RewardTypes/Common/Systems/Questing/Quests/MainPath/
Concrete quest-giver NPCs are usually in:
Content/NPCs/Town/
Common pattern:
- A town NPC decides which quest is available.
- That NPC starts the quest through
QuestModPlayer. - The quest itself defines steps/rewards in
Common/Systems/Questing/Quests/... - Quest progression may also upgrade Ravencrest state or conditional drops.
If a task mentions "story progression," "boss unlocks," or "why isn't this NPC offering X," start with quest files and the corresponding town NPC.
Mapping, boss domains, subworlds
Start here:
Common/Subworlds/MappingWorld.cs- Base class for map/boss-domain subworlds.
Common/Subworlds/BossDomainSubworld.cs- Base class for boss domains.
Common/Subworlds/RavencrestSubworld.cs- Hub town subworld.
Common/Mapping/MapDeviceInterface.cs- The large custom UI for the map device.
Content/Items/Consumables/Maps/Map.cs- Base item for maps.
Concrete domains/areas live in:
Common/Subworlds/BossDomains/Common/Subworlds/MappingAreas/
Important gotchas:
MappingWorld.AreaLevel,MapTier, andAffixesare static state used across domain entry.- World/subworld state transfer relies on
CopyMainWorldData,ReadCopiedMainWorldData,CopySubworldData, andReadCopiedSubworldData. - If you change progression-sensitive domain behavior, inspect tracker sync in
MappingWorldandCommon/Systems/Synchronization/Handlers/.
World generation and Ravencrest
Start here:
Common/World/GenerationSystem.csCommon/World/AutoGenStep.csCommon/World/Passes/Common/World/Generation/Common/Subworlds/RavencrestContent/
Important patterns:
- Overworld generation is inserted through
AutoGenStepimplementations. - Ravencrest is a real subworld with copied state and structure placement, not just a UI scene.
- Structures are often placed from assets under
Assets/Structures/.
UI
Start here:
Core/UI/UIManager.cs- Base UI registration/render insertion.
Core/UI/SmartUI/- Higher-level UI framework used by many mod UIs.
Common/UI/- Most gameplay UI states.
Common/Mapping/MapDeviceInterface.cs- One of the largest and most custom UI files in the repo.
Important pattern:
- This mod has its own UI registration layer on top of tModLoader.
- Before changing a UI, search for both the specific UI state and
SmartUiLoader.
NPCs and town content
Start here:
Content/NPCs/Town/Common/NPCs/Common/NPCs/Dialogue/Common/NPCs/QuestMarkers/
Town NPCs often combine:
- quest offering
- custom dialogue components
- Ravencrest spawn positioning
- shop gating based on quest progression
Multiplayer / sync
Start here:
Common/Systems/Synchronization/Networking.csCommon/Systems/Synchronization/Handlers/
If you add state that matters outside singleplayer, search first for similar handlers rather than inventing ad hoc packet code.
Base Types And Extension Points
When adding or changing content, find the nearest base type first.
- Gear items:
Content/Items/Gear/Gear.cs - Maps:
Content/Items/Consumables/Maps/Map.cs - Skills:
Common/Mechanics/Skill.cs - Skill tree nodes:
Common/Mechanics/SkillPassive.csCommon/Mechanics/SkillSpecial.csCommon/Mechanics/SkillAugment.cs
- Passive tree passives:
Common/Systems/PassiveTreeSystem/Passive.cs - Quests:
Common/Systems/Questing/Quest.cs - Quest steps:
Common/Systems/Questing/QuestStep.csandQuestStepTypes/* - Subworlds:
Common/Subworlds/MappingWorld.csorBossDomainSubworld.cs - Waypoints:
Common/Waypoints/ModWaypoint.cs
In general, avoid implementing a feature directly in a concrete content file until you have checked whether the subsystem already has a hook, interface, or base class for it.
Data-Driven Areas
The repo is not purely code-driven.
Important data sources:
Common/Data/Affixes/*.json- Affix tier/value metadata.
Common/Data/Passives/*.json- Passive tree structure data.
Common/Data/VanillaItemData/*.json- Vanilla item classification into PoT itemization.
Localization/*/*.hjson- Split localization by topic.
Before changing code behavior, verify whether the actual behavior is defined by JSON or localization data.
Common Search Strategy
For most tasks, this order is efficient:
- Find the concrete content class.
- Find its base class in
CommonorContent. - Find the relevant
ModPlayer,ModSystem, or global item/NPC/projectile hook. - Check sync handlers if the feature is player-visible in multiplayer.
- Check localization and assets last.
Useful searches:
rg "TryAddSkill|UseSkill|SkillTreePlayer|SkillCombatPlayer" Common Contentrg "QuestModPlayer|StartQuest|CanStartQuest" Common Contentrg "MappingWorld|BossDomainSubworld|OpenMap|MapDevice" Common Contentrg "GenerateAffixes|GenerateImplicits|PoTItemHelper|GearGlobalItem" Core Common Contentrg "PassiveTreePlayer|PassiveRegistry|ReferenceId" Common Content
Project-Specific Gotchas
Contentin asset paths is redirected toAssetsbyPoTMod.CreateDefaultContentSource().- Many gameplay systems rely on
ModPlayerstate. If a change appears to "not stick," inspect save/load andResetEffects. - Skill trees are shared definitions with delayed per-player load. Be careful with stateful fields.
- Mapping/subworld systems copy progression state manually. Changing world/domain flow often requires sync/copy updates.
- A lot of progression is quest-gated rather than purely boss-flag-gated.
- Vanilla behavior is intentionally overridden in multiple places under
Common/Systems/VanillaModifications/.
Build And Verification
Primary project file:
PathOfTerraria.csproj
Build notes:
- The project imports
..\tModLoader.targets. - References include
SubworldLibrary,HousingAPI,NPCUtils,StructureHelper, andWayfarerfromlib/. - Custom shader build tools live under
BuildTools/ShaderCompiler/.
If you are validating a change, prefer:
dotnet build PathOfTerraria.csproj- targeted code search for similar patterns
- if relevant, check save/load methods and synchronization handlers
Practical Guidance For Future Agents
- Start narrow. This repo is too large for blind reading.
- Use
Commonfor framework logic andContentfor feature implementations. - If the task is about progression, always check quests and Ravencrest interactions.
- If the task is about loot, always check both the item class and the global item/helper path.
- If the task is about skills, check both the active skill and its tree/passives/specializations.
- If the task is about maps/domains, check item, UI, subworld, and sync together.
- If the task is about a UI bug, check both
Common/UI/...andCore/UI/....