Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Changing days on life sim games

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

  • I think we need more details. A simple variable that counts up can track the days that pass. I'm not sure why you need a loop in the first place, so talk us through it.
  • edited April 2017
    I use a $time variable I add +1 to.

    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.
  • Chapel wrote: »
    I think we need more details. A simple variable that counts up can track the days that pass. I'm not sure why you need a loop in the first place, so talk us through it.
    Say I have two locations 'Home' and 'Office'. Events can take place only if $days gte finite value and $location eq "home"/"office" and $stat gte finite value and $time_of_day eq say 'Afternoon'. How do I implement this without creating new passages for each day.

    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.

  • A number of questions need to answers before designing an event system, some of them are:

    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.
  • greyelf wrote: »
    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.
    Events trigger when the if conditional is satisfied i.e. $days gte some_no and $stat gte some_no2 and $location eq location and $time_of_day eq some_text

    Hence, event may need to be triggered for advancement of time at same location.

    greyelf wrote: »
    2. Do the events occur in the current location/passage, or is the reader moved to another passage containing the event.
    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.
    greyelf wrote: »
    3. If moved, can another event trigger when the reader returns to the original location/passage.
    Yes. There may be as many as four events in a day. Early morning, Morning, Afternoon and Evening.
    greyelf wrote: »
    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?
    Yes but only the stock events. The special events must occur when consitions to the if as mentioned in the first answer are met.
  • There's nothing inherently wrong with using separate passages for each day, or even each grouping of days. Eg have days 1-3 in one passage, 2-3 in another etc.

    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.
  • Depending on how your story evolves, you may be better off using passages for particular states of your game and using key events to trigger a transition between them. Day count conditions then become number of days in that state rather than an absolute number of days from the start of the game.

    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.
  • Nautilus wrote: »
    greyelf wrote: »
    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.
    Events trigger when the if conditional is satisfied i.e. $days gte some_no and $stat gte some_no2 and $location eq location and $time_of_day eq some_text

    Hence, event may need to be triggered for advancement of time at same location.
    My first question may not of been clear enough in it's intent.

    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).
Sign In or Register to comment.