Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/Constellations/llms.txt
Use this file to discover all available pages before exploring further.
DVController (DonkeyViewController) ties together the Donkey model, the graph, and the Arcade UI layer. It schedules every traversal step via arcade.schedule_once, updates all five status bars after each state change, and surfaces Toast and DialogComponent prompts for user interaction. The controller is the single point of truth for whether a journey is in progress (journey_started) and for which stars have been visited (visited_stars).
Constructor
The shared references dictionary assembled by
Main. Keys accessed by this controller:"graph_controller"— the activeGraphControllerinstance, used for path queries and edge toggling"main_runner"— theMainrunner, used to readend_vertexduring hypergiant jumps
The Arcade
GameView instance. The controller calls view.add_widget, view.show_dialog, view.handle_close_dialog, and reads view.dialog_closed_status and view.last_dialog_input.Initial
{"x": float, "y": float} position for the donkey widget. Updated whenever the donkey moves to a new star.The
ViewDonkey Arcade widget. Must expose a donkey attribute pointing to the Donkey model. If the attribute is absent, the constructor calls _initialize_donkey_fallback() and emits an error log.src/assets/sounds/donkey_death.wav into self.death_sound. If the file is unavailable the attribute is set to None and a warning is printed; the rest of the controller continues to function normally.
walk_road
The main traversal entry point. Each call processes one hop alongroad and then schedules the next hop via arcade.schedule_once.
- Guard checks — verifies
widget.donkeyexists and is not dead. If the donkey is already dead and the journey has not yet been flagged as over,_handle_death()is called immediately. - Journey start — on the very first call (
journey_started == False), shows a “Starting journey” toast for 3 seconds, then rescheduleswalk_roadafter 3.5 s. - Completion check — if
vertex_index >= len(road), shows a success toast and returns. - Blocked-edge check — reads the connection data between
road[vertex_index - 1]androad[vertex_index]. If"blocked": True, opens a YES/NO dialog viashow_dialog(). YES unblocks the edge and continues; NO recalculates the route viaget_shortest_path(). - Movement — calls
_handle_movement(), which deducts travel costs, updates status bars, moves the widget to the star’s coordinates, and schedules_process_star_activities()after 1.5 s. - Star activities —
_process_star_activities()handles hypergiant stars, eating (donkey.eat_at_star()), and research (donkey.research_at_star()), each gated by death checks. - Finish visit —
_finish_star_visit()updates status bars and schedules the nextwalk_roadcall after 1.0 s.
Ordered list of vertex labels representing the planned route (as returned by
get_shortest_path or get_longest_path_with_donkey).Index of the next vertex to travel to. Starts at
1 (the first hop away from the origin). Incremented by one after each successful star visit.show_toast
Displays aToast overlay widget on the current view. Any previously active toast is removed first to avoid stacking.
The message string to display in the toast.
If provided, the toast is automatically removed after this many seconds via
arcade.schedule_once. If omitted, the toast persists until the next show_toast call replaces it.show_dialog
Creates aDialogComponent with YES and NO buttons and attaches it to the view.
The prompt text shown inside the dialog.
A zero-argument callable invoked by
view.handle_close_dialog after the user clicks YES or NO. The caller reads view.dialog_closed_status inside the callback to determine which button was pressed (True for YES, False for NO)._update_status_bars
Updates all five status-bar widgets to reflect the donkey’s current resource state. Called immediately after every state-changing operation (travel, eat, research) and once more at death.view.layout.widgets and writes to each widget’s value_label attribute, then calls trigger_render():
| Widget key | Value written |
|---|---|
bar_age | "{age} yrs" |
bar_energy | "{energy_donkey:.1f}%" |
bar_life | "{get_health_percent():.1f}%" |
bar_grass | "{grass_stored:.1f}kg" |
bar_healthStatus | donkey.health_status.text |
view.layout or view.layout.widgets is absent, the method prints a warning and returns without raising.
_handle_death
Handles all cleanup when the donkey’sis_dead() check returns True.
- Calls
_update_status_bars()one final time. - Plays
donkey_death.wavviaarcade.play_sound()ifself.death_soundis notNone. - Calls
donkey.get_death_cause()to retrieve a dict with keyscause,energy,health,age, andgrass. - Shows a 10-second toast containing all death metrics.
- Sets
self.journey_started = Falseto prevent any scheduled callbacks from advancing the journey further.
move_to_coordinates
Moves the donkey widget to the position stored inself.coordinates and forces an immediate visual refresh.
widget.left to coordinates['x'] - 50 and widget.bottom to coordinates['y'] - 50, then calls widget.trigger_render(). self.coordinates is updated by _handle_movement immediately before this method is called, so the widget snaps to the newly arrived star’s position. Returns None.
_hypergiant_decision
Called when the donkey arrives at a vertex whose data contains"hypergiant": True. Presents a YES/NO dialog asking whether to jump to a new destination.
- Opens a second input dialog prompting the user to type a destination star label.
- Calls
_hypergiant_travel(), which boostsdonkey.energy_donkeyby 50 % (capped at 100) and doublesdonkey.grass_stored, then updates the status bars. - After the input dialog closes, reads
view.last_dialog_input, validates the label againstgraph.vertex_list, and callsget_shortest_path_avoiding(new_target, final_destination, forbidden=visited_stars)to compute a route that skips already-visited stars. - Schedules
walk_road(new_path, 1)after 0.1 s.
walk_road(road, vertex_index + 1) after 1 s to resume the original path.
The current route list at the time the hypergiant star was reached.
Index of the hypergiant star within
road.Label of the hypergiant star, used as the origin for the new shortest-path query.
All delays throughout
DVController (ranging from 1.0 s to 3.5 s) are registered with arcade.schedule_once, which is non-blocking. The callbacks are queued in Arcade’s event loop and fire on the next matching frame, so the UI remains fully responsive — including dialog interactions — while the donkey is “in transit” between stars.