99 Bricks insight: A slight breeze

We already told you about the happy accidents we sometimes had during the development of 99 Bricks. The idea of adding wind is one of them. In the classic version of 99 Bricks we used Box2D as our physics engine. Because of the imprecision of Box2D, your tower would start wobbling around after a while, messing up all your carefully placed bricks. “Turn that damn wind off!” was one of the most heard comments, even though there wasn’t any wind to begin with.

But with 99 Bricks Wizard Academy things are a bit different. We have a more rigid physics engine, meaning your tower won’t topple over that fast. Building a rigid tower became a pretty easy task. A little bit too easy actually, because placing bricks on top of each other without much thought turned out a very effective but boring strategy. There isn’t much fun in just swiping those bricks down over and over again to reach a highscore, right? Exactly! So that’s why we decided to add wind as a feature.

Our first shot at simulating wind was pretty rough: We took every brick that was capable of moving and applied a force to it. But we figured out soon enough that this wasn’t the way to go. If the wind was strong enough to be noticeable, the tower would fall over no matter how well constructed it was, because every single brick was being influenced by this force. If we brought the strength of the wind down to be acceptable, the game became too easy again. No matter how instable your tower was, the wind wasn’t strong enough to make the bricks fall. Also, by applying a force to all bricks, things felt really unnatural. Sometimes bricks would fall over, even if something seemed to block the wind, like a couple of stacked bricks. So applying a force to all bricks wasn’t an option and we had to think of another solution.

Apply a force to every single brick

The final implementation of the wind turned out to be pretty simple. We tried to think about how wind actually works: a lot of air particles bashing into your tower. And that’s exactly what we did. But instead of using particles to throw at our bricks, we are using raycasts to ‘scan’ the top part of your tower from left to right. Every time we hit a brick, we apply a small force at that specific point, just like the air particles would. This solves the problem of bricks being blown away that are actually being kept out of the wind by some other part of your tower. Also the strength of this force varies a bit over time to make it feel more like small gushes of wind instead of a continuously storm messing up your tower. This way the wind becomes a fun but hard to predict factor in the gameplay and gives it a more realistic feel.

Perform a raycast and add force on impact

To save some performance we only apply the force of the wind to bricks that are still allowed to move, so we skip petrified bricks. We also limit the wind to the top part of the tower that is visible to the player, because it feels unfair if your tower collapses outside of the screen without you knowing what caused it. Therefore it doesn’t make sense to raycast the entire tower.

As a finishing touch we added some animations and dust particles that float around your screen. This also makes sure the player understands the presence of wind and really gives the impression of being high up in the sky where a magical breeze flows through your wizardous hair!

Comments are closed.