Game Controls - cressie176/Load64 GitHub Wiki
┌───────────────────────────────────────────┐ ┌─────────────────────────────────┐
│ │╲ │ │
│ GameControl │─○─────────────────────────┼│ Game │
│ │╱ │ │
├───────────────────────────────────────────┤ └─────────────────────────────────┘
│ id: integer [pk] │ ┼
│ game_id: integer [fk, required] │ │
│ name: text [unique(game_id), required] │ │
│ description: text │ │
└───────────────────────────────────────────┘ │
┼ ┼ │
○ │ │
│ │ │
│ │ │
│ │ │
│ ○ ○
│ ╱│╲ ╱│╲
│ ┌─────────────────────────────────────────┐ ┌─────────────────────────────┐
│ │ │╲ │ │
│ │ PlayerControl │─○───────┼│ Player │
│ │ │╱ │ │
│ ├─────────────────────────────────────────┤ └─────────────────────────────┘
│ │ id: integer [pk] │
│ │ game_control_id: integer [fk, required] │
│ │ player_id: integer [fk, required] │
│ └─────────────────────────────────────────┘
│ ┼
│ ○
│ │
│ │
│ │
○ ○
╱│╲ ╱│╲
┌───────────────────────────────────────────────┐
│ │
│ GameControlAssignment │
│ │
├───────────────────────────────────────────────┤
│ id: integer [pk] │
┌──────┼│ game_control_id: integer [fk, required(1)] │┼─────┐
│ │ player_control_id: integer [fk, required(1)] │ │
│ └───────────────────────────────────────────────┘ │
│ │
│ │
│ │
│ │
○ ○
╱│╲ ╱│╲
┌─────────────────────────────────────────────────────┐ ┌────────────────────────────────────────────────────────┐
│ │ │ │
│ SystemKeyAssignment │ │ JoystickActionAssignment │
│ │ │ │
├─────────────────────────────────────────────────────┤ ├────────────────────────────────────────────────────────┤
│ id: integer [pk] │ │ id: integer [pk] │
│ game_control_assignment_id: integer [fk, required] │ │ game_control_assignment_id: [fk, required] │
│ system_key: system_keys [required] │ │ joystick_action: joystick_actions [required] │
├─────────────────────────────────────────────────────┤ ├────────────────────────────────────────────────────────┤
│ A system key may only be assigned once per game │ │ A joystick action may only be assigned once per game │
│ for game controls, and once per player for player │ │ for game controls, and once per player for player │
│ controls │ │ controls │
└─────────────────────────────────────────────────────┘ └────────────────────────────────────────────────────────┘
┼ ┼
○ ○
│ │
○ ○
╱│╲ ╱│╲
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ │
│ ControllerControlAssignment │
│ │
├────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ id: integer [pk] │
│ system_key_assignment_id: integer [fk, required(1)] │
│ joystick_action_assignment_id: integer [fk, required(1)] │
│ canonical_control_name: canonical_control_names [unique(GameControl), unique(PlayerControl), required] │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
A game exposes named controls — some game-wide (e.g. Start 1 Player Game), some per-player (e.g.Pick-up / Drop for player 1). These are represented by GameControl and PlayerControl respectively.
A GameControlAssignment is a configurable binding for one of those controls. It points to either a GameControl or a PlayerControl — never both.
Each assignment can be triggered two ways:
-
SystemKeyAssignment— the original C64 keyboard key for this control (e.g.space). The host also passes this key through to the emulator directly, so the physical key always works. -
JoystickActionAssignment— the original C64 joystick direction or button (e.g.fire). Used when the game reads joystick input natively.
A ControllerControlAssignment maps a physical controller button (identified by its canonical_control_name, e.g. button_west) to one of those assignments. LoadC64 uses these mappings to configure the emulator at launch.
A single control can have multiple ControllerControlAssignment rows — different users may map different buttons to the same underlying action. The uniqueness constraint ensures no two controls within the same game (or same player) share the same canonical button.
See Key Mappings for valid values.
| Value | Description |
|---|---|
| up | Joystick up |
| down | Joystick down |
| left | Joystick left |
| right | Joystick right |
| fire | Joystick fire button |
| Field | Type | PK | FK | Nullable | Unique | Description |
|---|---|---|---|---|---|---|
| id | integer | yes | Surrogate primary key. | |||
| game_id | integer | Game.id | The game this control belongs to. | |||
| name | text | Game.id | Human-readable name of this control. | |||
| description | text | yes | Human-readable description of this control. |
| Field | Type | PK | FK | Nullable | Unique | Description |
|---|---|---|---|---|---|---|
| id | integer | yes | Surrogate primary key. | |||
| game_control_id | integer | GameControl.id | The game control this control belongs to. | |||
| player_id | integer | Player.id | The player this control belongs to. |
| Field | Type | PK | FK | Nullable | Unique | Description |
|---|---|---|---|---|---|---|
| id | integer | yes | Surrogate primary key. | |||
| game_control_id | integer | GameControl.id | yes | The game control this control assignment belongs to. | ||
| player_control_id | integer | PlayerControl.id | yes | The player control this control assignment belongs to. |
- A GameControlAssignment must belong to either a GameControl or a PlayerControl.
| Field | Type | PK | FK | Nullable | Unique | Description |
|---|---|---|---|---|---|---|
| id | integer | yes | Surrogate primary key. | |||
| game_control_assignment_id | integer | GameControlAssignment.id | The game control assignment this control belongs to. | |||
| system_key | system_keys | The system keyboard key that triggers this control (e.g. "f1"). The system key is unique within a game |
- The system_key must be unique per game for game controls
- The system_key must be unique per player for player controls
- i.e. You cannot assign the same system key to different controls
| Field | Type | PK | FK | Nullable | Unique | Description |
|---|---|---|---|---|---|---|
| id | integer | yes | Surrogate primary key. | |||
| game_control_assignment_id | integer | GameControlAssignment.id | The game control assignment this control belongs to. | |||
| joystick_action | joystick_actions | The joystick action that triggers this control (e.g. "fire"). The joystick action is unique within a game |
- The joystick_action must be unique per game for game controls
- The joystick_action must be unique per player for player controls
- i.e. You cannot assign the same joystick action to different controls
Atic Atac — player controls for movement and actions, system keys for game-wide controls. F1 is also mapped to the start button so the user can start without touching the keyboard.
game_control
| id | game_id | name | description |
|---|---|---|---|
| 1 | 1 | Start 1 Player Game | |
| 2 | 1 | Start 2 Player Game | |
| 3 | 1 | Up | |
| 4 | 1 | Down | |
| 5 | 1 | Left | |
| 6 | 1 | Right | |
| 7 | 1 | Fire | |
| 8 | 1 | Pick-up / Drop | You can carry up to 3 items, after which the last item is automatically dropped. |
player_control
| id | game_control_id | player_id |
|---|---|---|
| 1 | 3 | 1 |
| 2 | 4 | 1 |
| 3 | 5 | 1 |
| 4 | 6 | 1 |
| 5 | 7 | 1 |
| 6 | 8 | 1 |
| 7 | 3 | 2 |
| 8 | 4 | 2 |
| 9 | 5 | 2 |
| 10 | 6 | 2 |
| 11 | 7 | 2 |
| 12 | 8 | 2 |
game_control_assignment
| id | game_control_id | player_control_id |
|---|---|---|
| 1 | 1 | null |
| 2 | 2 | null |
| 3 | null | 1 |
| 4 | null | 2 |
| 5 | null | 3 |
| 6 | null | 4 |
| 7 | null | 5 |
| 8 | null | 6 |
| 9 | null | 7 |
| 10 | null | 8 |
| 11 | null | 9 |
| 12 | null | 10 |
| 13 | null | 11 |
| 14 | null | 12 |
system_key_assignment
| id | game_control_assignment_id | system_key |
|---|---|---|
| 1 | 1 | f1 |
| 2 | 2 | f2 |
| 3 | 8 | space |
| 4 | 14 | space |
joystick_action_assignment
| id | game_control_assignment_id | joystick_action |
|---|---|---|
| 1 | 3 | up |
| 2 | 4 | down |
| 3 | 5 | left |
| 4 | 6 | right |
| 5 | 7 | fire |
| 6 | 9 | up |
| 7 | 10 | down |
| 8 | 11 | left |
| 9 | 12 | right |
| 10 | 13 | fire |
controller_control_assignment
| id | system_key_assignment_id | joystick_action_assignment_id | canonical_control_name |
|---|---|---|---|
| 1 | 1 | null | start |
| 2 | null | 1 | dpad_up |
| 3 | null | 2 | dpad_down |
| 4 | null | 3 | dpad_left |
| 5 | null | 4 | dpad_right |
| 6 | null | 5 | button_south |
| 7 | 3 | null | button_west |
| 8 | null | 6 | dpad_up |
| 9 | null | 7 | dpad_down |
| 10 | null | 8 | dpad_left |
| 11 | null | 9 | dpad_right |
| 12 | null | 10 | button_south |
| 13 | 4 | null | button_east |
- Start 2 Player Game is not mapped to a controller control
- Because Atic Atac is not simultaneous multiplayer, both players can use the same keys
- The space bar still picks up / drops items
- Player 1 has additionally mapped button_west to pick-up / drop
- Player 2 has additionally mapped button_east to pick-up / drop