You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current settings are messy. There are plans to have many different input options, like on screen buttons, keyboard, mouse, gamepad, and camera, and there needs to be a way for a game to use any of those inputs.
Goals
Work with many inputs
Keyboard
Mouse
Gamepad
On screen buttons (for touch screen or clicking with mouse)
Swiping (for touch screen)
Camera (physical actions without touching any controller)
Easily able to add new inputs later
Save multiple presets to switch between
Easily switch between different inputs (like switching to touch screen after disconnecting gamepad from phone)
Save settings
Work for multiplayer games
Plan
UI
Presets
Presets are the containers which all settings are stored in.
Games will come with default presets.
For example, in the lane runner game, there will be these default presets: Camera - jump irl to jump, duck irl to duck, irl x position is current lane. Keyboard - wasd / arrows to move left, right, jump, and duck Mouse - Mouse x will switch lanes. Left click to jump, Right click to duck. Gamepad - Plus pad could be used similar to keyboard arrow keys. A could be another way to jump, and B could be for ducking. Swipe - Swipe left / right to switch lanes, swipe up to jump, swipe down to duck.
Presets can be edited.
New presets can be created.
Activation
Presets can be activated manually or automatically. Automatic activation:
Mouse
Keyboard
Gamepad
Touch screen
For example, pressing any button on a gamepad will switch to the preset which gets activated by gamepad.
A validation error will be shown if two presets have the same activation.
Settings
Each game has a specific amount of settings. The user cannot add or remove settings, they can only customize the settings.
Input
To keep inputs flexible, a setting cannot say, "keyboard or on-screen-button, those are your only options". Instead, settings will say something like "I want to know if the input is on or off". Different inputs can be used for different input types.
Other settings
Other settings are not device specific. For example, adjusting music and sound effect volume, graphics settings.
Input types
Action
An action input is like listening for an onClick event.
Mouse: Left click, right click
Keyboard: On pressing a key, or releasing a key
Gamepad: On presssing a button, or releasing a button
Touch: On touching / releasing, swiping
Camera: Doing an action, like jumping
Boolean
A boolean input is either on or off. It's like listening for onMouseDown and onMouseUp events. Not every input can be a boolean input. For example, jumping in real life is not a boolean input. Once you jump you will automatically land because of gravity.
Mouse: Holding down click
Keyboard: Holding down key
Gamepad: Holding down button
Touch: Touching screen
Lanes
There will be a special input just for the lane-runner game (more game could use it but for now it's just the lane-runner game).
Actions: this input can be made up of action inputs. One action for moving left and one for right.
Camera: Based on where the person is in the camera, that's their lane
Turret / circle
Basically getting the angle, and optionally the radius as a fraction (0 is in center of circle, 1 is max radius).
Mouse: Scroll based moving or on screen joystick
Touch: On screen joystick
Gamepad: Joystick
Array
Used for multiplayer. The array can have a minimum and maximum number of items. The array can have multiple sub-settings with their own type. There will be a special input for array input type.
Customizing inputs
Inputs can be customized / calibrated. Examples:
Customizing if something will happen on press or on release
Customizing which key / button
Customizing which direction to swipe
Calibrating camera to set limits of how far u can move
Input validation
Inputs can give warnings like "Key A is already being used". Settings can still be saved and the game can be played with warnings.
Require at least one input
To fix #20, settings can specify that the input type needs at least one input. Settings will not be saved with errors like this. The game cannot be played with errors.
Summary
You can add, edit, remove presets
Each preset is a customization of settings. Settings can be input settings.
You can set 0+ inputs for input settings.
You can customize inputs. Some inputs can be made up of other inputs.
Internal code / API
Game
Inputs this:
Setting functions
Default presets
Settings
Settings is an array of settings. Not a map.
Setting Functions
get name (just for display, not used as id)
render: renders the setting editor
Saving to indexed db
Save
Load
listen for changes to data
is valid (return false if there are errors that cannot be ignored)
get screen rects: returns an array of screen rect get-set functions
Input type
An enum of input types. Input types written in UI section.
Any Input
Any input is a helper function which returns a setting which can use any input, based on the input type.
Inputs: Name, input type
Output: Setting functions
Inputs
An array of all inputs in Banana Games. To add an input in the future (for example, an input which let's you use another device with a browser as an input), just include it in this array.
Input
input type
render: render react node to edit input
Saving to indexed db
Save
Load
listen for changes to data
is valid
get screen rects
Using inputs in a game
TODO
The text was updated successfully, but these errors were encountered:
Why
Current settings are messy. There are plans to have many different input options, like on screen buttons, keyboard, mouse, gamepad, and camera, and there needs to be a way for a game to use any of those inputs.
Goals
Plan
UI
Presets
Presets are the containers which all settings are stored in.
Games will come with default presets.
For example, in the lane runner game, there will be these default presets:
Camera - jump irl to jump, duck irl to duck, irl x position is current lane.
Keyboard - wasd / arrows to move left, right, jump, and duck
Mouse - Mouse x will switch lanes. Left click to jump, Right click to duck.
Gamepad - Plus pad could be used similar to keyboard arrow keys.
A
could be another way to jump, andB
could be for ducking.Swipe - Swipe left / right to switch lanes, swipe up to jump, swipe down to duck.
Presets can be edited.
New presets can be created.
Activation
Presets can be activated manually or automatically. Automatic activation:
For example, pressing any button on a gamepad will switch to the preset which gets activated by gamepad.
A validation error will be shown if two presets have the same activation.
Settings
Each game has a specific amount of settings. The user cannot add or remove settings, they can only customize the settings.
Input
To keep inputs flexible, a setting cannot say, "keyboard or on-screen-button, those are your only options". Instead, settings will say something like "I want to know if the input is on or off". Different inputs can be used for different input types.
Other settings
Other settings are not device specific. For example, adjusting music and sound effect volume, graphics settings.
Input types
Action
An action input is like listening for an
onClick
event.Boolean
A boolean input is either on or off. It's like listening for
onMouseDown
andonMouseUp
events. Not every input can be a boolean input. For example, jumping in real life is not a boolean input. Once you jump you will automatically land because of gravity.Lanes
There will be a special input just for the lane-runner game (more game could use it but for now it's just the lane-runner game).
Turret / circle
Basically getting the angle, and optionally the radius as a fraction (0 is in center of circle, 1 is max radius).
Array
Used for multiplayer. The array can have a minimum and maximum number of items. The array can have multiple sub-settings with their own type. There will be a special input for array input type.
Customizing inputs
Inputs can be customized / calibrated. Examples:
Input validation
Inputs can give warnings like "Key A is already being used". Settings can still be saved and the game can be played with warnings.
Require at least one input
To fix #20, settings can specify that the input type needs at least one input. Settings will not be saved with errors like this. The game cannot be played with errors.
Summary
You can add, edit, remove presets
Each preset is a customization of settings. Settings can be input settings.
You can set 0+ inputs for input settings.
You can customize inputs. Some inputs can be made up of other inputs.
Internal code / API
Game
Inputs this:
Settings
Settings is an array of settings. Not a map.
Setting Functions
false
if there are errors that cannot be ignored)Input type
An enum of input types. Input types written in UI section.
Any Input
Any input is a helper function which returns a setting which can use any input, based on the input type.
Inputs: Name, input type
Output: Setting functions
Inputs
An array of all inputs in Banana Games. To add an input in the future (for example, an input which let's you use another device with a browser as an input), just include it in this array.
Input
Using inputs in a game
TODO
The text was updated successfully, but these errors were encountered: