Saturday, March 18, 2017

dev blog #30 - bring some order into that chaos



this is just a small update on the progression of 0.7.
Today I had a big breakthrough regarding how to prevent fuck-ups like the mess currently in 0.6.x

as I wrote in a previous blog post, the way I handled dialogs and events was kind of chaotic



this resulted in problems like NPC not responding to you anymore (Mercedes stops giving you job offers after the first round) or responding to you despite they should not (Tamara not rejecting Mike's "learn together" invitation)

initially I thought the system I came up with was future proof but after adding only a handful of interactions with the NPCs and objects it turned out to be more of a "wild west" situation than a clean and structured handling of tasks.
major problem here is that everything could interact and manipulate everything



(simplyfied diagram of the chaos :P )
dialogs could start events or manipulate NPCs directly and events on the other side could do the same which resulted in me loosing track of "who poked whom"
this is a problem especially in "content related" dialogs that should only trigger on certain occasions or with certain NPC so to fight this chaos I came up with a more "centralized" manner of handling dialogs:
events now no longer activate or manipulate dialogs directly. instead they change the state of the "dialog giving" object (NPC, container, door, etc) and based on that the dialog to be displayed is selected which will lead to a more manageable way of interaction because now there is only one place where a dialog trigger can be manipulated

also, instead of letting the timekeeper handle content related dialogs (daily recurring stuff like jobs, school, etc) now each NPC and other objects handle that themselves because that also was another source of problem
keeping the trigger control in one place (on the object that gets interacted with) should eliminate the current state of lost overview, just like the saying "too many cooks spoil the broth"

2 comments:

  1. Great to see some progress on this! If I'm understanding this right, and I don't have much experience with coding admittedly, it sounds like you were originally using a tangled web of ifthenelse statements, and have moved to having events set up flags that can be easily referenced to ensure that if x=y then z output is given else, if else, etc. Looks promising.

    ReplyDelete
    Replies
    1. well, kind of.... it was already a bit more complex than if/then/else but yeah, you got the baseline of it right

      it still is a tangled web of if/then/else and switch/case statements but the source material itself is more sorted in the first place and the whole process is much more refined ;)

      Delete