This week one of our programmers discusses how we created a small unity extension to manage our seasonal content:
"All this season stuff started being necessary around early December. We were releasing the first big update just few days before Christmas eve, so at the office we all agreed the game needed special Christmas content for that update.
"On one hand, our artist had to prepare a holiday version of some of the assets: trees, weapons, enemies… they all got a ‘Santa is coming to punk’ vibe.
But, on the other hand, the programming part had kind of a tricky point. It might seem straight forward at first sight: “Okay, just take all those entities in the game and replace their sprites only for the Christmas holidays”.
But, as a programmer, I saw a huge flaw in just doing that. It went against one of software engineers’ most important principles, which is that we don’t like to work twice in the same thing. “Are you telling me that I have to change the sprite now, just to put the old one back when January comes?”. Okay, I can deal with that. The problem will come in a few weeks, though.
Because we will want to add Chinese New Year content (spoiler, there’s a Chinese Dragon in the game); or maybe we’ll be adding Easter or Halloween stuff in a future. Hell, we may want to add a special day in which Aquinas makes a Fortnite dance, who knows.
This will require a lot of periodical changes in several sprites and animations, which will be translated into days and days of work every year.
But hey, we can take it further. In addition, we thought it would be great if seasons could “change” depending on the suit Aquinas had chosen. If you go with SantaPunk, we want you to have big presents as health drops, and jingle bells all over the map. This makes it quite harder, doesn’t it?
Well, actually the answer to this problem is easy. If we are not able to manually change the game every single time an event shows up in the calendar, then the game will have to change by itself, without any intervention of the development team.
And this is how Woodpunk’s Season Management Module came to life.
This module is a part of the code whose task is to check the calendar and see if we are celebrating any kind of event and tell everyone in the game if so. It’s composed by several elements, which are the following:
First, a list of Seasons defined by us, the Meteorbyte Studio team; their job, basically, is to store when an event starts and its length in days. Then we have the Season Manager, whose responsibility is to check all of those seasons and, if any of them is active, lets the whole game know. Finally, there are a bunch of Sprite and Animation Swappers that are placed in any object of the game that will change its appearance during a season; they receive a code for a given season and all the data that they have to replace, wrapped in a package from where they can pick the necessary stuff.
Also, we have developed a little extension for the Unity Editor so all the data in these components can be easily managed by the team. For example, this is how an Animator Swapper looks like in engine:"
So, the problem was solved!
Now our work as developers is just defining the events we want Woodpunk to look for, and introduce the assets for every specific season so the game can do its magic.
For example lets take the Spearman: As we have seen in the in-engine editor screenshot, he knows that for Christmas and Chinese New Year he must swap animations. Therefore, if we play Woodpunk on New Year’s Eve (both Christian and Lunar), the Season Manager will take a look at the calendar and say: “Hey don’t you, Spearmen, have to change your sprite this time of year?”.
“Yep, thanks for the reminder!”. The Spearman changes its appearance and the whole world of Woodpunk updates its look!"
Well guys this is it for this week! As always, fi you have any questions please!
See you wood cowboy!