Combo Memo WIP: Part 2 - Data Structure (Combo notation)
Published: 2024-01-28 11:23:12

After defining the scope of the project, the next step is to design the implementation and data structure.

# Data Structure

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t02aef8vy7vl7cgux62i.png)

[mermaid graph](https://mermaid.live/edit#pako:eNqtUl1PwjAU_SvNfR6kjNmxviEu6gNiEH0wS0xd62h07dJ1iTj23y0bhBmI8cH70vtx7jmnaWtINRdAQZgryTLD8kQhF9fTeYy228FgW6PZzXQ5na3iJaJozcoeoO7yXZTWSJUhxXLRNZvuOC4f2Bbzy0Wf6Yj4C127_Ruw1-SiTI0srNTqZJZqxeXPiVQWcZaz7Jzk3v188RT3zbf1_9tpeux75du7-8dVX7prnGq_VtZq9XLWgt0Uh8uBB7kwOZPcvX7LkoBdC7cE1KWcmfcEErXDscrqh41KgVpTCQ-qgjMr9v8F6Bv7KF23YOpZ6_wAciXQGj6BjqNoSAgOg8kkCkc4IKEHG6CjYeAHIz8Yh3iCfUz8xoOvlgAPowgTEl6Mw4C4Lew33-eLxnY)

**Game** 
- GGST, SF6, Tekken

**Character**
- Ram, Sol, Ky, May

**Combo**
- combos for each character
- `f.S > 214P > 214P > dc > 623P`

**Move**
- Chaining moves in a combo
`214 P`, `236236 HS`

**Input**
- Individual input
- `2`, `214`, `P`, `D`, `RC`
- I define input types `directional` and `action` here


# Combo Notation
Combo notation is more complicated than I thought 
`c.S > 2H > 623P, c.S > jc, j.K > j.214S`

You first have basic directional input and attack buttons
- Down, Front, Back, etc... which = to 123456789 
- Attacks, and special mechanics, depending on the games
  - P, K, HS, RC, ...

And then you have moves like dragon punch, quarter circle...
- 216, 236, ...

referring to dustloop, it also has different onditions
- far, close
- Charge
- Delay
- Cancel

```
> = Proceed from the previous move to the following move.
▷/land = Indicate that the player must land at that point in the sequence.
, = Link the previous move into the following move.
->/~ = Cancel the previous special into a follow-up special.
dl./delay = Delay the following move.
whiff/(whiff) = The move must whiff (not hit).
c. = Close
f. = Far
j. = Jumping/Aerial
hj./sj. = High Jump/Super Jump
jc = Jump Cancel
hjc/sjc = High Jump Cancel/Super Jump Cancel
dc/adc = Dash Cancel/Air Dash Cancel
CH = Counter Hit
AA = Anti-Air
IAS = Instant Air Special
[X] = Hold input.
]X[ = Release input.
(move) = Move is optional.
[X] or [Y] = Perform sequence X or Y.
[sequence] xN = Repeat sequence N amount of times.
(N) = Hit N of a move or move must deal N amount of hits.
IAD = Instant Air Dash
BRC = Blue Roman Cancel
RRC = Red Roman Cancel
PRC = Purple Roman Cancel
YRC = Yellow Roman Cancel
YYXRC = Dash Input X Roman Cancel in Y direction i.e: 22PRC
XRC~Q = Cancel the X Roman Cancel into Q i.e: RRC~5K
WS = Wall Stick/Wall Splat
```

# Implementation

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bob08129jmozqp3v2sky.png)

I decided to work on the combo string interpretation first and input class. 

`c.S > 2H > 623P, c.S > jc, j.K > j.214S`

### Parse Steps
- Split the combo by `>` 
- Separate directional and moves input 
  - `216P` -> `216` + `P`
- Map each Input and render the icon

### Difficulties
- How to handle `216216HS` -> `216` + `216` + `HS`
  - As there are two directional Inputs
- `j.S`, `c.S`, `f.S`
  - Input has conditions, jump, close, far

# TODO:
- Refine the Combo string translation function, supporting all notations
- Combo List add/ delete
- Support Multiple Games/ Character
- Combo List Save to cookie  

# Repo
https://github.com/andaccc/combo-memo

I have set the repo to public and host it on aws