v21’s avatarv21’s Twitter Archive—№ 43,505

  1. @mcclure111 how i do it is: GameManager has a static "instance" field, and references to a bunch of sub-managers
    1. …in reply to @v21
      @mcclure111 so if I want to report an event from a gameplay-contingent object, it reports it to one of those managers via that route
      1. …in reply to @v21
        @mcclure111 and those have a bunch of events set up, on them, so things can also subscribe to events sent from them
        1. …in reply to @v21
          @mcclure111 there's no entirely generic method for this, but it's pretty clean and straightforward.
          1. …in reply to @v21
            @mcclure111 mind you! this works best for games where most of the logic happens in one place, with entities mainly reflecting that logic
            1. …in reply to @v21
              @mcclure111 model-view separation, basically, where the models are usually singletons.