Flyweight and Component


At this point, both of the writing for the Component and Flyweight are both published. I have to say that it's been interesting to try and work with these patterns. Especially since they feel like opposites on the spectrum.  I'm now 3 patterns down, 5 to go.

One thing that I know I am working with this project is the spectrum between design and implementation, trying to learn how to bridge the two as a designer who has to implement (code) his own work. 

Initially, Flyweight feels like it is on the implementation side and Component feels heavily on the design side. But as I worked with them, from afar, it feels more like Flyweight is a design pattern and Component is the implementation pattern. Let me explain: when you have several different objects and reveal the underlying, shared structure between themrevealing the intrinsic properties as you would expect of a Flyweight is that not revealing the grand design behind them? And meanwhile, the Component pattern, this strategy of mixing and matching features with other features, is so clearly aligned with game design principles: free flowing creativity, and jumping around. That's Designing with a capital d.

But the difference in why they feel that way vs what I wrote for them is in the literal coding of the patterns. Flyweight is a pattern that is used after the design is already in place, and Component is during the creative process. This difference is so, so vital in how you might use them as a designer. 

At the very least, in the Unity flow, you would be freely coding components during the early prototype phase. I could readily imagine that happening during a game jam. Code a component, decide you don't like it, keep it for later, or throw it away. Repeat. But with Flyweight, you would be coming back to that project, having decided "Ok these sets of objects should be using a flyweight pattern because they all share these elements." Flyweight is where the design solidifies whereas component stays free.

I am not really going to pay too big much attention to this difference. They are both useful to know and to recognize when you might want to use them. Again, experimentation is the key with game design and so, component is the pattern that fits more into that paradigm, although Flyweight is useful in a 2nd stage level of experimentation when you want to make large, sweeping changes all at once.

Leave a comment

Log in with itch.io to leave a comment.