Home Artists Posts Import Register

Content

Laybrinth is probably my last world that I’ll make using the “old” sdk/SDK2. In SDK2, the Animator component is one of the best tools that you can use to evaluate basic game logic. It even synchronizes states and variable data if you need it to. The dice in Labyrinth have one of the most complex animators I’ve used in a world, and since the world just released I figured why not show it off here?

One weird/smart thing I did with the dice was to not actually synchronize the entire animator. Instead, the dice pickup object is synchronized  with an object_sync component (obviously), but the Animator is on a “Dice anim” child of the pickup. Since the object_sync isn’t actually on the Animator, it doesn’t sync. For these dice, all we need to sync is “What was the last roll?” and “Is the dice cursed or not?” In the trigger for the dice, five events (“Use”, roll X, curse, uncurse, kill dice) is all you need to synchronize between players, nothing more. The timing, special effects, neutral state, etc are handled locally.

Every animation is organized nicely in the Animations asset folder for Dice. The naming convention I like to use for animations is “@” + the name of the Animator or Animation folder + the animation state. Each animation for the different rolls is basically just two keyframes, one to turn the correct objects on/off and the glowing effect that fades out over time. The important thing about states is either the objects it turns on or the animation events it might activate.

Each roll has its own collision layer and enables/disables a small collider inside the dice with that layer. For example, when your dice is rolled “key,” there is a small sphere labeled “key” inside the dice that only collides with the keyholes. I didn’t have enough layers to give “wild” (named “Sun” in my files) its own layer that collides with all the different types of keyholes, but that’s okay. The wild animation just turn on an object with many different colliders for all the different layers it can collide with--- since a collider can only be on one layer.

Other animations have an “event” that causes extra stuff to happen-- like activating other Animator triggers. Stuff like the ghost spawning and despawning, any of the randomized sound effects, and even the roll cycle finishing are done with animation events that happen at very specific times during special animation states.

There used to be a roll called “Shield” that immediately formed a protective bubble around the dice, pushing away ghosts. It was also intended to block certain traps like the fireball shooter. I ended up getting rid of this roll after reworking it a few times and still not being satisfied with it. At first, the shield bubble has infinite duration, which made players just roll shield once and never get rid of it… it was really powerful, as you could just all stay together in the bubble and never get attacked by a ghost. After that I tried making it have limited duration, but since the ghosts took a while to reach you, it was pretty much not useful at all if you couldn’t control when the shield was activated. I could have turned it into a click-to-use roll like the healing cross ability, but still didn’t see how it would be useful, so I scrapped the idea.

The “cursed” status effect is actually really simple. Because you can be “cursed” and also continue to roll the dice, the curse special effects (and logic that summons/summons the ghost) are on a separate layer on the Animator controller. The two transition arrows on the “Curse” layer interact with animation events in the “Base Layer.” You can actually do some really neat stuff with layered animation if you want to get crazy with it, but it wasn’t needed here.

The “Roll” animation cycles through a bunch of different colors, and about 75% of the way through it activates an animation event called “OnRoll” that tells the dice to activate a random trigger. The extra color cycling animation at the end is so that players who are lagging behind the host still see the color cycling while waiting for the roll to show up.

Finally, I think it’s really cool that I can just adjust the probability of each roll using the sliders in the “RandomRoll” trigger. Right now there is a 0% chance to just instantly roll skull, killing your dice, but I can make that an actual probability later for game balance reasons. The most rare rolls are the healing cross and wild abilities!

Remember that I take requests for these behind-the-scenes posts in the #backstage-pass channel on discord!

Files

Comments

No comments found for this post.