DEV Community

HALO
HALO

Posted on

GOKI2 Gameplay: ModBookmark & KAG3 Variable System for Data Persistence

Download

Avalanches & GOKI2 can download the latest environment from the Assets link of Avalanches-GOKI2-Release2.x.y.y.zip based on the release tag on the following site (written as Avalanches (GOKI2) release version 2.x.y.y).

https://github.com/halo1234/Avalanches/releases

ModBookmark and ModSnapshot

ModBookmark is a module related to save data.
ModSnapshot is a module related to snapshots.

First, load the modules.

; Snapshot feature
@load_module name=ModSnapshot
; Bookmark feature
@load_module name=ModBookmark
Enter fullscreen mode Exit fullscreen mode

With this, snapshot and save data features are incorporated.

Setting the Save Data Format

First, set the format for save data.

@bookmark format=bmp24 width=150 height=auto keep_aspect_ratio mode=z quick=quick store_skipping
Enter fullscreen mode Exit fullscreen mode

Let's go through it step by step. First, format=bmp24 specifies bmp24 for the format attribute. Other options include bmp32/bmp8/bmp (same as bmp32). This means that a thumbnail will be included in the save data.

Next, we specify the size of the thumbnail with width=150 height=auto.
The width is set to 150, and the height is calculated automatically.

We specify keep_aspect_ratio to fix the aspect ratio of the thumbnail.
When this attribute is specified, the size is calculated while maintaining the aspect ratio.

mode=z specifies the format in which the data is saved.
Specifying z compresses the data.
Specifying c encrypts the data.
Both cannot be specified at the same time.

quick=quick specifies the name of the so-called quick save data.
If a quick save is performed, the data is saved under the name specified here.

store_skipping specifies whether to store save data during skipping.
This functions as a hint for speeding up.
If you set this attribute to true, save data will not be stored during skipping.
This can thus provide faster skipping.
However, when stopping at an s tag, for example, it is necessary to store the final state of the save data.
Including force_store in the name of a savable label allows save data to be stored even if this attribute is true.
For instance, when using choices, the following method is recommended:

*force_store|
@select caption=Choice 1 target=*choice1
@select caption=Choice 2 target=*choice2
@select show
@s
Enter fullscreen mode Exit fullscreen mode

By doing this, even if store_skipping is true, the save data will be forcibly stored by force_store during skipping.

Thumbnails

The thumbnail module manages the capturing and releasing of snapshots. Normally, it is a module you don't need to pay particular attention to.

You can also manually take snapshots.

; Capture a snapshot of the current screen
@lock_snapshot
; Release the snapshot
@unlock_snapshot
Enter fullscreen mode Exit fullscreen mode

If the number of calls to lock_snapshot and unlock_snapshot does not match, malfunctions may occur. You will probably rarely use this tag directly.

Variable Areas

The variable areas managed by ModBookmark include three areas: user variables, system variables, and temporary variables. User variables are stored in save data. System variables are stored in system save data. Temporary variables are disposable variables that can be used temporarily and are not saved to files. This design is the same as KAG3.

The contents stored in user variables are saved in each save data. To store a value in a user variable, do the following:

@eval exp="f.testVal = 99999"
Enter fullscreen mode Exit fullscreen mode

The contents saved in system variables are stored in the system save data. The system variable area stores settings that affect the entire game. For example, information such as whether the game has been cleared is not very meaningful to save in individual save data. It is used in cases where you want to access the same information regardless of which save data is loaded. The actual script for saving a value in the system variable area is as follows:

@eval exp="sf.gameClear = true"
Enter fullscreen mode Exit fullscreen mode

As the name suggests, temporary variables are a variable area used temporarily. Since they are not saved, they are used when you just want to temporarily store a value. They are not saved, so the information is lost when the game is restarted. The usage is as follows:

@eval exp="tf.tempVal = 'string'"
Enter fullscreen mode Exit fullscreen mode

Return to Previous / Return to Title

The "Return to Previous" and "Return to Title" functions are also managed by ModBookmark. The Return to Previous function uses the record and go_back tags. The record tag saves the state of the last savable label before it was written. The go_back tag returns to the previous state.

The function to return to the title uses the start_anchor tag and the go_to_start tag.

The start_anchor tag saves the state of the previous saveable label before it.

The go_to_start tag returns to the location where start_anchor was written (the previous saveable label).

For example, you would write it like this:

*game_start|
@start_anchor
Enter fullscreen mode Exit fullscreen mode

Normally, returning to the previous point or back to the title would be done by the user from the menu.

Dialog

In ModBookmark, you can display a confirmation dialog to the user when performing actions like returning to the start or saving.

If you want to use original images in the dialog, it is recommended to use the ask_save, ask_start, and ask_record tags.

These tags allow you to specify images for each UI.

For the values to assign to each attribute, please refer to the manual (/doc/goki2/index.html).

If you do not use these tags, the default UI will be used.

Top comments (0)