Dev Diary #3: Dragon Drop

Feb 10, 2021

Stay in Touch

Join our Discord server to chat with us and other players, and sign up for our newsletter to get these posts in your inbox. Joining helps us a lot (even if you don’t plan to chat).

Reduce, Reuse, Recycle!

Hello readers, it’s Caleb our lead programmer this blog post. I’m bringing back a message from my childhood to you.

I spend much of my free time researching and designing “the perfect code,” all with the goal of repurposing what I’ve already learned or created and applying that knowledge to gain something new out of something old. How exciting!

Before we begin, though, beware this entire post is not for the faint of heart and gets very technical. It should be consumed with extra sugar in your coffee.

The visual scripting representation of a Dragon Drop.

Let’s Begin with Bolt for Unity

What you’re seeing is one of the latest iterations of 0’s and 1’s. That’s right, this is actually “code” lighting up as data flows through our favorite little calculators! Fashioned with a lightning bolt logo, Unity’s Bolt literally brings code to life. Visual scripting allows an even larger audience of people to learn to program effectively because of its explicit nature.

In its current state, Bolt does come at a minor cost to productivity for us compared to written programming languages. It takes a bit longer to create and connect all of the nodes together, executing nodes elsewhere feels like a roundabout process, and variables are spread out and generally difficult to work with…

Enter Dragon Drop

Please note, you’re seeing a work in progress. Future releases may function differently than depicted here. Please refer to the relevant documentation. ^_^

Aptly named for their drag-and-drop convenience, Dragon Drops are here to save the (visual scripting) day! They enable any Unity developer working in Bolt to send values around their project in a portable and powerful way.

Here’s an example: In the simple Bolt script above a Dragon Drop sends the Global Event “PauseMenu” when the pause button is pressed. A Dragon Drop like this can be attached directly to a button in your game or application.

Any other Dragon Drops with a Global Event of the same name (PauseMenu) act as events and receive the value sent in the previous script. This allows the developer to react to events in a very direct and tangible one-to-one, or one-to-many way. In the script above, we pause the game when the event is received.

Let’s Drop Another Dragon

In this slightly more complex example, we have a variable which we’ve named “IncrementCelebrationBarDelta” which broadcasts its value to the Dragon Drop event listeners.

Our “ScoreManager” is lying in wait. As soon as a dragon greedily snatches up a firework the “IncrementScore” and connected nodes will light up like a pinball machine, adding precious points to the player’s total score… isn’t that like totally wow!

More Than an Event System

Dragon Drop is more than just an event system, though! Specifying the type of Dragon Drop promises to reduce the amount of code that team Tripping Whale will have to create over time. Don’t miss out on my next blog post, where I’ll cover how we’ve transformed working with variables through Dragon Drop.

That’s all for today. Test 2 is on the horizon. Thanks for reading, and stay tuned for the future. Lots more to come!

Have a question about Dragon Drop? Ask a Dev!

Join our Discord server to chat directly with the devs. We love hearing from you!