Game Design Pattern: Flyweight- Game Dev Series 140

Objective: short introduce the Flyweight game design pattern.


In this tutorial, I would introduce another game design pattern, which is the easiest one.
When we create an object, let’s say, a sword.

A sword should be with the following basic data:

When creating a sword with this script attached, it means these data would processed once. However, if you create a thousand swords, even more, ten thousand swords, these data of a sword would processed ten thousand times.

My Mac is screaming for processing these swords!

You might notice that there are some data that would be the same on each sword: main part, sub part, and type.
These are the data that we could make these sword sharing, not just processing every time a sword generate.
This is also the concept of Flyweight game design pattern.

To implement this design pattern, we just make those data that shared the same information as “static”.

That way when a sword is generated, these static data would be stored in the system and can easily to be implemented with other swords.
There should be less resource wasted in game processing.




A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Prepare for the AWS Certification Solutions Architect Associate (SAA-C02) Exam

why HTML is a must for every website

Music Copyright Token Airdrop Event

Appium — Mobile App Automation

CS371p Spring 2022 Week #9: Sumedh Kandadai

How to Effectively Secure in an Agile World

Which are the top DevOps tools in 2021? Best DevOps tools in 2021

Best Devops tool in 2021,Which are the best devops tools in 2021

What is GitHub for a beginner and how to get started with it?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

2.5D Platformer: Level Design Update

What is a Control Track in Timeline

Ease Of Building UI Elements In Unity

Adding a Main Menu to our UI