Observation Space
The observation space in StarDojo provides a structured and comprehensive snapshot of the agent's environment at each timestep. Observations are returned as a Python dictionary with the following fields:
π§ Agent State¶
-
energy(str)
The agentβs current stamina. -
money(str)
The amount of gold the player holds. -
location(str)
Name of the current game location (e.g.,"Farm","Town"). -
position([int, int])
Player's current tile coordinates. -
facing_direction(str)
Human-readable direction:"up","down","left","right". -
inventory(list[dict])
A list of all inventory items, with fields such as: -
Name,Stack,Category, etc. -
chosen_item(dict)
The currently selected item from inventory. Contains item-specific info.
π World State¶
-
time(str)
Current in-game time (e.g.,"7:00 AM"). -
day(str)
Current day of the month (1β28). -
season(str)
Current season:"spring","summer","fall", or"winter".
π Farm Information¶
-
farm_animals(list[dict])
All animals on the farm, with type and position data. -
farm_pets(list[dict])
Pets on the farm. -
farm_buildings(list[dict])
Includes barns, coops, silos, etc., with location and state.
π§± Environment Layout¶
surroundings(list[dict])
Description of nearby tiles. Each entry includes:position: relative offset (e.g.,[0, -1])object: list of tags (e.g.,"Type: Dirt","Diggable: True")-
(Optional)
npc on this tile -
crops(list[dict])
Detailed data of visible crops: location, stage, harvestable status. -
exits(list[dict])
Reachable map exits from the current location.
π§± Structures & Interior¶
-
buildings(list[dict])
General building data visible on the screen (non-farm). -
furniture(list[dict])
Furniture placed indoors or outdoors, with type and location.
π₯ Interactive Elements¶
-
npcs(list[dict])
All nearby non-player characters with positions and metadata. -
shop_counters(list[dict])
Shop points of interaction, available options, inventory, etc. -
current_menu(dict)
Active UI menu details. May include: type,message,shopmenudata,animalsmenudata, etc.
πΌοΈ Visual Inputs¶
image_paths(list[str])
A list of auto-generated file paths to screenshots representing the current frame, don't need to set manually. Opening theimage_obsconfig in theenv_paramswill enable visual inputs.
βΉοΈ Note: The default observation set is constrained as below, used when a lightweight input is desired:
- Health: Current player health (int)
- Energy: Current stamina level (float)
- Money: Player gold (int)
- Current Time: Formatted as
"hh:mm AM/PM"- Day: Current day (int)
- Season:
"spring","summer","fall", or"winter"- Item in Your Hand:
index(int): Slot indexcurrentitem(str): Item name- Toolbar: 36-slot list in format
"slot_index N: [Item Name] (quantity: Q)"or"slot_index N: No item"- Current Menu: A dictionary with keys like
type,message,shopmenudata- Surrounding Blocks:
position: 2D offsetobject: List of string attributes- (Optional) NPC on this tile
π‘ Customization Tip:
You can freely modify or extend the observation format by editing the_get_obs()method in
agent/stardojo/environment/stardew/stardew_env.pyunder theStarDojoclass.
Remember to also update the prompt templates to match any changes in the observation structure.