Reader small image

You're reading from  Game Development Patterns with Unreal Engine 5

Product typeBook
Published inJan 2024
Reading LevelBeginner
PublisherPackt
ISBN-139781803243252
Edition1st Edition
Languages
Right arrow
Authors (2):
Stuart Butler
Stuart Butler
author image
Stuart Butler

Stuart Butler is an Unreal Engine Expert with over 13 years of experience in teaching Games Development in Higher Education. Stuart has published projects in a multitude of disciplines including Technical Design, Art, and Animation. Stuart is the Course Director for Games Technology at Staffordshire University, responsible for the programming team within the UK's largest Games Education Department. Stuart is also an Unreal Authorised Instructor and Educational Content Creator who works with Epic Games on developing learning materials for Unreal Engine 5. Stuart holds a BSc (Hons) in Computer Games Design and a PgC in Higher and Professional Education.
Read more about Stuart Butler

Tom Oliver
Tom Oliver
author image
Tom Oliver

Tom Oliver is a game programmer with over 10 years of experience in working with game engines both commercially and in an educational capacity. He has used Unreal Engine for contract work both in and out of the games industry, creating systems for games to mixed reality training simulations. Tom is the Course Leader for the BSc (Hons) Computer Games Design and Programming program at Staffordshire University, responsible for maintaining the award winning structure and teaching of the course in the UK's largest Games Education Department. Tom holds a BSc (Hons) in Computer Games Design and Programming and a PGc in Higher and Professional Education. Tom specialises in researching gameplay systems driven through mathematical phenomena.
Read more about Tom Oliver

View More author details
Right arrow

Flyweight

The flyweight pattern is focused on reducing memory usage for large collections of objects and reducing the time spent loading them in. For the flyweight pattern, we first need to consider three things:

  • Intrinsic data – The data values that are immutable and considered to always be true on an object
  • Extrinsic data – The data values that are mutable and considered to be changeable per instance
  • Memory costs – All data must be stored somewhere and for loaded objects, that means on our RAM

With that in mind, let’s look at trees in the forest. Taking a simple approach, we could load in and store the model, texture, and transform data once for each tree. This would make our data storage look like Figure 3.4, with each tree connected to its own plot of memory, holding its copy of the data needed for rendering:

Figure 3.4 – Diagram showing the data associated with each tree

Figure 3.4 – Diagram showing the data associated with each tree

If we consider the...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Game Development Patterns with Unreal Engine 5
Published in: Jan 2024Publisher: PacktISBN-13: 9781803243252

Authors (2)

author image
Stuart Butler

Stuart Butler is an Unreal Engine Expert with over 13 years of experience in teaching Games Development in Higher Education. Stuart has published projects in a multitude of disciplines including Technical Design, Art, and Animation. Stuart is the Course Director for Games Technology at Staffordshire University, responsible for the programming team within the UK's largest Games Education Department. Stuart is also an Unreal Authorised Instructor and Educational Content Creator who works with Epic Games on developing learning materials for Unreal Engine 5. Stuart holds a BSc (Hons) in Computer Games Design and a PgC in Higher and Professional Education.
Read more about Stuart Butler

author image
Tom Oliver

Tom Oliver is a game programmer with over 10 years of experience in working with game engines both commercially and in an educational capacity. He has used Unreal Engine for contract work both in and out of the games industry, creating systems for games to mixed reality training simulations. Tom is the Course Leader for the BSc (Hons) Computer Games Design and Programming program at Staffordshire University, responsible for maintaining the award winning structure and teaching of the course in the UK's largest Games Education Department. Tom holds a BSc (Hons) in Computer Games Design and Programming and a PGc in Higher and Professional Education. Tom specialises in researching gameplay systems driven through mathematical phenomena.
Read more about Tom Oliver