This Week in the Forest! #55
Added 2021-12-08 02:42:56 +0000 UTCYo Folks!
Here's what we've been up to this week, starting with A Word from Vixel!
12/06 weekly report:
Last week I worked on some code design improvements! These are focused on Object Spawning and Save/Load. Also pushed another bugfix update to the Act 2 official build, this time fixing a bug with the Dustin minigame causing Novice mode to appear too early.
In the old code, there was a 'Master Spawner' that would check quests and triggers to decide which critters, props, cutscenes and more, to spawn when you walked into a scene like Central Forest. This spawner lived in all scenes and knew about all spawnable objects.
Any script that lives in every scene causes Unity to automatically preload all the art, objects, and other resources that script "knows about" and keep them in memory. For example, adding the Master Spawner in Bucky's house would cause stuff like Fast Travel sprites, glowing glyphs, Finley's paintings, and the Dustin arena construction art to get loaded into memory -- even though that stuff could never spawn in Bucky's house!
Instead, we can put a 'Local Spawner' that only cares about scene-specific stuff into each scene. Since critters move all around, I'll still need a Critter Spawner that lives in all scenes, but having Local Spawners is way more efficient than one big bloated Master Spawner. This'll reduce memory usage which should help make the game run smoother and load faster. Also, divvying up spawn rules makes my scripts a lot more organized.
When Loading happened in Act 2, every script would get a chance to read the loaded data. We couldn't guarantee every script would always get its data *in time* before the scripts would start asking each other questions about the data...
For example, the Master Spawner and the Quest Manager work together to set up Central Forest when a date is ready to spawn (the Quest Manager does the dicerolls and picks eligible dates), but it was possible the Quest Manager hadn't finished loading its data yet when it was time to set up Penny's perch interaction, so the Spawner would get out of sync and cause weird bugs like being able to summon a 2nd copy of Penny to her perch while the 1st Penny is nearby on a date!
Now I've separated Save and Load into extra phases: Load has an AfterLoad, and Save has an AfterSave. All scripts that participate in Load can read data in any order at all. Scripts can only start asking each other about data in the AfterLoad phase, so there's no risk of wrong answers.
We can also be sure all scripts that care about saving can do so in Save, and any script that destroys objects or switches scenes can do so in AfterSave without causing any data loss. This design should help eliminate the corrupted savegames we were getting in earlier builds!
---
On my side, I don't have a whole lot to show, but y'all can have this sprite of Charlotte :>!

She hide :O
Most of my side has been writing and a bit of ad prep for our steam release! Got some potential leads on doing something pretty cool for that :>
I also got some folks visiting for a week, so things will be a bit slow from me. Good timing since I can't get too much done with my current lack of glasses anyways.
But to give y'all some visual entertainment, I'll be uploading some overdue coms I did a bit ago. Keep an eye out :>!
OH I SHOULD MENTION! We did update the Act 2 Official build to r2!
It's the same link as before, updated on itch, and you can also get it here.
This should be the last Act 2 build we make! Seems stable and working how we want it to now!
Comments
Everything sounds good
Lucky The Corgi
2021-12-08 12:11:29 +0000 UTC
