Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a game developer, I want to map key presses to custom game actions or states so that I can drive game logic using high-level events #13

Open
modeswitch opened this issue Jun 6, 2012 · 0 comments
Labels

Comments

@modeswitch
Copy link

Conversation:

  • An action is a notification that a high-level game event has been triggered
  • Actions do not contain any state beyond the fact that they have happened
  • A state is a notification plus a boolean state that a high-level game event has been triggered
  • Both actions and states have associated event types
  • Game actions can be generated in other ways than key presses; they may be generated by anything that can happen in the input phase. For example by AI or another player over the network.
  • A set of individual hardware inputs are described as strings that are browser-independent, rather than key codes that are not
  • Game developer calls resource loader to load event map
  • Game developer constructs new input controller using event map resource
  • Game developer adds input controller to entity, and it then generates game events based on the map
  • An example of a map:
{
  "States": {
    "RunModifier": "SHIFT"
    "WalkForward": "W"
  },
  "Actions": {
    "FirePrimary": "SHIFT"
  }
}
  • This is an extension that offers a dispatcher service, a controller component, and a map resource
  • The service should register handlers for browser keyboard events
  • Key presses are buffered by the service and dispatched during its run cycle each frame
  • The controller is responsible for storing and making queryable values for mapped states
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant