I am looking to make a sandbox game and am looking for some best practices in renpy concerning screens, calling, and best practices for returns and controlling flow.
Functionally I want to move around from room to room and interact with characters. Once in a room, the game pauses and waits for users to select from one of 3 possible screens:
- Navigation - navigate away from the room
- Room-specific interaction - things that are relevant to the room
- Character interaction - things that are relevant to characters in that room
Below is an example of the basic setup all the rooms use. Occupants and such are dynamic and are set up through the initializer, parsed, and used to populate the relevant screens.
Code: Select all
label _theroom:
$ initialize_room(WHAT_ROOM, "room_navigator", "room_options")
$ room_interact = False
"You are in a room"
jump this_room_screen
label this_room_screen:
#Shows the relevant screens generated from initializer, for room and character-specific options
$ show_screens()
#Blocks the continued flow of the game until an interaction event (I think...)
$ ui.interact()
# Reloop on return, with new states
jump this_room_screen
From what I could find ui.interact is the "best" way to pause the game while waiting for screen input of some kind. I considered using a modal=True "blocking" screen but ui.interact seemed to be the common way to do this (and solves having to have a blocking dialog statement). However, a side effect is some interactions can be generated that move away from the room without coming back to the ui.interact. This results in the call stack incrementing with no real way to reduce it (e.g. a character or event may move to a different location and advance time, so we never return, or the player abandons a conversation and navigates away)
So my question is how much does renpy care about call stack size? Is it worth popping these ui.interact returns manually? Or am I just on the wrong track entirely and there is a better way to pause/hold the game state for screen interaction?
I am aware I could call a screen whose purpose is interaction, but having separate screens for each makes more sense to me. I also don't think this really solves the problem of moving away from the room, having the game state advance, and leaving the hanging ui.interact. Is this the wrong approach and should I just use a framed single screen? Or am I just completely turned around on this and approaching the whole thing backward.
Any insight or advice is appreciated