Software Requirements Specification for Suika2
Author | ktabata |
Modified By | |
Organization | |
Updated | 10th October 2023 |
Created | 27th October 2022 |
Revision | 14.6.0 |
Table of Contents
Suika2 is a tool for creating visual novels. It is a cross-platform software, compatible with, but not limited to, Windows, Mac, Linux, iOS, Android and Web browsers. This document outlines the software requirements specification (SRS) for Suika2.
This section explains why the SRS is needed for Suika2, an open-source software (OSS) project.
This project has grown with an emphasis on documentation and translation. To our delight, the project has several sources of documentation: the main repository, the old website, the new website, their Japanese and Chinese translations, and the Wiki. These documents may cause inconsistencies in the future, with minute inconsistencies as of the writing of this document.
Therefore, the project decided to create an SRS that would be the principal source of all documentation, and from which other documentation would be adapted and created.
If a description of a specification that exists in another document does not exist in the SRS, it must be added to the SRS.
This folder is for anime files.
This folder is for background image files.
This folder is for background music files
This folder is for the following images.
This folder is for character sprites.
This folder is for config files, namely, "config.txt".
This folder is for character voice files.
This folder is for font files.
This folder is for GUI definition files.
This folder is for rule image files which are used in rule-based transitions of background and character images.
This folder is for save data. It is automatically generated by Suika2. When release mode is enabled, this folder is not generated in the game folder. See further details in the "Release Mode" section.
This folder is for sound effect files.
This folder is for scenario files.
This folder is for WMS (Watermelon Script) files.
This is a package file. See further details in the "Package" section.
This is an application for Windows.
This is an application for macOS.
In main screen (See further details in the "Main Screen" section), screen components are layered. When referring to all layers, the term "stage" is used.
The stage consists of the following, in order from bottom to top:
Background Layer bg2 Layer Effect5-8 Layers Back Center Character Layer Left Character Layer Right Character Layer Center Character Layer Effect1-4 Layers Message Box Layer Namebox Layer Character Face Layer Click Animation Layer Options Layer Collapsed System Menu Layer System Menu Layer
The background image is the lowest layer that makes up the screen. Its size must be equal to that of the window.
The "bg2" layer can be used for anime.
The "effect5", "effect6", "effect7" and "effect8" layers can be used for anime.
center (Center Character) right (Right Character) left (Left Character) back (Back Center Character) face (Character Face)
There are four regular character types depending on their horizontal display position (center, right, left and back).
The center and back charater positions have the same horizontal display position, but the layers displayed are different.
There is a position for the character's face to be displayed to the left of the message box.
All characters are vertically aligned at the bottom of the screen.
The effect1, effect2, effect3 and effect4 layers can be used for anime.
The message box is a window for outputting text.
It is made up of a set of "bg" (background) and "fg" (foreground) images.
In simple terms, the bg image is displayed by default (often referred to as an "idle" image).
When a developer creates an "In-box Menu" and a game user points (hovers) over a button, the button area of the fg image is substituted in.
Given that the fg image must be specified, a developer may choose to use the same image for both the fg and bg images. This is most often the case when the message box does not include a menu.
The message box can have menu buttons. Acceptable button types are:
The current demo game only uses the "hide" button. If developers want to use the other buttons, they can simply provide appropriate message box images and add some configs.
The namebox is a window for outputting a character's name.
Names are usually horizontally centered, but can be left-aligned by config.
The namebox can be hidden by a config in order to realize a full-screen style novel.
This is a button that is visible during the display of messages and choices. Clicking this button opens the "System Menu". The collapsed system menu is invisible and disabled while the "System Menu" is visible.
This is a menu that consists of buttons. Acceptable button types are:
The system menu is activated by clicking on the collapsed system menu or by right-clicking when a message or option(s) is displayed.
While the system menu is displayed, right-clicking or clicking anywhere other than the buttons will exit the system menu and return to the collapsed system menu.
An important building block of Suika2's functionality are "commands". Therefore, more than half of the functional requirements are found in the design of commands.
See details regarding command implementation in the [[Command Reference:reference.md]].
The following is example command syntax.
@command-name <required-parameter> (optional-parameter)
This feature plays an anime file. The command that accomplishes this feature is "@anime".
@anime <file> (options)
This feature shows a background image. The command that accomplishes this feature is "@bg".
@bg <file> (duration) (effect)
The "@bg" command changes the background image. It fades in a new background image over a specified time in seconds.
Background image files need to be stored in the bg folder. The hex RGB color specifier (e.g., "#0088ff") may be used instead of an image file name.
When "@bg" is run, the originally displayed background as well as any character images are removed from the stage. Game developers can use @chsx instead of "@bg" when they want to keep character images on the stage.
If you are looking for a way to keep your characters from disappearing when you change the background, write the following command:
@chsx left=stay center=stay right=stay back=stay background=background.png duration=1.0
Fade-ins are accompanied by transition effects. The following is the list of effects types.
Effect Type | Effect Name | Abbrev. Name 1 | Abbrev. Name 2 | Japanese Name |
fade/dissolve (alpha blending) | "normal" | "n" | (not-specified) | "標準" |
right curtain | "curtain-right" | "curtain" | "c" | "右カーテン" |
left curtain | "curtain-left" | "cl" | "左カーテン" | |
up curtain | "curtain-up" | "cu" | "上カーテン" | |
down curtain | "curtain-down" | "cd" | "下カーテン" | |
right slide | "slide-right" | "sr" | "右スライド" | |
left slide | "slide-left" | "sl" | "左スライド" | |
up slide | "slide-up" | "su" | "上スライド" | |
down slide | "slide-down" | "sd" | "下スライド" | |
right shutter | "shutter-right" | "shr" | "右シャッター" | |
left shutter | "shutter-left" | "shl" | "左シャッラー" | |
up shutter | "shutter-up" | "shu" | "上シャッター" | |
down shutter | "shutter-down" | "shd" | "下シャッター" | |
clockwise wipe | "clockwise" | "cw" | "時計回り" | |
counterclockwise wipe | "counterclockwise" | "ccw" | "反時計回り" | |
clockwise wipe (20 degrees stepped) | "clockwise20" | "cw20" | ||
counterclockwise wipe (20 degrees stepped) | "counterclockwise20" | "ccw20" | ||
clockwise wipe (30 degrees stepped) | "clockwise30" | "cw30" | ||
counterclockwise wipe (30 degrees stepped) | "counterclockwise30" | "ccw30" | ||
open eyes | "eye-open" | |||
close eyes | "eye-close" | |||
open eyes (vertical) | "eye-open-v" | |||
close eyes (vertical) | "eye-close-v" | |||
open slit | "slit-open" | |||
close slit | "slit-close" | |||
open slit (vertical) | "slit-open-v" | |||
close slit (vertical) | "slit-close-v" | |||
rule (universal transition/1-bit) | "rule:<rule-file>" | |||
melt (universal transition/8-bit) | "melt:<rule-file>" |
The "mask" Effect type was removed as the "rule" effect type was introduced. The demo includes a "rule-mask.png" file as a rule image corresponding to "mask", therefore "rule:rule-mask.png" works fine.
The following script changes the background image to "sample.png" immediately.
@bg sample.png
The following script changes the background image to "sample.png" with a 1.5 second fade-in time. The applicable effect type is "fade/dissolve (alpha blending)", which is default.
@bg sample.png 1.5
The following script changes the background image to "sample.png" with a 1.5 second fade-in time. The applicable effect type is "right curtain", which is like closing a curtain in the right direction.
@bg sample.png 1.5 curtain-right
The following script changes the background to the color black with a 1.5 second fade-in time. The applicable effect type is "close eyes", which is like closing eyes slowly.
@bg #000000 1.5 eye-close
The following script changes the background image to "sample.png" with a 1.5 second fade-in time. The applicable effect type is "rule (universal transition/1-bit)", which uses "rule-star.png" image for transition rule.
@bg sample.png 1.5 rule:rule-star.png
The following script changes the background image to "sample.png" with a 1.5 second fade-in time. The applicable effect type is "melt (universal transition/8-bit)", which uses "rule-star.png" image for transition rule.
@bg sample.png 1.5 melt:rule-star.png
"@bg" can be written with parameter names:
@bg file=001.png duration=1.0 effect=normal
"@bg" has a Japanese alias "@背景".
@背景 ファイル=001.png 秒=1.0 エフェクト=normal
This feature shows a character image. The command that accomplishes this feature is "@ch".
@ch <position> <file> (duration) (effect) (right-offset) (down-offset) (alpha)
The "@ch" command changes the character. Character image files need to be in the ch folder.
Character layers include "center" (center front), "right", "left", "back" (center back) and "face" (character face).
Display Position | Target Name | Abbrev. Name | Japanese Name |
Front Center | "center" | "c" | "中央" |
Right | "right" | "r" | "右" |
Left | "left" | "l" | "左" |
Back Center | "back" | "b" | "背面" |
Face Icon | "face" | "f" | "顔" |
The effect types are the same as "Showing a Background ("@bg")".
All characters are vertically aligned at the bottom of the screen.
The following script displays "sample.png" immediately in the front center position. Note that "center" can be abbreviated as "c".
@ch center sample.png
The following script displays "sample.png" in 0.5 seconds in the front center position. The applicable effect type is "fade/dissolve (alpha blending)", which is default.
@ch center sample.png 0.5
The following script removes the front center character in 0.5 seconds. The applicable effect type is "fade/dissolve (alpha blending)", which is default.
@ch center none 0.5
The following script displays "sample.png" in 1.0 second in the front center position. The applicable effect type is "clockwise wipe".
@ch center sample.png 1.0 clockwise
The following script displays "sample.png" in 1.0 second in the front center position. Here, "100 50" means offset, shifting the display position 50 pixels to the right and 50 pixels down. "normal" means the effect type "fade/dissolve (alpha blending)".
@ch center sample.png 1.0 normal 100 50
The following script displays "sample.png" in 1.0 second in the front center position with the alpha value "127" (50%). The alpha value ranges from "0" to "255". For the alpha value specifier, game developers can write "show" as an equivalent to "255" or "hide" as "0".
@ch center sample.png 1.0 normal 0 0 127
"@ch" can be written with parameter names.
@ch position=center file=001.png duration=1.0 effect=normal right=0 down=0 alpha=255
"@ch" has a Japanese alias "@キャラ".
@キャラ 位置=中央 ファイル=001.png 秒=1.0 エフェクト=標準 右=0 下=0 アルファ=255 @キャラ 位置=中央 消去
This feature shows the descriptive part of the story. It is not an atmark command that makes this feature possible. A message is one-line of text that does not begin with an atmark ("@"), asterisk ("*") or colon (":").
Messages are output to a message box. As the descriptive part does not have the speaker's name, the namebox is hidden while the message is showing.
A messages is displayed one character at a time. When clicked in the middle, all characters are displayed at once. When all characters are displayed, Suika2 goes into "Click Waiting Mode for Message" and displays a click animation prompting click-input. If a click is made while a click animation is being displayed, Suika2 moves to the next command.
At any point during the display of a message, unless if the control key is pressed and the message is unread, Suika2 moves to the next command.
The following format specifiers are available.
Append mode is useful for the creation of full-screen style novels.
End users can use the return key and down arrow key instead of left click.
Hello, world!
This feature shows the dialog of the story. It is not an atmark command that makes this feature possible. A line is one-line text that begin with an asterisk.
This command prints text to the message box and also the character name to the name box. It consists of a character name, a message and optionally a voice file name, and they are separated by asterisks. For example:
*name*dialog message *name*voice.ogg*dialog message
The name appears before the message.
Audio starts playing when the name is displayed. Normally, audio playback is stopped before moving on to the next command, but this behavior can be suppressed in the config.
If "@" is added to the beginning of a voice file name, the audio playback is looped for the length of the message.
Other functions are exactly the same as "Showing a Background (@bg)".
Suika2 supports Japanese line format.
キャラ名「セリフ」
This feature plays background music. The command that accomplishes this feature is "@bgm".
@bgm <file>
The "@bgm" command plays background music (BGM). BGM files need to be stored in the "bgm" folder.
Unless otherwise specified, BGM is played in a loop. Game developers can use the "once" specifier to prevent BGM from looping.
The ability to crossfade multiple BGMs is not available. Therefore, game developers may first need to fade out the old BGM and then fade in the new BGM.
The following script plays "sample.ogg" as BGM. Playback is looped.
@bgm sample.ogg
The following script stops BGM immediately.
@bgm stop
The following script plays "sample.ogg" as BGM. Playback is not looped.
@bgm sample.ogg once
The following sample script fades-out the BGM in 2 seconds.
@vol bgm 0.0 2.0 @wait 2.0 @bgm stop @vol bgm 1.0
"@bgm" can be written with parameter names:
@bgm file=001.ogg
"@bgm" has a Japanese alias "@音楽".
@音楽 ファイル=001.ogg @音楽 停止
This feature plays a sound effect. The command that accomplishes this feature is "@se".
@se <file> (loop)
The "@se" command plays sound effects. Sound effect files need to be in the "se" folder.
The following script starts the playback of a sound effect file.
@se click.ogg
The following script stops the playback of a sound effect file.
@se stop
The following script loops a sound effect file.
@se sample.ogg loop
The following script plays a sound effect file in the "voice" track. This feature is available for checking voice-volume without a text message.
@se click.ogg voice
"@se" can be written with a parameter name:
@se file=001.ogg loop
"@se" has a Japanese alias "@効果音".
@効果音 ファイル=001.ogg loop
This feature changes the volume. The command that accomplishes this feature is "@vol".
@vol <track> <volume> (duration)
The "@vol" command sets the sound volume. Suika2 has three independent sound tracks:
Track | Name | Japanese Name |
BGM | "bgm" or "b" | "音楽" |
Voice | "voice" or "v" | "声" |
Sound Effect | "se" or "s" | "効果音" |
The volume of the specified sound track will fade in/out for the specified time. This command does not wait until the fade in/out is complete. Combining with the "Waiting for Specified Time ("@wait")" feature is useful if necessary.
"bgm", "voice" and "se" tracks are for "local" volumes and there are "global" volumes. Local volumes are stored in each save data file. Global volumes are common to all save data files. The final volume will be a multiplication of the local and global volumes. To specify the global volumes, game developers can use capital "BGM", "VOICE" and "SE" tracks. Since the global volume changes immediately, it is not possible to specify a fade time.
Both the value of local and global volumes range 0.0 to 1.0.
The following script sets the local volume of BGM to 0.5 (50%) in 1.0 second.
@vol bgm 0.5 1.0
The following script sets the global volume of BGM to 0.5 (50%) immediately. Usually, the global volumes are set from the config screen, so the use of this feature is not as common.
@vol BGM 0.5 0
"@vol" can be written with parameters names.
@vol track=bgm volume=1.0 duration=1.0
"@vol" has a Japanese alias "@音量".
@音量 トラック=音楽 音量=1.0 秒=1.0
This feature shows options and lets the user choose one option, then jumps to the label selected. The command that accomplishes this feature is "@choose".
@choose <destination1> <option-text1> (destination2) (option-text2) (destination3) (option-text3) (destination4) (option-text4) (destination5) (option-text5) (destination6) (option-text6) (destination7) (option-text7) (destination8) (option-text8)
The "@choose" command can display up to eight options. A minimum of one option must be displayed.
The following script shows options.
@choose label1 "Good morning." label2 "Good afternoon." label3 "Good evening." :label1 Good morning. @goto end :label2 Good afternoon. @goto end :label3 Good evening. :end
"@choose" can be written with parameter names.
@choose destination1=LABEL1 option1="I like cars." destination2=LABEL2 option2="I like trains." destination3=LABEL3 option3="I like bicycles." destination4=LABEL4 option4="I like boats." destination5=LABEL5 option5="I like Shinkansen." destination6=LABEL6 option6="I like helicopters." destination7=LABEL7 option7="I like buses." destination8=LABEL8 option8="I like walking."
"@choose" has a Japanese alias "@選択肢".
@選択肢 行き先1=LABEL1 選択肢1=車が好きです
This is a jump target inside a script. It is not an atmark command, but one-line of text that begin with a colon.
This command can be used as a jump target, which is typically used with the @choose command, @goto command, @if commands and the GUI buttons.
The following script creates a loop.
:JumpTarget Show some messages. @goto JumpTarget
This feature displays a character sprite in motion. The command that accomplishes this feature is "@cha".
@cha <position> <duration> <acceleration> <x-offset> <y-offset> <alpha>
The "@cha" command translates one character sprite at a time and can also change its alpha value. Refer to the "Showing a Character Image (@ch)" section for details on how to specify the character position and the alpha value.
Constant velocity ("move"), acceleration ("accel") and deceleration ("brake") can be used for translation.
Movement Mode | English Specifiers | Japanese Specifiers |
Constant Velocity | "move" | "なし" |
Acceleration | "accel" | "あり" |
Deceleration | "brake" | "減速" |
"@cha" is an abbreviation of "character animation".
The following script moves the character in the front center position 600 pixels to the left and hides it with an animation time of 1.0 second.
@cha center 1.0 move -600 0 hide
The following script moves the character in the front center position 600 pixels to the left and hides it with an animation time of 1.0 second. This script is the same as Usage 1, but this one uses acceleration.
@cha center 1.0 accel -600 0 hide
The following script moves the character in the front center position 600 pixels to the left and hides it with an animation time of 1.0 second. This script is the same as Usage 1, but this one uses deceleration.
@cha center 1.0 brake -600 0 hide
The following script preloads the character image out of screen, then moves it into the screen.
@ch right sample.png 0 normal 600 0 hide @cha right 2.0 move -600 0 show
"@cha" can be written with parameter names.
@cha position=center duration=1.0 acceleration=normal x=100 y=100 alpha=255
"@cha" has a Japanese alias "@キャラ移動".
@キャラ移動 位置=中央 秒=1.0 加速=なし x=100 y=100 アルファ=255
This feature changes character sprites and the background image all at once. The command that accomplishes this feature is "@chs".
@chs <center-file> <right-file> <left-file> <back-file> (duration) (background-file) (effect)
The "@chs" command has the ability to change just the character(s) or just the background, or all of these.
The character specification order is "center", "right", "left" and "back". The effect types are the same as "Showing a Background (@bg)".
"chs" is an abbreviation of "change stage".
The following script changes background image while leaving the characters in place with a 1.0 second fade time.
@chs stay stay stay stay 1.0 background.png
The following script changes front center and right characters with a 1.0 second fade time. Other characters will not be changed.
@chs center.png right.png stay stay 1.0
The following script vanishes the character in the front center position with a 1.0 second fade time. Other characters will not be changed.
@chs none stay stay stay 1.0
The following script changes the background without any changes to the characters with a 1.0 second fade time.
@chs stay stay stay stay 1.0 background.png
The following script changes the character in the front center position as well as the background with a 1.0 second fade time. The effect type is "right curtain".
@chs center.png stay stay stay 1.0 background.png curtain-right
"@chs" can be written with parameter names.
@chs center=001.png right=002.png left=003.png back=004.png duration=1.0 background=005.png effect=normal
"@chs" has a Japanese alias "@場面転換".
@場面転換 中央=001.png 右=消す 左=変更なし 背面=変更なし 秒=1.0 背景=005.png エフェクト=標準
This feature is as same as the "@chs" command, but the "@chsx" command need parameter names and the parameter order is not fixed.
This feature shakes the screen. The command that accomplishes this feature is "@shake".
@shake <direction> <duration> <times> <amplitude>
The "@shake" command allows the screen to oscillate horizontally or vertically. The oscillation is a "simple harmonic motion". The period and the amplitude can be specified.
Direction | English Specifiers | Japanese Specifiers |
Horizontal | "horizontal" or "h" | "横" |
Vertical | "vertical" or "v" | "縦" |
The following script shakes the screen horizontally by 100px three times over a period of 1.0 second. "horizontal" can be abbreviated as "h".
@shake horizontal 1.0 3 100
The following script shakes the screen vertically by 100px three times over a period of 1.0 second. "vertical" can be abbreviated as "v".
@shake vertical 1.0 3 100
"@shake" can be written with parameter names.
@shake direction=horizontal duration=1.0 times=3 amplitude=100
"@shake" has a Japanese alias "@振動".
@振動 方向=横 秒=1.0 回数=3 大きさ=100 @振動 方向=縦 秒=1.0 回数=3 大きさ=100
This feature plays a video file. The command that accomplishes this feature is "@video".
@video <file-name-without-extension>
The "@video" command plays a video file.
Available video formats are currently:
Note that on Linux, the end user must have a Gstreamer plugin to decode videos.
Video files are stored in the mov folder. The "mov" folder is not stored in the "data01.arc" file.
For further details, see the "File Formats" section.
The following script plays a video file named "sample.wmv" on Windows and "sample.mp4" on the other platforms.
@video sample
"@video" can be written with a parameter name.
@video file=sample
"@video" has a Japanese alias "@動画".
@動画 ファイル=sample
This feature shows a graphical user interface (GUI). The command that accomplishes this feature is "@gui".
@gui <file> (options)
A GUI is a menu consisting of three images and can show up to 128 buttons on the screen. Button types include "jump to label", "show if variable is set", etc.
GUI definition files are also used for the config, save, load and history screens.
Options can contain:
For further details, see the "Graphical User Interface" section.
The following script shows GUI "menu.txt".
@gui menu.txt
The following script show GUI "menu.txt". It allows cancellation by right click.
@gui menu.txt cancel
"@gui" can be written with a parameter name.
@gui file=001.txt cancel
"@gui" has a Japanese alias "@メニュー".
@メニュー ファイル=001.txt @メニュー ファイル=001.txt キャンセル許可
This feature waits for a user click. The command that accomplishes this feature is "@click".
@click
During auto mode, Suika2 resumes after a 2-second pause. Also see the "Click Waiting Mode" section.
The following script waits for a click.
@click
"@click" has a Japanese alias "@クリック".
@クリック
This feature waits for a specified time in seconds. The command that accomplishes this feature is "@wait".
@wait <duration>
If a click or keystroke is made, the wait is canceled.
If the previous command is a message, the message box is visible while waiting for input, otherwise, the message box is hidden while waiting for input.
See also "Timed Waiting Mode".
The following script waits for 5 seconds.
@wait 5.0
"@wait" can be written with a parameter name.
@wait duration=1.0
"@wait" has a Japanese alias "@時間待ち".
@時間待ち 秒=1.0
This feature enables/disables skip by control key and skip mode. The command that accomplishes this feature is "@skip".
@skip <enable/disable>
The "@skip" command enables or disables the ability to skip timed commands by way of user interaction. Typically, this command is used to display a brand logo on boot time.
When "@skip disable" is issued, auto-mode and skip-mode will be canceled.
The state of non-skippable mode is not recorded to the save data files. Thus, avoid calling the save and/or load screens while non-skippable mode for consistency.
The following script enables skip. (default/skippable-mode)
@skip enable
The following script disables skip. (non-skippable mode)
@skip disable
"@skip" has a Japanese alias "@スキップ".
@スキップ 許可 @スキップ 不許可
This feature moves the script execution position to the specified label. The command that accomplishes this feature is "@jump".
@goto <label>
Currently, there is no way to jump directly to labels in other scripts.
Suika2 behaves in a special way when "$LOAD" or "$SAVE" is specified as the label for the jump destination.
The following script jumps to the label "abc" (thus creating a loop).
:abc Describe the process here. @goto abc
The following script shows the load screen.
@goto $LOAD
The following script shows the save screen.
@goto $SAVE
"@goto" can be written with a parameter name.
@goto destination=LABEL
"@goto" has a Japanese alias "@ジャンプ".
@ジャンプ 行き先=ラベル
This feature sets variable values. The command that accomplishes this feature is "@set".
@set <variable> <operator> <value>
The "@set" command performs local-variable, global-variable and name-variable manipulations.
Local and global variables has integral values. On the other hand, name variables has string values.
For local and global variables, the "@set" command can perform calculations as well as simple assignments. Addition, subtraction, multiplication and remainder are possible.
For name variables, the "@set" command can perform simple assignments only.
Available operators are:
When the LHS is a local or global variable, "$RAND" can be specified for the RHS to get a random number.
Local variables range from "$0" to "$9999". They are stored independently in each save data file. Global variables range from "$10000" to "$10999". They are stored globally across all save data files. All local and global variables have 32-bit integer values and are initialized as "0".
Name variables range from "%a" to "%z". They are stored independently in each save data file. All name variables have string values and are initialized as an empty string.
See also "Variables".
The following script sets the value of "1" to the variable "$0".
@set $0 = 1
The following script adds the value "23" to the variable "$10".
@set $10 += 23
The following script assigns a random number (from 0 to 2147483647) to the variable "$0".
@set $0 = $RAND
The following script adds the value of the variable "$2" to the variable "$1".
@set $1 += $2
"@set" has a Japanese alias "@フラグをセット".
@フラグをセット $1 = 1
This feature moves the script execution position to the specified label if the specified condition of a preset variable is met. The command that accomplishes this feature is "@if".
@if <variable> <operator> <value> <label>
Available operators are:
Operator | Meaning |
">" | greater than |
">=" | greater than or equal to |
"==" | equal to |
"<=" | less than or equal to |
"<" | less than |
"!=" | not equal to |
LHS must be a variable name (e.g., "$1", "%a").
When the LHS is a local or global variable such as "$1", RHS must be an integer value such as "0" or a local and global variable name such as "$2".
When the LHS is a name variable such as "%a", the RHS is interpreted as a simple string, i.e., variable names in the RHS string will not expanded. In addition, the operators are restricted to "==" and "!=" if the LHS is a name variable.
The following script jumps to the label "abc" if the variable at number 1 is equal to "1".
@if $1 == 1 abc Story when flag is not set. @goto END :abc Story when flag is set. @goto END :END Stories join here.
"@if" has a Japanese alias "@フラグでジャンプ".
@フラグでジャンプ $1 == 1 ラベル
This feature loads a script file. The command that accomplishes this feature is "@load".
@load <file>
Script files need to be in the txt folder.
The following script jumps to the script file "001.txt".
@load 001.txt
"@load" can be written with a parameter name.
@load file=001.txt
"@load" has a Japanese alias "@シナリオ".
@シナリオ ファイル=001.txt
This feature sets a chapter name. The command that accomplishes this feature is "@chapter".
@chapter <title>
The name of the chapter is reflected in the window title and saved data items.
The following script sets the chapter name.
@chapter "Chapter 1"
"@chapter" can be written with a parameter name.
@chapter titile="Chapter 1"
"@chapter" has a Japanese alias "@章".
@章 タイトル="第一章"
This feature calls a subroutine. The command that accomplishes this feature is "@gosub".
@gosub <label>
Note that nested calls of subroutines are not supported.
The following script runs subroutine "SUB".
@gosub SUB @goto END :SUB Describe the process here. @return :END
This feature returns from a subroutine. The command that accomplishes this feature is "@return".
@return
The following script runs subroutine "SUB".
@gosub SUB @goto END :SUB Describe the process here. @return :END
This feature automatically switches the language to be displayed depending on the user's system locale.
To use this feature, a script line must be started with a plus sign.
+en+Hello. +fr+Bonjour.
This is not exactly a command, but it is a prefix to a command.
See also "International Mode" and "Language Mapping".
This feature executes an advanced script called "WMS". The command that accomplishes this feature is "@wms".
@wms <file>
WMS files need to be in the wms folder.
For further details, see the "Advanced Script" section.
The following script executes an advanced script named "sample.scr" in the "wms" folder.
@script sample.scr
"@wms" can be written with a parameter name.
@wms file=001.txt
"@wms" has a Japanese alias "@スクリプト".
@スクリプト ファイル=001.txt
Suika2 has three kinds of variables.
Local and global variables have 32-bit integer values, and are initialized as "0". Name variables have string values, and are initialized as an empty string.
Variables ranging from "$0" to "$9999" are local variables, these are stored in each save data file. Typically, these are used to branch scenarios.
Variables ranging from "$10000" to "$10999" are global variables that are common to all save data files. Typically, these are used to record which pictures should be displayed in the gallery.
Variables ranging from "%a" to "%z" are name variables, these are stored in each save data file. Typically, these are used to record the name of characters.
A seen flag is stored for each message.
Unseen messages cannot be skipped. However, game developers can set an option to modify this behaviour.
The reason why the term "seen" is used instead of "read" is that "read" appears to be an instruction to the computer.
Seen flags are stored in the "sav" folder. They are grouped into individual scripts. The file names of the seen flags are a hex representation of the script file name.
Here, the screen during normal gameplay is referred to as the main screen. See "Special Screens" for other screens.
The main screen has some modes.
This mode changes the background image.
While this mode is active, the message box is not displayed.
This mode changes the character images and the background image.
While the "@ch" command changes one character at a time, the "@chs" command changes 0 or more characters and can optionally change the background.
While this mode is active, the message box is not displayed, however, game developers can optionally set a config to display the message box while this mode is active.
In this mode, text is output one character at a time to the message box.
If the message has a character's name, the name of the character is output to namebox prior to this mode.
When the text output is complete, Suika2 enters "Click Waiting Mode for Message".
When a click or enter key is pressed during text output, Suika2 enters "Click Waiting Mode for Message".
When the control key is pressed, Suika2 moves to the next command.
In this mode, a prompt animation appears and waits for the user to click. If not in auto mode, this mode ends when there is a click or keystroke. If in auto mode, this mode ends when the playback of the voice is completed or the waiting time based on the number of characters has completed.
This mode is not executed when in skip mode and the message is already seen.
This mode proceeds simultaneously alongside other modes. If necessary, game developers can make use of a timed wait for completion of fading.
This mode waits for the specified amount of time in seconds. If a click or keystroke is made, the wait is canceled.
This mode stops action until a user click or keystroke is made. During auto mode, Suika2 resumes after a 2-second pause.
This mode proceeds simultaneously alongside other modes. This mode effects "Click Waiting Mode for Message". See also "Click Waiting Mode for Message".
During this mode, a banner representing auto mode is displayed.
This mode proceeds simultaneously alongside other modes. This mode effects "Click Waiting Mode for Message". See also "Click Waiting Mode for Message".
During this mode, a banner representing skip mode is displayed.
Apart from the main screen (normal layered game screen), there are some special screens.
These special screens are realized by the graphical user interface (GUI) feature.
The save screen is for viewing and recording saved data.
This screen is realized within the GUI file "save.txt".
The number of save slots per page can be determined in "save.txt".
The load screen is for viewing and loading saved data.
This screen is realized within the GUI file "load.txt".
The number of save slots per page can be determined in "load.txt".
The history screen displays a history of seen messages. The maximum number of messages recorded is 100.
End users can click on a line with voice to play the audio.
This screen is realized within the GUI file "history.txt".
The config screen allows end users to set volume, text speed, auto mode speed and font. It also provides a "back to game title logo" button. It may also show a preview of text speed and auto mode speed.
This screen is realized within the GUI file "config.txt".
Graphical user interface (GUI) interacts with the user. It is described by a text file, and it defines various buttons.
GUI is used to realize the special screen mode. Typically, it is also used to implement the title as well as other menus.
Note that in a GUI file, the characters after "#" in a line are ignored and treated as comments.
GUI files have a header. In a header, developers have to define three images; "idle", "hover" and "active".
global { idle: config-idle.png; hover: config-hover.png; active: config-active.png; }
The "idle" image is displayed as a base layer. The "hover" image is displayed when the button area is pointed. The "active" image is displayed when the button is active. Slidebar buttons are always displayed.
This button is used for creating a normal menu.
QUIT { type: goto; label: QUIT; x: 960; y: 497; width: 317; height: 201; pointse: btn-change.ogg; clickse: click.ogg; }
This button is used for creating pagenation within the save/load screen.
PAGE1 { type: savepage; index: 0; x: 1137; y: 0; width: 70; height: 63; pointse: btn-change.ogg; clickse: click.ogg; }
This button is used for creating a save slot.
SAVESLOT1 { type: save; index: 0; x: 50; y: 138; width: 1106; height: 140; margin: 10; pointse: btn-change.ogg; clickse: click.ogg; }
When game developers create the save slot button, they need an extra header item within the GUI file.
saveslot: 3;
This button is used for creating a load slot.
SAVESLOT1 { type: load; index: 0; x: 50; y: 138; width: 1106; height: 140; margin: 10; pointse: btn-change.ogg; clickse: click.ogg; }
When game developers create the load slot button, they need an extra header item within the GUI file.
saveslot: 3;
This button is used for creating a text speed slidebar.
TEXTSPEED { type: textspeed; x: 68; y: 250; width: 266; height: 21; pointse: btn-change.ogg; }
Note that:
This button is used for creating an auto mode speed slidebar.
AUTOSPEED { type: autospeed; x: 68; y: 339; width: 266; height: 21; pointse: btn-change.ogg; }
Note that:
This button is used for displaying a preview of text and auto mode speed.
PREVIEW { type: preview; msg: "This message is a preview of text speed and auto mode speed."; x: 442; y: 453; width: 590; height: 120; }
This button is used for setting the BGM volume.
BGM { type: bgmvol; x: 420; y: 249; width: 266; height: 21; pointse: btn-change.ogg; }
Note that:
This button is used for setting the volume of sound effects.
SE { type: sevol; file: click.ogg; x: 420; y: 339; width: 266; height: 21; pointse: btn-change.ogg; }
Note that:
This button is used for setting the volume of voice (all-characters).
VOICE { type: voicevol; file: 025.ogg; x: 68; y: 498; width: 266; height: 21; pointse: btn-change.ogg; }
Note that:
This button is used for setting the volume of voice (per-character).
See also "Per-character Voice Volume Settings" section.
MIDORI { type: charactervol; index: 1; file: 025.ogg; x: 506; y: 506; width: 266; height: 21; pointse: btn-change.ogg; }
Note that:
This button is used for setting the font.
FONT1 { type: font; file: VL-PGothic-Regular.ttf; x: 770; y: 328; width: 87; height: 30; pointse: btn-change.ogg; clickse: click.ogg; }
When there are multiple font buttons, the active image is displayed for the selected font.
This button is used for setting full screen mode.
FULLSCREEN { type: fullscreen; x: 750; y: 206; width: 200; height: 25; pointse: btn-change.ogg; clickse: click.ogg; }
When there are full screen and window buttons, the active image is displayed for the selected one.
This button is used for setting window mode.
WINDOW { type: window; x: 995; y: 206; width: 200; height: 25; pointse: btn-change.ogg; clickse: click.ogg; }
When there are full screen and window buttons, the active image is displayed for the selected one.
This button is used for resetting options.
DEFAULT { type: default; x: 1131; y: 61; width: 115; height: 40; pointse: btn-change.ogg; clickse: click.ogg; }
This button is used for moving to another GUI.
PAGE2 { type: gui; file: system-page2.txt; x: 1234; y: 132; width: 35; height: 35; pointse: btn-change.ogg; clickse: click.ogg; }
This button is for jumping to the title screen. Before the jump, a Yes/No dialog is displayed.
TITLE { type: title; file: init.txt; x: 1007; y: 652; width: 109; height: 25; pointse: btn-change.ogg; clickse: click.ogg; }
This button closes a GUI screen.
BACK { type: cancel; x: 1156; y: 653; width: 103; height: 21; pointse: btn-change.ogg; clickse: click.ogg; }
This button is visible when the specified variable is non-zero. This feature is for the gallery mode.
CG1 { type: gallery; label: CG1; var: $10000; x: 1156; y: 653; width: 103; height: 21; pointse: btn-change.ogg; clickse: click.ogg; }
This button shows the string content of a name variable. This feature is for name input screens.
NAMEVAR { type: namevar; namevar: a; x: 1156; y: 653; width: 103; height: 21; }
This button adds a string to a name variable. This feature is for name input screens.
There are some special values for "msg" property:
CHAR_A { type: char; namevar: a; msg: A; max: 6; x: 1156; y: 653; width: 103; height: 21; pointse: btn-change.ogg; clickse: click.ogg; }
Suika2 has a configuration file that allows customization of the application. The configuration file consists of "key=value" lines. Some keys are required and some are optional.
Note that configuration lines beginning with "#" are ignored and treated as comments.
Suika2 only provides game developers with Japanese and English error messages. However, it can offer multiple-language stories to end users according to their system locale.
This is the ability to display messages in a specific language when a specific system locale is set.
For example, "language.ja=en" is an indication that the message is to be displayed in English when the system locale is Japanese.
The default language mappings are as follows (all locales fall back to English).
language.en=en language.fr=en language.de=en language.es=en language.it=en language.el=en language.ru=en language.zh=en language.tw=en language.ja=en language.other=en
Here, a window is the drawable area of the screen.
This is the application title.
On a desktop operating system, a window may have a title. In such an environment, this application title becomes the first half of the window title. The second half of the window title is the chapter name, but this is omissible by a config.
window.title=Suika
This is the width and height of the window.
window.width=1280 window.height=720
Game developers can choose whether the window background should be white or black.
window.white=1
On Windows, Suika2 can have a menu bar. Game developers can decide whether the window has a menu bar or not.
window.menubar=1
This is the font file name. Font files are stored in the "font" folder.
font.file=VL-PGothic-Regular.ttf
This is the font size in pixels. The font size is applied to name, message, history and save item text.
font.size=30
It is possible to specify the base color of the text as well as the outline color.
font.color.r=255 font.color.g=255 font.color.b=255 font.outline.color.r=128 font.outline.color.g=128 font.outline.color.b=128
Game developers can choose whether or not to display font outlines.
font.outline.remove=0
This is the image file name of the namebox. The file is stored in the "cg" folder.
namebox.file=namebox.png
This is the position at which to show the namebox.
namebox.x=95 namebox.y=480
This is the top margin of text in the namebox image.
namebox.margin.top=11
This is the left margin of text in the namebox image.
Game developers can choose whether or not to center the character name in the namebox.
namebox.centering.no=0
Game developers can choose whether or not to show the namebox at all.
namebox.hidden=0
The message box is made up of a background and foreground image. The foreground image is used for utilizing an in-box menu such as a hide button.
msgbox.bg.file=msgbox-bg.png msgbox.fg.file=msgbox-fg.png
This is the position at which to show the message box image.
msgbox.x=43 msgbox.y=503
msgbox.margin.left=80 msgbox.margin.top=50 msgbox.margin.right=80 msgbox.margin.line=40
Game developers can set the number of characters of text to be displayed per second.
msgbox.speed=40.0
The message box can have a hide button. This is optional.
msgbox.btn.hide.x=1146 msgbox.btn.hide.y=16 msgbox.btn.hide.width=29 msgbox.btn.hide.height=29
The message box can have a save button. This is optional.
msgbox.btn.save.x=1146 msgbox.btn.save.y=16 msgbox.btn.save.width=29 msgbox.btn.save.height=29
The message box can have a load button. This is optional.
msgbox.btn.load.x=1146 msgbox.btn.load.y=16 msgbox.btn.load.width=29 msgbox.btn.load.height=29
The message box can have a qsave button. This is optional.
msgbox.btn.qsave.x=1146 msgbox.btn.qsave.y=16 msgbox.btn.qsave.width=29 msgbox.btn.qsave.height=29
The message box can have a qload button. This is optional.
msgbox.btn.qload.x=1146 msgbox.btn.qload.y=16 msgbox.btn.qload.width=29 msgbox.btn.qload.height=29
The message box can have an auto button. This is optional.
msgbox.btn.auto.x=1146 msgbox.btn.auto.y=16 msgbox.btn.auto.width=29 msgbox.btn.auto.height=29
The message box can have a skip button. This is optional.
msgbox.btn.skip.x=1146 msgbox.btn.skip.y=16 msgbox.btn.skip.width=29 msgbox.btn.skip.height=29
The message box can have a history button. This is optional.
msgbox.btn.history.x=1146 msgbox.btn.history.y=16 msgbox.btn.history.width=29 msgbox.btn.history.height=29
The message box can have a config button. This is optional.
msgbox.btn.config.x=1146 msgbox.btn.config.y=16 msgbox.btn.config.width=29 msgbox.btn.config.height=29
The message box has sound effects.
msgbox.btn.change.se=btn-change.ogg msgbox.history.se=click.ogg msgbox.config.se=click.ogg msgbox.hide.se=click.ogg msgbox.show.se=click.ogg msgbox.auto.cancel.se=click.ogg msgbox.skip.cancel.se=click.ogg
The game developer can decide whether unseen text can be skipped. Skipping includes skip mode and control key skip.
msgbox.skip.unseen=1
Game developers can dim the seen messages. This is useful for the full-screen novel mode (NVL).
msgbox.dim=1 msgbox.dim.color.r=80 msgbox.dim.color.g=80 msgbox.dim.color.b=80 msgbox.dim.color.outline.r=40 msgbox.dim.color.outline.g=40 msgbox.dim.color.outline.b=40
The click-waiting prompt that appears above the message box is a click animation.
This is the position at which to show the click animation image.
click.x=1170 click.y=660
The click animation is usually displayed at a fixed position, but it can also be displayed at the end of the text. This is useful when making a full screen style novel.
click.move=1
The first one is required, and others are optional.
click.file1=click1.png click.file2=click2.png click.file3=click3.png click.file4=click4.png click.file5=click5.png click.file6=click5.png
This is the click animation interval in second.
click.interval=1.0
Developers can hide the click animation. This is mainly for the visually impaired.
click.interval=1.0
There are background and foreground images for an option box. The background image is displayed by default, but when the option box is pointed by the mouse, the foreground image is displayed.
switch.bg.file=switch-bg.png switch.fg.file=switch-fg.png
This is the position of the first option box.
switch.x=406 switch.y=129
This is the vertical space between the option box images.
switch.margin.y=20
This is the top margin of text in the option box image.
switch.text.margin.y=18
This is the color of pointed option's text.
switch.color.active=0 switch.color.active.body.r=255 switch.color.active.body.g=0 switch.color.active.body.b=0 switch.color.active.outline.r=128 switch.color.active.outline.g=128 switch.color.active.outline.b=128"
Options can have sound effects.
switch.parent.click.se.file=click.ogg switch.child.click.se.file=click.ogg switch.change.se=btn-change.ogg
Most of the settings for save/load screens are defined within their GUI files. Here, we have just one configuration.
This is the thumbnail size of the save data.
save.data.thumb.width=213 save.data.thumb.height=120
This is the position to show the system menu image.
sysmenu.x=731 sysmenu.y=29
The system menu has three images; "idle", "hover", "disable". "idle" is the base image. "hover" is displayed when the button area is pointed. "disable" is displayed when the button is disabled.
sysmenu.idle.file=sysmenu-idle.png sysmenu.hover.file=sysmenu-hover.png sysmenu.disable.file=sysmenu-disable.png
The following buttons are available:
The following is the example for "qsave".
sysmenu.qsave.x=62 sysmenu.qsave.y=7 sysmenu.qsave.width=60 sysmenu.qsave.height=58
The system menu can have sound effects.
sysmenu.enter.se=click.ogg sysmenu.leave.se=click.ogg sysmenu.change.se=btn-change.ogg sysmenu.qsave.se=click.ogg sysmenu.qload.se=click.ogg sysmenu.save.se=click.ogg sysmenu.load.se=click.ogg sysmenu.auto.se=click.ogg sysmenu.skip.se=click.ogg sysmenu.history.se=click.ogg sysmenu.config.se=click.ogg
This is the position at which to show the collapsed system menu image. The collapsed system menu is usually displayed, and when it is clicked (expanded), the system menu is displayed.
sysmenu.collapsed.x=1219 sysmenu.collapsed.y=29
THe collapsed system menu has two images; "idle" and "hover".
sysmenu.collapsed.idle.file=sysmenu-collapsed-idle.png sysmenu.collapsed.hover.file=sysmenu-collapsed-hover.png
The collapsed system menu can have a sound effect.
sysmenu.collapsed.se=btn-change.ogg
Game developers can decide whether the collapsed system menu and system menu are visible.
sysmenu.hidden=0
Note: This will take effect when displaying messages. When displaying options, the collapsed system menu or system menu are always shown, this is because of a lack of a way to save without the system menu.
Suika2 shows the auto mode banner when auto mode is enabled.
This is the banner image.
automode.banner.file=auto.png
This is the banner position.
automode.banner.x=0 automode.banner.y=126
This is the speed of auto mode. The wait time for the message is "automode.speed" seconds per character.
automode.speed=0.15
Suika2 shows skip the mode banner when skip mode is enabled.
This is the banner image.
skipmode.banner.file=skip.png
This is the banner position.
skipmode.banner.x=0 skipmode.banner.y=186
These are the sound volume values for initial boot time. If a user has the save data, then the volume settings in the save data will be used instead of the initial sound volumes.
sound.vol.bgm=1.0 sound.vol.voice=1.0 sound.vol.se=1.0 sound.vol.character=1.0
If the character name of a line matches to one from the name list, then the respective per-character volume will be applied.
Per-character volumes can be set in the config screen. (#0 to #15) See also "Voice (Per-character) Volume Slider" section.
Developers can specify the names for up to 15 characters. (#1 to #15)
If the character name of the message doesn't match a name from the name list, then the #0 per-character volume will be used.
The following is an example of name list.
sound.character.name1=Midori
Game developers can specify text colors for up to 64 characters. Colors are defined for each character by name.
To use character message colors, write the following.
serif.color1.name=Haruka serif.color1.r=255 serif.color1.g=200 serif.color1.b=200 serif.color1.outline.r=0 serif.color1.outline.g=0 serif.color1.outline.b=0
These are detailed config items according to individual user requirements.
This option enables voice continuation on click. Normally, voice playback is stopped before moving on to the next command, but this option suppresses this behaviour.
See alose "Showing a Line" section.
To enable this, write the following line in the config:
voice.stop.off=1
This option disables full screen mode. If game developers don't want to allow full screen mode, write the following line.
window.fullscreen.disable=1
This option disables window maximization. If game developers don't want to allow maximization of the window, write the following line.
window.maximize.disable=1
The window title consists of the application title and the chapter name. This separator is added between the application title and the chapter name.
To set the separator, write the following line. Note that there is a space after "=".
window.title.separator=
Game developers can decide whether to show chapter names in the window title.
To hide the chapter name from the window title, write the following line.
window.title.chapter.disable=1
By default, the message box disappears while characters are changing. With this option, developers can decide whether to display the message box while character is changing.
To enable this option, write the following line.
msgbox.show.on.ch=1
This mode is used for installing games to the "Program Files" path on Windows. If this configuration is enabled, save data will be stored in OS-specific locations such as "AppData" on Windows and "Library" on macOS.
To enable release mode, write the following line.
release=1
Initial values for text speed and auto mode speed cannot be set. The default value for these is "0.5".
Package is an archive file that contains all game data except video files. The package file name is "data01.arc".
To generate a package file, developers can use the "pack" program or "Suika2 Pro for Creators".
The obfuscation key is stored in "key.h", and developers can change the value for their games.
To use a package file, put it in the folder that contains a Suika2 application (app folder). Game data folders (e.g., "bg", "ch", "bgm" and etc.) must be excluded from the app folder. If the game data folder exists in the app folder, Suika2 uses the files in the game data folder instead of the files in the package file.
Script files, GUI files and config file are plain text files.
Text files must be encoded in UTF-8.
CR+LF, LF and CR are accepted. These can be mixed.
PNG and JPEG are supported. Note that gray scaled JPEG images are not supported.
The only accepted format is Ogg Vorbis 44.1kHz stereo or monaural.
On Windows, ".wmv" is the recommended format. AVI with H.264 and AAC will work on Windows 10 or later.
On macOS, ".mp4" with H.264 and AAC is the recommended format. QuickTime (".mov" or ".qt") will work too.
On Linux, any format supported by Gstreamer will work. Game developers must instruct end users to install the neccesary Gstreamer plugin.
In the future, there are plans to move to ".mp4" with H.264 and AAC on all platforms.
A script stored in the "txt" folder is called "Suika2 Script", which is simple script for novelists, consisting of text and commands.
On the other hand, a script stored in the "wms" folder is called "WMS", which is script for more advanced programming.
WMS stands for "Watermelon Script".
This section describes the grammar of WMS.
A program starts from "main()" function.
func main() { // This is a comment. print("Hello, world!"); }
A function can call other functions.
func main() { foo(0, 1 2); } func foo(a, b, c) { return a + b + c; }
Indirect calling by string variable is allowed.
func main() { myfunc = "foo"; myfunc(0, 1 2); } func foo(a, b, c) { return a + b + c; } func myfunc(a, b, c) { // This function will not be called because foo() will be called in main(). }
A program can handle integer, floating point, string and array type variable/values.
func main() { // Integer a = 1; if(isint(a)) { print("a is int"); } // Floating point b = 1.0; if(isfloat(b)) { print("b is float"); } // String c = "string"; if(isstr(c)) { print("c is string"); } // Array (integer key) d[0] = 0; if(isarray(d)) { print("d is array"); } // Array (string key) e["abc"] = 0; if(isarray(e)) { print("e is array"); } // Array of array f["key"] = e; }
To repeat for a specified times:
func main() { for(i in 0..9) { print(i); } }
To repeat for each value in an array:
func main() { a[0] = 0; a[1] = 1; a[2] = 2; for(v in a) { print(v); } }
To repeat for each key-value pair in an array:
func main() { a["key1"] = 0; a["key2"] = 1; a["key3"] = 2; for(k, v in a) { print(k + "=" + v); } }
To create a normal "while" loop:
func main() { a = 10; while (a > 0) { print(a); a = a - 1; } }
To use "break" or "continue" in a "for" or "while" loop:
func main() { for(i in 0..9) { if(i == 2) { continue; } if(i == 7) { break; } print(i); } }
A program can branch by "if" - "else if" - "else" syntax.
func main() { a = foo(); if(a > 10) { print("a > 10"); } else if(a > 5) { print("a > 5"); } else if(a == 3) { print("a == 3"); } else if(a != 4) { print("a != 4"); } else { print("else"); } }
func foo() { return 6; }
An array element has a key, and the key must be one of integer, floating point and string. Keys of integer, floating point and string can be mixed.
To create an array, assign a value with "[key]" syntax.
func main() { a[0] = 0; print(a); }
To remove an array element, use "remove()".
func main() { a[0] = 0; remove(a, 0); print(a); }
To get the size of an array, use "size()".
func main() { a[0] = 0; print(size(a)); }
Integer to string:
s = "" + 123;
Floating point to string:
s = "" + 1.23;
Integer to floating point:
f = 0.0 + 123;
String to integer:
i = 0 + "123";
String to floating point:
f = 0.0 + "1.23";
The Suika2 engine provides predefined functions to manipulate the engine. These functions have the prefix "s2_" for their names.
"s2_get_variable()" accepts an local and variable index and returns the integer value of the variable.
value = s2_get_variable(100);
"s2_set_variable()" accepts an local and global variable index and a integer value. It changes the value of the local or global variable.
s2_set_variable(100, 1);
"s2_get_name_variable()" accepts a name variable index ("0"-"26") and returns the string value of the name variable.
name = s2_get_name_variable(0);
"s2_set_name_variable()" accepts a name variable index ("0"-"26") and a string value. It changes the value of the name variable.
s2_set_name_variable(0, "abc");
"s2_random()" returns a random integer The return value ranges from "0" to "99999".
value = s2_random();
The following function overwrites a configuration:
s2_set_config(): accepts a string key and a string value.
In some cases, overwriting configurations do not take effect immediately, so a WMS code should call "s2_reflect_*_config()" to reflect the changes.
// These will be reflected immediately. s2_set_config("msgbox.x", "0"); s2_set_config("msgbox.speed", "20.0"); // These will not be reflected immediately. s2_set_config("msgbox.bg.file", "msgbox-bg.png"); s2_set_config("msgbox.fg.file", "msgbox-fg.png");
s2_reflect_msgbox_and_namebox_config() reflects the configuration changes to the message box and the namebox.
s2_reflect_msgbox_and_namebox_config();
s2_clear_history() clears the message history.
s2_clear_history();
s2_clear_msgbox() clears the message box.
s2_clear_msgbox();
s2_clear_namebox() clears the name box.
s2_clear_namebox();
s2_hide_msgbox() hides the message box.
s2_hide_msgbox();
s2_hide_msgbox() hides the message box.
s2_hide_msgbox();
s2_save_global() saves global data immediately.
s2_save_global();
s2_push_stage() preserves stage state. It is used by user defined menu.
s2_push_stage();
s2_pop_stage() restores stage state. It is used by user defined menu.
s2_pop_stage();
s2_remove_local_save() removes a local save file. The parameter indicates an index of save data to remove. If -1 is specified, a quick save data will be removed.
s2_remove_local_save(0);
s2_remove_global_save() removes a global save file.
s2_remove_global_save();
Suika2 binaries are applications that run natively on the target platform. This is based on the idea of achieving the fastest possible speed of operation.
Suika2 can only use CPU time within the range that the OS determines Suika2's CPU utilization to be "low".
The evaluation is based on the 6th generation Core i7 and its built-in GPU.
Suika2 needs to speed up vector operations as much as possible.
On Intel/AMD platforms, Suika2 supports SSE, SSE2, SSE3, SSE4.1, SSE4.2, AVX and AVX2. Suika2 automatically chooses the fastest extension. Currently, AVX512 is not supported because of the lack of a test machine.
On a desktop OS, Suika2 uses GPU acceleration when possible, otherwise it falls back to 2D rendering for compatibility purposes.
On other environments, Suika2 will always use GPU acceleration because the CPU may not be powerful enough.
Suika2 uses its own 2D rendering engine if GPU acceleration is not available, however, this fallback will be removed in the future.
Note that offscreen renderings are not GPU accelerated and done by 2D rendering.
The frame rate is set as high as 60 fps, within the range that the OS determines Suika2's CPU utilization to be "low".
On Windows and Linux, if the GPU acceleration is enabled, the target frame rate is 60fps, and if not, 30fps.
On macOS, the target frame rate is 30fps.
On iOS and Android, the frame rate is determined by OpenGL View of the OS.