Hello. I am new to Twine( I am using Sugarcube2.14) and wanted to develop a life sim game. It is pretty simple and has only 2 locations right now so it isn't that complex. However I can't wrap my head around how to transition from one day to another.
Should I use a central passage with a BIG for loop with if statements to check whether the conditions for an event are being met? Or is there a more elegant way of doing it.
Comments
However because my locations are complex, I replicate the central location for each turn, so every turn the player enters a "new" passage. Otherwise the <<if>> statement would be about 5000 lines long.
Then I have branching locations that won't substantially change between turns, so they don't get replicated. But every time you return to the War Room the game uses the $time variable to choose what passage you link to.
Basically what I want is that in the event that there is no particular special event the game should display stock text that I will supply in a separate passage.
1. Do events only trigger when the reader enters a location, or can they trigger any time the reader clicks on a link. eg. one that advances time within the current location.
2. Do the events occur in the current location/passage, or is the reader moved to another passage containing the event.
3. If moved, can another event trigger when the reader returns to the original location/passage.
4. Can the same event happen more than once in a location, and if so how do you plan on tracking the number of times that event has occurred?
Two general methods used to implement event systems are:
A. Using the Task Objects (or their associated special passages) to monitor variable state each time a passage is shown.
B. Using the Config.navigation.override feature of the Configuration Object to re-direct the reader to a different destination than the one a link normally targets based on the current variable state.
Hence, event may need to be triggered for advancement of time at same location.
Both. For eg., a date event will redirect to the park perhaps from the home.The reader will be directed to a series of passages that contain the event and returned to their original location upon the completion. As in, an office event will be triggered when reader enters office in the morning. However, this event will occur in the same surroundings and keep the reader at the office itself.
Yes. There may be as many as four events in a day. Early morning, Morning, Afternoon and Evening.
Yes but only the stock events. The special events must occur when consitions to the if as mentioned in the first answer are met.
I say this because for loops are a twine stories biggest performance killer, so if you're looking at cycling through a hundred days with lots of unique content I don't know about that.
For example, your first state/location might be 'unmet'. The player wanders around until a certain event occurs and they meet the girl and successfully interact with her. The game then switches to 'flirt' state/location, where the player runs a number of events until the girl agrees to go out on a data and it switches to 'date' state/location, with a different set of special events.
Using this approach, you can probably use a much simpler state engine for each location, rather than trying to do one monstrous one that contains the whole world.
You can probably put all your routine events into a normal_day passage (or Widget, if you are using Sugarcube) and then simply display that (<<normal_day>>) if no special events have happened in the players current timeslot. This will save you having to duplicate the normal_day events in every location.
Might also be simpler to count days in quarters rather than wholes - Day / 4 gives you the day, Day % 4 gives you the time of day. This may be easier than maintaining separate counts for day and 'hour'. Thinks get simpler when you step away from a direct linear representation.
You are talking about what expression/condition needs to evaluate to true for a specific event to occur. I was asking about when are those expressions/conditions meant to be evaluated, and listed the two main points in a readers interaction with the story where those evaluations are generally done.
There is no built-in feature which continuously monitors when one or more variables change their values, which is why custom code is normally added by the Author to either/both the Task Objects (for passage traversal based event expression evaluation), or to the associated code of the relevant links (for link selection based event expression evaluation).