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