When I read "Game Programming Mode" what I was thinking

EDITORIAL

  • This book is a long way

"Game Programming Design Patterns"

  • I have not seen "GOF", I read this book are design patterns (the game point of view) the definition given in the definition of GOF afraid of too abstract.
  • Not a project code dangling experience, or did not work at least six months, do not worry buy this book because estimates can not read.
  • This article focuses to record "I think what design pattern is XX" and "When I look at XX design patterns, what I want."
  • This way of writing the book, I like to belong to the "tone of the conversation."

Command Mode

  • Definition written: "a request to an object to be packaged, allowing you to use different requests, queue or log of client parameters, undo and redo support the requested operation."
  • His example: key events
  • My definition: command packaged into objects, undo and redo support
  • :( I'm already good examples in the book)
  • Expecting:
    • For example with the press XX key to execute YY event, I think it speaks a custom button (that is, jumping is based on A, and now I want to jump is based on B) ......
    • Talked about very specific command, it links to the "Flyweight" the next chapter, marginalia not to use the "singleton", really think, because Singleton would not have inherited

Flyweight

  • Written Definition: the use of share to efficiently support large numbers of fine-grained objects
  • His example: Forest
  • My definition: to separate in common, in particular plus point
  • :( I'm already good examples in the book)
  • Expecting:
    •  My first thought is that class inheritance, but the text of, for example, are not related to inheritance

Observer Pattern

  • Written definition: "Since the definition of a relationship of one to many between objects, so that when the state of an object changes, with all its dependencies of objects can be notified and updated automatically."
  • His example: achievement system
  • My definition: When the state of the object changes, it notifies all followers
  • My example: C # the event
  • Expecting: None

Prototype mode

  • Written definition: "Use specific examples to create a prototype of a particular kind of object, and to create a new object by copying a prototype"
  • His examples: specific monster generator
  • My definition: (I did not understand it and in front of the Flyweight What is the difference ......)
  • For example :( I did not think ......)
  • Think of the problem :( I did not expect ......)

Singleton

  • Written definition: "to ensure that only one instance of a class, and provide a global access entrance"
  • His example: file system
  • My definition: no (written definition has been very clear)
  • My example: Common GameManager, AudioManager ......
  • Expecting: Singleton initialization, using lazy initialization, but the project I have ever seen, will be placed before the start of the game you initialize

State mode

  • Written Definition:. "Allows an object to change its behavior when its internal state changes modify the object appears to be in its own class."
  • His example: Players run, jump station hide behavior
  • My definition: state switch manager
  • My example: Unity in the State Machine
  • Think of the problem: the state of the book, for example from the enumeration escalated into classes, from a development point of view the future should indeed do so; the book talked about the expansion of the state machine (hierarchical state machine, concurrent state machines) are useful

Double buffer mode

  • Written definitions: None
  • His example: computer graphics displays double buffered
  • My definition: None
  • For example :( My book is already very clear)
  • Expecting: None (when using code demonstrates, understanding Update is a problem, I ran only once, in fact, should be kept running Update of ......)

Game loop mode

  • Written definition: "to achieve user input and processor speed decoupling in the game of travel time."
  • His example: its name
  • My definition: None
  • My example: Unity game engine
  • Expecting: None

Update Method Pattern

  • Written definition: "By all object instances be updated at the same time frame to simulate a series of independent game object"
  • His example: Skull and fire-breathing statues to prepare the Valkyries
  • My definition: Update Update subdivided into a number of objects
  • My example: Unity in Monobehaviour
  • Expecting:
    • When the check information (the book is recommended Update Unity official document), re-looked at Time.deltaTime definition: the current frame and on a time interval / the one used.
    • Read "game loop mode" to reflect explained "by frame", and for Time.deltaTime and Time.timeScale have a more profound impression.

Byte code pattern

  • Written definition: "By the behavior encoded into virtual machine instructions and data it has flexibility."
  • His example: generate spell
  • My definition: None
  • My example: None
  • Expecting:
    • Article mentioned example behind the Lua (register-based Virtual Machine);
    •  This chapter is more like talking about the programming language lesson

Subclass sandbox mode

  • Definition written: "operations using a set of base class to define the behavior of the subclass"
  • His example: the ability superhero subdivision
  • My definition: base class written all subclass method will be used
  • My example: None
  • Think of the question: did not see it and in front of "Flyweight", "prototype model" what's different

Type object mode

  • Written definition: "to create a new type of flexible support by creating a class, each of which represents a different instance of the object type"
  • His example: the kind of trolls, no longer derived "monster" class, but the derived "species" category
  • My definition: None
  • For example :( I have not seen in practice)
  • Think of the problem: this pattern seems to be written so that specific categories of work planned rather than back program

Component Mode

  • Definition written: "allows a single entity across a plurality of different domains without causing coupled"
  • His example: Content baker class separation process
  • My definition: it is responsible for a function of a sub-category
  • My example: GameMangager there NetManager, AudioManager ...... Composition
  • Expecting: None

Event queue mode

  • Written definition: "Send the message or accept the decoupling event on time."
  • His example: Audio Play sound
  • My definition: the observer mode, adding asynchronous
  • My example: None
  • Expecting: No (I really have not seen a burst in the project Audio is handled asynchronously)

Service Locator pattern

  • Definition written: "to provide a global service for a user to avoid the entrance to the service class specific implementation of a coupling between the"
  • His example: Find a need Audio
  • My definition: Singleton pattern of evolution
  • My example: None
  • Think of the problem :( referred to the decorator pattern (mentioned only here))

Mode data locality

  • Written definition: "By rational organization of data to speed up access memory caching mechanism utilizing the CPU"
  • His example: game update, the update is not physical array, but an array of updated components
  • My definition: None
  • My example: None
  • Expecting:
    • From the perspective of the cache, to introduce this model;
    • I first thought it is about "data structures (algorithms)" This.
    • Also think of the organization "object pool" with Stack instead of List.

Dirty flag pattern

  • Written definition: "speaking the work be postponed in order to avoid unnecessary work when necessary to"
  • His example: Mobile and its parent object rendering
  • My definition: None
  • My example: GC
  • Expecting:
    • Written by someone else from the rendering section defines the Unity UI components, has seen dirty

Pooled modes

  • Definition written: "fixed object pool object reuse, substituted and releasing objects separately assigned in order to improve performance and achieve the purpose of optimizing memory usage"
  • His example: when releasing particles magic
  • My definition: None
  • My example: None
  • Expecting:
    • This is a unique design model teacher to teach, then I do not know that it is a design pattern
    • The book, in order to reduce the complexity of the time as possible, the algorithm (based on the list) design, fresh.

Space partitioning scheme

  • Definition written: "will be the object thereof to efficiently locate a data structure stored in the position of the tissue"
  • His example: Warriors attack the nearest enemy
  • My definition: None
  • My example: None
  • Expecting:
    • As if to look at the data structures (algorithms)

 

Guess you like

Origin www.cnblogs.com/caiger-blog/p/11429136.html