Home Artists Posts Import Register

Content

Hey Patrons!

Firstly, there’s a new content poll! This poll focuses on options for challenges that could be added to the game in v0.9.0!

As for what’s happening right now, v0.8.2d was just released, which fixes up a few bugs that were introduced in v0.8.2c. I’m finally getting started on actual development for v0.9.0, so hopefully I’ll have something to show off on that next week.

Patreon Refresh

As mentioned in last week’s weekly, I’ve been working on a smaller refresh to the Patreon page. There haven’t been any changes to tiers and rewards this time, but I’ve made changes to lots of the text and some of the images.

The tier descriptions are now a lot shorter and more focused, and the main about section also gets to the point much quicker. Readers who want more info can take a look at the second part of the about section, which goes into more detail about the specific rewards. Please let me know what you guys think of these changes!

In terms of further additions, I’d like to look into adding more images and possibly a video to the about section, which should help it stand out more. Also, as more weeklies and polls happen (and as some of the recent ones become a bit older) I might like to make a few more of them public as well.

A Bug with Frozen Emitters

For the rest of the weekly, I’d like to walk you guys through an interesting bug that popped up in v0.8.2c: When using a wand while under the effects of a time freeze, the game would get caught in an infinite loop.

First a bit of backstory. In Shattered there is a basic type of graphical entity called a Group, which can contain other graphical entities. Bunches of Particles are controlled by an Emitter, and Emitters are a type of Group. Way back in v0.2.2 when I added the Timekeeper’s Hourglass I needed a way to make all the game’s particles freeze.

So, I ended up doing this:

  • A new variable was added that’s shared by all Groups: freezeEmitters.
  • Whenever a Group is about to update itself and all the things it contains, it first checks if it is an Emitter and if freezeEmitters is set to true. If so, it doesn’t update itself or its contents.
  • freezeEmitters is then set to true/false whenever the hourglass is used and un-used.

For a bunch of technical reasons this approach is pretty kludgy, but let’s fast-forward to v0.8.2c. In v0.8.2c, I adjusted time freeze to always cancel after magical effects resolved, instead of before they resolve. This created a problem: wands resolve their effects after their zap visually completes, but for most wands that zap is a particle effect which uses a type of Emitter, but that Emitter is frozen so it never completes, so the wand is stuck waiting for something that will never end! Oops!

So, to solve this, we need some emitters to not be freezable, and this is a good opportunity to just clean up this whole mess. I’ve now re-written the code to do the following, which still isn’t great, but is a big improvement:

  • freezeEmitters is now a variable shared by all Emitters, not by all Groups.
  • Emitters now also have an isFrozen function which returns a true or false value, this function is specific to each Emitter.
  • Emitters now check isFrozen when they update, rather than checking freezeEmitters directly.
  • In most cases, isFrozen just returns the value of freezeEmitters, but wand-based Emitters have their own logic in the function instead, which always returns false.

This cleans up the code a bit, solves a pretty serious bug, and gives Emitters more control over whether they should be frozen or not. I also took the opportunity to fix a few lingering errors where some particle effects weren’t being frozen when they should be.

Comments

No comments found for this post.