DEV Community

HALO
HALO

Posted on

Getting Started with ADV Development in GOKI2: System Architecture – Understanding Module Structure and Custom Syntax Extensions

GOKI2

I am developing a framework called GOKI2 to enable the creation of games other than ADVs/visual novels using KiriKiri Z.

If you are interested, please download "Avalanches-Release2.x.x.x.zip" from the site below.
Extracting this file will provide you with the Avalanches source code and binaries (the development environment), as well as the tools required for development. We recommend reading readme.txt first.

  • Avalanches: The development environment.
  • GOKI2: The game framework.

Download

If you are interested, you can download the latest environment from the "Assets" section of the release tag (labeled as Avalanches release version 2.x.y.y) on the site below:

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

Modules

In GOKI2, each tag is managed as a "module," and each module implements the necessary tags for its specific function.
Currently, a large number of modules have been developed. Users can build their own unique game configuration by importing only the modules (features) they require.
Modules are loaded in /src/goki2/system/construct.gs.
For a standard ADV game, the configuration would typically look like this:

; Snapshot feature
@load_module name=ModSnapshot
; Bookmark feature
@load_module name=ModBookmark
; Image-related features
@load_module name=ModImage
; Message layer-related features
@load_module name=ModMessage
; Sound-related features
@load_module name=ModSound
; Video-related features
@load_module name=ModVideo
; Right-click-related features
@load_module name=ModRightClick
; ADV features
@load_module name=ModADV
; System buttons
@load_module name=ModSystemButtons
; Save/Load screen
@load_module name=ModSaveLoad
; System screen
@load_module name=ModSystem
; Choices
@load_module name=ModSelect
; Title screen
@load_module name=ModTitle
; CG/Gallery screen
@load_module name=ModCGMemory
; Version window
@load_module name=ModVersionWindow
Enter fullscreen mode Exit fullscreen mode

For details on each tag, please refer to the manual /doc/goki2/index.html.

GOKI2 implements its own tags, but with GOKI2's syntax extension features, tags compatible with KAG3 can also be provided. By default, GOKI2 provides a script called KAGCompatible.gs, which allows writing GOKI2 tags in KAG3 format.

The content is as follows, specifying scripts to create KAG3-compatible tags for the modules that are loaded.

@que unshift storage=KAGCompatibleDefault.gs
@que unshift storage=KAGCompatibleBookmark.gs
@que unshift storage=KAGCompatibleImage.gs
@que unshift storage=KAGCompatibleMessage.gs
@que unshift storage=KAGCompatibleRightClick.gs
@que unshift storage=KAGCompatibleSnapshot.gs
@que unshift storage=KAGCompatibleSound.gs
@que unshift storage=KAGCompatibleVideo.gs
Enter fullscreen mode Exit fullscreen mode

Let's take a quick look at the contents of the file.

@!cursor /default_cursor=<DEFAULT> /pointed_cursor=<POINTED> /click_cursor=<CLICK> /draggable_cursor=<DRAGGABLE>

@redirect alias=loadplugin name=load_plugin
@!load_plugin /name=<MODULE>

@redirect alias=resetwait name=reset_wait

@!wait /skip=<CANSKIP> /no_skip=<NO_CANSKIP> /!skip=<!CANSKIP>

@redirect alias=waitclick name=wait_click
Enter fullscreen mode Exit fullscreen mode

Utilizing syntax and redirect Tags in GOKI2

GOKI2 has a basic policy of "not omitting tag names or attribute names," but to simplify descriptions that tend to become long, it adopts a style that combines the syntax tag and redirect tag.


syntax Tag: Tag Syntax Extension

The syntax tag is used to define new syntax patterns for existing tags to simplify descriptions. However, extended syntax is not saved in the save data, so be sure to set it during initialization.

1. Expanding Syntax by Adding ! to Tag Names

When using the syntax tag, you can define new description patterns by adding ! to the tag name you want to define.
Example of Syntax Extension:

Extension Definition (@!) Actual Description Interpreted After Conversion (@)
@!make_character image=imgebl->true,imgdis->false @make_character imgebl @make_character image=true
@make_character imgdis @make_character image=false

2. Specify a pattern by adding a / symbol to an attribute (pattern replacement)

By using the / symbol in a syntax tag attribute, you can specify a pattern replacement for the attribute value. The <KEY> part will be replaced with the value of the specified attribute.

Example of pattern replacement:

Extended definition (@!) Actual notation Interpreted after conversion (@)
@!halo/storage=A_<POSE>_<FACE> @halo pose=Pose1 face=Face1 @halo storage=A_Pose1_Face1

3. Combined Usage

These can be used in combination.

Example of combination:

Extended Definition (@!) Actual Description Converted Interpretation (@)
@!halo /storage=A_<POSE>_<FACE> pose=Pose1->p1 face=Face1 @halo Pose1 Face1 @halo storage=A_p1_Face1

redirect Tag: Shortening Long Tag Names

As a basic principle of GOKI, we try not to abbreviate tag names or attribute names, but we adopt a style of shortening names using the redirect tag and the syntax tag.

The redirect tag is used in combination with the syntax tag to convert GOKI2's long tag names and attribute names into arbitrary short names for the user. This allows both concise writing and code clarity.

Data specified with the redirect tag is saved in the save data, so it doesn't matter where it is written.


Support for KAG3 Compatibility

Since GOKI2 tags have longer names compared to KAG3, a configuration file is provided in advance so that you can write in the conventional KAG3 format.
Make sure to load only what is necessary. For example, if you are not loading the ModBookmark module, you do not need to load KAGCompatibleBookmark.gs. (It will result in an error)

  • This is mainly handled in the /src/goki2/system/KAGCompatible***.gs files.

In Conclusion

For now, we have briefly introduced GOKI2.
Going forward, we will periodically post about GOKI2 and Avalanches.

Latest Articles (Japanese)

Top comments (0)