A few days ago I made a jungle background pixel art for Balloon Popping Pigs. It was a time consuming process and could stand more work and detail added to it. The problem with adding such a new and elaborate background is the previous background system is cumbersome.

a3f6ztu-imgur

The background system has been done at least twice. The first time it was rushed and the second time it felt just as rushed. It works, it loops, but in terms of how it functions is a bunch of different moving objects which makes it difficult to change in any way. One of the major issues with having different objects for different parts of the backgrounds is the depth can become problematic and turns into a juggling act. To make things more complex,  as time went on, frills were added into the background, such as changing the color and manipulating it with pigs such as Unipig and Hippiggy.

With what I consider a failure of a background system in mind, I had a background jam today where I just focused on the background and hammered out some elegant code that is all contained in one object. It is getting to the point where drawing the background in layers in that one object is so much easier to keep track of.

The new background is multi layered via variables. The jungle background is ten layers in all and the standard background is only six. Each layer moves at its own pace with the furthest layers back from the camera moving the slowest. That’s how it would be in real life.

Many of the pigs have their own background colors. Pretty Pig has a pink background. Night Pig has a red background and so in. These background colors were kept intact. While implementing this old system, I made a new night system that would keep track of which pigs have permanent stars in their sky. With this new system came the night and day system.

I have always avoided a night and day system for the game. Its a bright and colorful game, why add night? Well adding a night and day system gives the game a feeling of progression. Its a simple game with one background and now a second. I should have that feeling of progression beyond color changes and palette swaps. The nifty part about the night and daytime switch is the stars appearing in the sky.

With the ability to turn day into night and back again, this gave the perfect opportunity to randomize the starting period. While 75% of the time the game will start you in the daytime, its that 25% that offers a random time of day. Then the clock will keep ticking with the day’s cycle lasting two minutes. Well it really lasts four minutes, because when the game hits what I call noon, it will stay at noon for two minutes. Otherwise the game has no consistency and night no longer feels special.

As I was assembling the jungle background in the game, I took a look at all the new colors turned the game into a jumbled mess of color. To aleviate this I added outlines to every major object. The artist and I had added outlines before, but at the time it looked ugly having lines so we did away with them. With all the colors going on, the outlines make the game look spectacular. I think so, but others seem to think its a bad thing. With that in mind, I added a cheat code that can enable and disable the outlines.

That’s it for the background jam. At the end of the day I have a great new flexible system. While I could boot the game out the door into a public update, I will wait for more backgrounds.