dev diary: syrup 2 event management
Added 2023-01-03 02:08:23 +0000 UTCMY NEW SYRUP 2 BUILD IS OUT!!!!!!!! (for higher tiers only! sorry ;o;)
this post contains some minor spoilers, so feel free to come back and read this later if you'd rather go into syrup 2 knowing nothing! (it shows a new character i hadn't revealed publicly yet, and you can infer some plot stuff from the early chapters. that's about it.)
super cool cutscene logic
ok maybe it's not THAT cool. but i thought i'd start with an overview of how i set up the code for processing what events to show and when.
syrup 2 isn't a linear story with different branches and endings like the first game--each day goes through the same looping lines of code, starting with "daystart" and ending with "endofday" labels. at the end of each cutscene, the ID string for that event gets added to a list (usually friend_events for the main plot). so the logic is written as "if you saw scene 1, but haven't seen scene 2, jump to scene 2"
it looks like this:

like, imagine a long line of those peristille ones, then if any of the conditions are met it jumps to that event before sending you to the main hub. (this was the least spoilery section of code so that's why i picked this part lol, you can see a bunch of unrelated daily stuff in there too like adding new customer requests, and giving you your paycheck once a week...)
anyway, daystart isn't the only place you can get an event! you can also get them by entering a map with certain party members, talking to someone after making the candy they wanted, or when you come home from adventuring.
i have a huge spreadsheet to keep track of each event and their triggers:

before i separated the story out into chapters, it was a real mess to keep track of the different storylines in my head...! so i'm really glad i formalized it more. i think the narrative is stronger for it too, by having the events lead into each other rather than giving the player complete freedom and potentially seeing events unfold in an unsatisfying order.
communicating story progress
because the story is much more structured than in the old demo, i needed a way to stop people from getting stuck when they're just missing one random scene with really specific requirements. so i put a reminder of what you're supposed to be doing at the bottom of the hub screen:

i'm SO glad i added it, because i kept loading up saves and not knowing what events i'd seen in that particular file. now i can load any random file and know EXACTLY where i am in the story (adding the chapter names in the save files helped a lot too!!)
the game figures out which objective text to show via a custom function. all the most important text is higher up in the long chain of what the player needs to do at any given moment:

and if no requirements are met, it just tells you to synthesize new candies, since that is syrup's ultimate goal :) (i'll have to change it to something else once you finish every recipe...)
something else i added was a little "complete!" stamp for the maps!

there's a masterlist of events for each location, and the game checks the event IDs the player collected and compares it against that masterlist. the code for it is, uh... KINDA COMPLICATED...

i only need a True or False to show the map completion stamp, but i ALSO use this function to get a percentage to show the player in the next screen i'm gonna talk about.
the ingame hint system!
because there are a lot of extra events that aren't required for the main story, i knew i needed a screen that would show players what events they haven't gotten yet, and a hint for how to reach them. so in late 2021, i added THE ASTROLOGIST, LIME!

the terminology for this is lifted from one of my favorite games, the witch and the hundred knight. astrologists can read the stars to fortell future events, which in this case, just means i get to use a cool lore excuse to tell players what else they can do in the game.
each place has its own checklist, and shows you hints in order similar to how i coded the objective text (but in this case it passes a facial expression along too!)

ORIGINALLY this screen also showed where you could get certain recipes, but it became redundant once i added the recipe collection screen in the library. something i'd really like to do for the astrology screen is to make each checkbox clickable in the same way the recipe cards are, so you can see different hints rather than only being shown one for each place... but it was too much coding work to redo it for this build. i should be able to finish it next time!
also, before i updated how the game calculated your progress percentage, i had been like... counting each event as +1, and checking that against the total for each place (which i had entered manually). putting in new events was a NIGHTMARE with this system, and i never wanted to touch it, which meant that it was really bad code!
i'm glad i changed it to a set of event IDs, because now it looks like this:

which is way easier to parse for a human, AND it counts itself instead of making me count events manually and updating the corresponding totals... i don't think i saved a screenshot of the old code, but it was very long and messy..... it functioned at the time, but i'm super relieved i could streamline it (just like all the other systems in this game!!)
that's about it!
long update today, but i think i covered all the stuff i wanted to explain. event tracking is one of those things in games that you totally take for granted, so having to design all this stuff for syrup 2 gave me a new respect for the programmers who have been coding these types of systems since long before my time!
thanks for reading <3
Comments
hahaha yeah all my posting happened to line up this way..! i'm glad the code stuff is at least fun to read, even if it's a little incomprehensible if you've never done programming stuff before haha. please enjoy syrup 2 when you get to it!!!!! i can't wait to hear your thoughts hehe
NomnomNami
2023-01-03 03:38:00 +0000 UTCThe world of coding certainly seems like quite the hell to get into, but so incredible with its potential......... I haven't started playing Syrup 2 yet (one day) but godddd Lime looks so cute. Very excited to see them..... IN THE GAME!!!! But all of the coding knowledge here, although pretty impossible to, like, realistically wrap my head around, is fun to read about for sure. Looking at the code and going "Oh yeah I get what that does", pff. THE RESULTS ARE.... CERTAINLY SPLENDID!!!! Also gosh three updates in three days.... and four posts in five days.... Whattah week.
Blackberry Mochi
2023-01-03 02:46:55 +0000 UTC