Motivation

For my specialization I decided to take a retro game and juice it up. In the previous projects I've partaken in I've mostly been working on backend systems and never really got the opportunity to get a feel for what it takes to make a game feel good and fun to play. I'm comfortable with my role as a backend developer and the purpose of this specialization is not necessarily to get a foot into gameplay but rather to get a better understanding of what kind of workflow a well developed engine allows for. It has been a fun experience though and I am looking forward to taking on smaller projects such as this one in the future to help me become a better developer!

I initially intended to make this in TGAs 2D engine to further develop and expand on the systems I have previously made to enable me to get to the kind of polished result I was looking for. In the end i decided to use an industry engine such as Unity to be able to focus more on the game itself instead of engine development.

Carousel imageCarousel image

Camera shake

Thanks to Unity I had a working prototype after 2 days of development and it was time to start adding some effects. I do enjoy a good camera shake, so that's where I started.

I set up a couple of requirements for the system before I started:

  • Shakes can be shared between objects. The data had to be separated from the functionality.

  • Additive effects, i.e. several different shakes could affect the camera simultaneously.

  • Easy to call, preferably one line of code.

Using animation curves and random number ranges I got a data structure that gave me a lot of customizability. I migrated the struct to a ScriptableObject, which meant each variation I created existed as it's own object and could be referenced by other scripts.

The actual shaking is applied through a component attached to the camera. The additive effect is achieved by using coroutines to accumulate an offset which is then applied on the fixed update.

Calling the shake: myHitCameraShake.ShakeCamera();

This system was later expanded to allow any object to be shook. This expansion also introduced scale. This effect was applied to the enemies as well as the score counter: myHitShake.Shake(gameObject);

Conclusion

Going back to Unity after a year of using our own engines was a pleasant experience. I haven't really been looking up other solutions when I build my own systems and I realize now how important that is, especially when I'm not the the sole user.

I have been working a fair bit with the shaderpipeline in the engine my group created at TGA and I wished I had done some more research before I got started with that. If you're interested in how it works you can read more here. Shaders being attached to materials makes so much sense and sounds like a lot of fun to implement.

Unfortunately, there's not much cool tech to show off since it's all mostly simple systems combined with a couple of shaders but I'd still say I achieved what I set out to do. I got to experience Unity from the viewpoint of a backend developer, learned a couple of lessons on researching and got a end result that I think is pretty fun to play.

The end result