Sponsored By

Ability for Other Abilities

Going into a project that requires dozens of abilities leads to interesting team dynamics, since the way that each ability interacts with the rest of the game is going to depend on how the team implements it.

Billy Moore, Blogger

December 1, 2023

4 Min Read

Going into a project that requires dozens of abilities leads to interesting team dynamics, since the way that each ability interacts with the rest of the game is going to depend on how the team implements it. It raises questions about who should take on the tasks for each ability. For example, if an ability needs to deal damage to an enemy, the team members that developed the enemy system are going to have the best understanding of how to implement said ability. However, if the team delegates all ability implementations to one subset of team members, those members are going to have the best understanding of all the abilities, and each ability will have a similar style of implementation, which can make it easier to adjust functionality later on in the project.

IMAGE_1.png

Our team, Crystalline Games, decided to go with the latter approach for our first game, Conquering Ciros. Conquering Ciros is a rogue-like survival game, Vampire Survivors-esque, and so it needs a good amount of unique abilities. I was one of the two programmers delegated to ability programming, and I wanted to describe my process of programming one ability that required a lot more work than any of the others. This experience was interesting for two reasons; it required significantly more interaction with other aspects of the game, and it displayed some pros and cons of how we organized our programming team.

This ability is called Buff Zone, and as the name suggests, it buffs things within a zone. Specifically, it buffs any crystals that are within a certain radius of an object that it spawns. Crystals are items you collect throughout gameplay, and they each have an ability. So right off the bat, Buff Zone is already more than just spawning an object that collides with enemies, which is usually all you need for most abilities.

First, I needed to check if a crystal was within one of the Zones spawned by Buff Zone. As a side note, Buff Zone spawns a circle in a random position, with a random type, every few seconds, so I needed a way to distinguish what type of circle the crystal was in. I also needed to deal with scenarios where a crystal might be in two different circles at the same time. At face value, this seems straightforward, but because I had no involvement with developing the crystal system, I didn’t realize that crystals lacked any type of collider. They are just generated with a sprite, a script with some general functionality, and a script with specific behavior for the ability.

IMAGE_2.png

The workaround for this isn’t difficult, but it is probably less efficient than Unity’s built-in methods of handling collision, and it really makes the code messier and harder to read:

IMAGE_3.png

It looks a lot worse than a simple OnTriggerEnter2D, and this has to take place in Update, which I like to keep clean as much as possible. If I had worked on programming crystals originally, I might have looked at this ability ahead of time and added colliders to the crystals. I think this also stresses the importance of team communication, especially if tasks are so strictly divided between team members.

 Secondly, I wanted to cover a neat optimization I found while programming Buff Zone. I probably would not have found this if everything was just handled by colliders, so at least there’s a silver lining. It helps cut down on the constant updates to check if a crystal needs to be buffed or not. Each crystal needs to be un-buffed if the spawned zone despawns or if the crystal exits the zone’s radius.

GIF_1.gif

GIF_2.gif

 Instead of checking every frame for if a given zone had become null, I took advantage of the despawning coroutine in my ability script, and just wrote a few if statements to catch any crystals that were in the radius before the zone despawned. If any of those crystals were buffed, I just applied the debuff to them. It involved spreading out the buff/debuff code between two scripts, but now the game only has to run these if statements every few seconds, as opposed to every frame.

This project was my first team-based game dev experience outside of a game jam scenario, but I hope this situation gave some insight into managing team communication, planning, and working around problems that may arise from it.

Read more about:

Blogs

About the Author(s)

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like