In the previous post I spoke about some of the challenges that we were experiencing with creating the animations for our player. Thankfully we had found an application, Spriter, which helped us overcome that enormous hurdle and now our character animations are coming along smoothly. Using the skeletal animation technique we have been able to turn sketches of arms, legs and a head, into a moving character, and we have been able to do the exact same thing with the other characters in our game.

After that fire had been successfully extinguished we found another major issue to work on. We needed to design our first level so that it is visually appealing. In this level, the player is supposed to be running through a forest with enormous trees. Nobody on the team is an experienced designer and we thought that this would be harder than it actually was.

The first step was to just get trees to display on the screen, and to get them to be able to parallax. Parallaxing, to simplify, is a visual effect that shows three-dimensional depth in a two-dimensional animation, the closer an object is to your eyes (or camera), the faster it will move. By default Unity3d will render game objects in a 3D space (the engine calls it perspective view), so we just needed to place some objects further back than other objects to achieve this effect. Our lead developer wrote a script that just places trees at random X, Y and Z positions on the screen and the first video shows the result of running that script.

As you can see from the first video (above), getting trees on the screen and having them parallaxing is only part of the solution. While the trees are showing up on the screen, it doesn’t look very good. When the player moves up and down between the two different levels of the stage you can see the trees move with the camera, which is a side effect of how we are positioning all of the trees at different vertical heights.

After this small achievement we had an internal discussion about the best way to be able to make the level look like it is taking place in a dense forest. I began looking at some of the solutions that other games had taken for inspiration. Shovel Knight, in one of its forest stages simply had a “tree line” in the far background, with sparse tree sprites showing up behind the player. I thought that this could be a potential solution so I went and prototyped this idea to show to the rest of the team, and in retrospect I am glad that we did not go with this option because you can look at the second video to see what it looked like.

The real solution to the problem was to make a few changes to the already written script. The first thing to do is to make sure that all of the trees were being positioned at the same Y Axis, because all of the trees grow out of the ground. We positioned all of the trees to spawn slightly below the platforms that make up the forest floor. Then we increased the scale of the sprites to make sure that these trees looked really tall, and because of the perspective view in Unity3d objects that are further away look smaller.

With the positioning of the objects taken care of we spawned in a significantly larger amount of trees than in the previous videos, this creates the effect of a really dense forest. We also shaded the trees to be darker the further back they are on the Z axis to show that light is being blocked by the objects in the foreground, adding to the density effect. After making these few, very easy to implement changes, we got a result that is a lot closer to what we want. It still requires a little bit of tweaking here and there, but looking back at what we did it actually wasn’t a lot of work, it only required a little bit of thinking about how a forest actually looks.

Things are still moving smoothly, and we have actually progressed further than what I am describing in this blog post, but I would like to write about all of the issues that we experienced in the order that they happened, so stay tuned for some more details about how our video game is coming along.


Leave a Reply

Your email address will not be published.

You may use HTML tags and attributes: