Nystrom: Game Programming Patterns

Reading notes from Robert Nystrom’s Game Programming Patterns.

Chap.1 Architecture, Performance, and Games

We have a few forces in play:

  1. We want nice architecture so the code is easier to understand and over the lifetime of the project.
  2. We want fast runtime Performance
  3. We want to get today’s features done quickly.

Summary:

  1. Abstraction and decoupling make evolving your program faster and easier, but don’t waster time doing them unless you’re confident the code in question needs that flexibility.
  2. Think about and design for performance throughout your development cycle, but put off the low-level, nitty-gritty optimizations that lock assumptions into your code until as late as possible.
  3. Move quickly to explore your game’s design space, but don’t go so fast that you leave a mess behind you. You’ll have to live with it, after all.
  4. If you are going to ditch code, don’t waster time making it pretty. Rock stars trash hotel rooms because they know they’re going to check out the next day.
  5. But, most of all, if you want to make something fun, have fun making it.

Chap.2 Design Patterns Revisited

Chap. Data Locality

注意

But because of caching, the way you organize data directly impacts performance.

Modern CPUs have caches to speed up memory access. These can access memory adjacent to recently accessed memory much quicker. Take advantage of that to improve performance by increasing data locality: keeping data in contiguous memory in the order that you process it.

william 支付宝支付宝
william 微信微信
0%