--------- Sections ---------

<Index> - >DevDiary< - <Characters> - <Lore>

ichi rss

--- DevDiary ---

<Back>

- 2023/02/11 -

This week, I have located all SD files from its previous 2020 build and have begun analyzing my old code. As before, the first part of the code to make sense of is the code for Pawn herself.

Pawn operates on state logic. She has 37 different states, each of which includes various parameters: image, movement speed, attack hitboxes, next state, input reactions, sounds etc.; Some data of some states is hard-coded into the game outside of the state database - for example, lives subtraction whenever Pawn enters the Damaged state.


Player has four different inputs that can affect Pawn's actions: Left Arrow, Right Arrow, Left Swipe and Right Swipe. Each input also has two variations: On and Off.

Pawn can react to presses and releases. The simplest example is an initial swing.

Stand state reacts to Left Swipe On input and transitions into Swing Left state. It lasts for 14 frames and transitions into Hold Left state. This state reacts to Left Swipe Off input and moves into Sheathe Left state, lasting 6 frames, and finally goes back to Stand state.


Among the 37 states, only 3 have no direction associated with them (Stand, Damaged and Frozen). The other states could have a direction modifier, but in SD2020 they are expanded to be their own separate states (for example, Hold Left and Hold Right). Additionally, there is a lot of states that differ only by the fact of having the sword out, the majority of their data identical otherwise. The animation below features 6 separate states in total.

The state logic of SD2020 chooses absolute distinction and redundancy, to make every state as self-sufficient as possible, and to make it easier to store their data in a database-like structure.