Paper Mario uses two distinct object types to populate its worlds: NPCs (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pmret/papermario/llms.txt
Use this file to discover all available pages before exploring further.
Npc) and entities (Entity). NPCs are sprite-based characters with position, animation, AI scripts, and collision. Entities are geometry-based interactive objects — blocks, switches, chests, springs — that run a lightweight bytecode interpreter. Both systems share the same coordinate space but are managed through separate lists and update paths.
The Npc struct
The Npc struct is defined in include/common_structs.h starting at line 221. It is 0x340 bytes in size.
The
blur union at offset 0x020 serves double duty. During normal movement it holds a pointer to NpcFollowData (for partner follow behaviour) or motion-blur data. The actual field name is blur because the original use case was motion-blur effects for certain NPCs.NPC data definition
You describe an NPC in a map file usingNpcData (defined in include/npc.h). Each NpcData contains:
NpcGroup and spawn them all at once using MakeNpcs from an EVT script.
NpcSettings
NpcSettings (in include/npc.h) ties an NPC to its behaviour scripts:
The Entity struct
The Entity struct is defined in include/common_structs.h starting at line 553. It is 0xF8 bytes in size.
Entity script opcodes
Entities run a tiny bytecode interpreter. The available opcodes are defined ininclude/entity.h:
es_Call, es_Jump, es_SetCallback, etc.) let you write entity scripts as C arrays without specifying raw opcode integers.
Entity types
The following blueprints are declared ininclude/entity.h and cover all entity types in the game:
Interactive block entities
Interactive block entities
Entity_BrickBlock, Entity_MulticoinBlock, Entity_YellowBlock, Entity_HiddenYellowBlock, Entity_RedBlock, Entity_HiddenRedBlock, Entity_TriggerBlock, Entity_HeartBlock, Entity_SuperBlock, Entity_PushBlock, Entity_PowBlockHammer-required variants: Entity_Hammer1Block, Entity_Hammer2Block, Entity_Hammer3Block — each also has WideX, WideZ, and Tiny variants.World geometry entities
World geometry entities
Entity_SavePoint, Entity_RedSwitch, Entity_BlueSwitch, Entity_HugeBlueSwitch, Entity_GreenStompSwitch, Entity_BoardedFloor, Entity_BombableRock, Entity_BombableRockWide, Entity_BlueWarpPipe, Entity_Signpost, Entity_ArrowSign, Entity_HiddenPanelContainer entities
Container entities
Entity_Chest, Entity_GiantChest, Entity_WoodenCratePlant and environment entities
Plant and environment entities
Entity_Tweester, Entity_StarBoxLauncher, Entity_CymbalPlant, Entity_PinkFlower, Entity_SpinningFlower, Entity_BellbellPlant, Entity_TrumpetPlant, Entity_Munchlesia, Entity_SimpleSpring, Entity_ScriptSpringPadlock entities
Padlock entities
Entity_Padlock, Entity_PadlockRedFrame, Entity_PadlockRedFace, Entity_PadlockBlueFaceNPCs vs entities: key differences
| Aspect | NPC | Entity |
|---|---|---|
| Visual representation | Sprite (2D billboard) | 3D geometry via display list |
| Script system | EVT scripts (EvtScript) | Entity bytecode (EntityScript) |
| AI support | Yes — MobileAISettings, GuardAISettings | No built-in AI |
| Collision system | Cylinder/sphere against world, player, and other NPCs | AABB against player only |
| Used for | Characters, enemies, partners | Blocks, switches, chests, interactive scenery |
| List type | NpcList (world or battle) | EntityList |
AI systems
Enemy NPCs use one of two AI setting structs.MobileAISettings
Used for enemies that wander and chase:
GuardAISettings
Used for stationary enemies that only chase when the player enters their detection zone:
BasicAI_Main callable (from include/script_api/map.h) implements the standard patrol-detect-chase loop using whichever settings struct the NPC’s AI script passes to it.
Collision functions
NPC collision is handled by three functions insrc/npc.c:
npc_do_world_collision(Npc*)— tests the NPC against map geometrynpc_do_other_npc_collision(Npc*)— tests against other NPCs in the listnpc_do_player_collision(Npc*)— tests against Mario; returns true if a collision occurred
collisionChannel field to filter which geometry the NPC interacts with.
Partner NPCs
The active partner is an NPC managed bysrc/world/partners.c. It uses the NpcFollowData pointer in Npc::blur to track Mario’s position and mirror his movement with a short delay. Partner-specific overworld behaviour scripts are stored in src/world/partner/.
In battle, the partner becomes an actor rather than an NPC. The transition is handled by EVS_BtlBringPartnerOut and EVS_BtlPutPartnerAway.
Battle system
See how enemy NPCs become battle actors when an encounter begins.
Visual effects system
Learn how NPC decorations and status effects are implemented using the effects system.
