Week 4 Development

Tweaking Rat Movement

To improve player movement slightly I added a bit of acceleration and deceleration to the player, so they don’t start and stop moving on a dime. This made movement way less twitchy.

I also made sure the rat can only start sprinting while on the ground:

Adding Cel Shading

As the playtest deadline was steadily approaching we decided to keep the greybox made in ProBuilder as our level. However, we were still using the default dev textures the package provides, with only simple colour changes. This does not fit the cartoony, nostalgic aesthetic of the game as described by Esi in her GDD so we needed to go for more stylised look. I opted for cel shading as I saw a useful shader made by Robin Seibold, the developer who made the outline shader I used in my Unity prototype for Kinetic Panic:

This shader worked with Unity’s built in lights on the Universal Render Pipeline, and was available for free on Github, so we added it to the project. It also had support for changing the base colour with textures, which would be very helpful in the future when making custom assets for the game.

Doing this meant creating custom materials for each kind of colour we would need for objects in the game, such as wooden floors/furniture etc.

Screenshot captured by Hugo

Once we added these, the game had a very bold, colourful look! However, without any textures and soft shading of the previous materials depth perception became a big problem. A brown table on a floor of the same colour would blend in entirely! To fix this I added some Screen-Space Ambient Occlusion. I do not like using this effect to this intensity but this was necessary for the time being to improve visual clarity.

Adding Animations

In the meantime, Hugo had created all the necessary movement animations for our Rat character. All we had to do now was to use the Animator component to have them play when moving.

This looks like an evil ritual, but it’s very important for the game, trust me

Animation in unity is done by essentially creating a state machine with connections between all the different animations allowing them to blend between each other. Each connection will have different conditions, for example: If the bool isSprinting is true, we can let the player character’s animator transition the current walking animation to the sprinting animation.

All we had to do after setting this up was to define these conditions in code by setting the parameters such as the isSprinting bool along with many others. We also defined a speed parameter that can control the speed at which the walking and sprinting animations play depending on how fast the character is moving through the world.

Hugo recorded the following video showing off the different animations:

Rat Sprite Edits

Hugo initially submitted his first pass for the rat model’s texture, however, we agreed that it looked a bit too cartoony and human-like for the game, as a result I quickly made a mockup of what it could look like. We soon agreed it would just be easier to use that in the model, and after photoshopping it onto the base texture Hugo made he got it working on our rat model.

Hugo also added a blinking sprite variant but we would need to code a way to switch the sprite in-game for that.

Fixing Collisions

We also had an issue where the rat’s collision to the ground wasn’t working when they were hanging off ledges, making jumping off them feel very awkward and sometimes weirdly sliding. To fix this I replaced the original sphere I used to check collisions with two, one on the front and one at the back.

After a lot of tweaking this fixed the issue entirely!

Adding Movement Curves

At the recommendation of Ross I used Unity’s Animation Curves to perfectly dial in how the rat’s speed ramps up instead of using a flat acceleration time for both.

The curve for the rat’s acceleration.

Adding a Screw Model

I also made this low-poly pixel art screw model for the quest, in a pastel style that fits the look of the game.

Leave a Reply

Your email address will not be published. Required fields are marked *