• With over 20,000 games created, The most widely used novel game engine.

Live2Dとは


>>Live2D Official


Live2D is a technology that allows 2D images to be smoothly animated.
It has recently become popular in games and with VTubers.

Live2D × Tyrano Sample Game

Get the Sample Game Project File

*The sample project does not include `live2dcubismcore.min.js`. Please refer to the instructions on this page to download and place it in the `driver` folder, otherwise the plugin will not work.

License

The TyranoScript engine and the Live2D plugin can be used free of charge.

This plugin uses the Live2D Cubism SDK. If you use this plugin to create a game, you must agree to the Live2D Proprietary License.
https://www.live2d.jp/terms/live2d-proprietary-software-license-agreement/

This agreement is presented when you download Cubism Core for Web during the installation process.

Also, if you plan to release a game using this plugin, you must agree to the SDK Release License.

Check the Live2D SDK Release License

As of October 2020, individuals, students, circles, and small businesses with recent sales of less than 10 million yen can release their works for free.

Moreover, the Live2D model included in this plugin can be used in accordance with Live2D’s official guidelines.

[Guidelines] https://docs.live2d.com/cubism-editor-manual/sample-model/

Usage & Tutorial

Get the Latest live2d_tyrano_plugin_v410 Plugin (2024/2/13)

Get live2d_tyrano_plugin_v401 Plugin (2021/1/24)

Download one of the Live2D plugins above and extract it to a suitable location.

Next, download the development library from the official Live2D site. Access the following URL:

https://www.live2d.com/download/cubism-sdk/download-web/

Be sure to download "Cubism Core for Web". Please take care to get the correct file.



Copy the obtained files into the following directory inside the plugin you downloaded earlier:
live2d/driver


Next, place the entire live2d folder into your Tyrano project at:
data/others/plugin



Then, in your first.ks file, add:

[plugin name="live2d"]


Next, in your make.ks file, add:

[live2d_restore ]


With this, Live2D is ready to be used with TyranoScript.

(Note: The line in make.ks is required in order to restore the Live2D model on load.)

For more details about the available tags and how to use them, it’s recommended to download the sample game above and review its script.

Preparing and Displaying Model Data

Place your Live2D model data inside the folder: data/others/plugin/live2d/model.

The name of the directory is the model ID.
In the image above, the model ID is “Haru”.

Now, you can display the Live2D model simply by writing the following tags:


[live2d_new name="haru" model_id="Haru" ]

; Display the Live2D model
[live2d_show name="haru" y=-0.8 x=0 scale=2.5 ]



That’s all it takes to display the model. Simple, isn’t it?

Note: Coordinate settings in Tyrano are very different here.
The center of the screen is x=0, y=0. Coordinates are not in pixels but in decimal values between -1 and 1.

Motion Settings

You can control Live2D animations at any desired timing.
To play an animation, use the [live2d_motion] tag.

Check the model data in a text editor to find the available motion names. For example, if the model ID is “Haru”,
open the file Haru.model3.json in a text editor.

Inside the file, you will find sections linking to motion files.



Specify the Name in the [live2d_motion] tag to control motion playback.

In this example, motion names include “Idle”, “Idle2”, “TapBody”, and “Test”.

Note that “Idle” refers to the default standing motion.

So, to play the “TapBody” motion, use:

[live2d_motion name="haru" mtn="TapBody" ]

This will play the TapBody motion.

Also, “TapBody” may include multiple motions in an array.
By default, the first motion is played, but you can specify another one using: [live2d_motion name="haru" mtn="TapBody" no=2 ]
Setting no=2 will play the second motion in the TapBody array (index starts at 0).

You can also change facial expressions using the [live2d_expression] tag.
Specify a name that is linked under the Expression section in the JSON file.
[live2d_expression name="haru" expression="f07"]

■ About Idle Motions
The motion that plays by default when the character is standing is “Idle”.
The motions set under “Idle” are played randomly in a loop.

To change the idle motion, use the [live2d_mod] tag:

[live2d_mod name="haru" idle="Test" ]

About Mouth Movement

You can animate the character’s mouth while they are speaking.
Note that the model must support lip-sync.

First, when using [live2d_new], enable the lip-sync feature and specify the character’s display name using lip="text" and jname="Haru".

[live2d_new name="haru" model_id="Haru" lip=text jname="Haru"]
Then, if the name specified in the dialogue matches the jname, the mouth will animate while speaking.

[live2d_new name="haru" model_id="Haru" lip=true jname="Haru"]
#Haru
Haru is talking now.[p]
Am I speaking clearly?[p]

You can also adjust the mouth movement speed and other parameters, so be sure to experiment.

■Lip-sync with voice audio

It is also possible to sync mouth movements to voice audio.

This feature is supported from Live2D plugin version 401 and TyranoScript version V506 and later.

When defining the model, set lip="sound".
Optionally, you can specify which audio buffer (buf) to respond to using the lip_se parameter.
[live2d_new name="haru" model_id="Haru" lip="sound" lip_se="1" jname="Haru"]

In this example, the model will respond to sounds played with [playse buf=1 storage="voice.mp3"].

⚠️ Important: Without restrictions, the model may respond to all sounds, including background music (BGM).

To prevent BGM from triggering lip-sync, write it like this:

[playbgm storage="music.mp3" html5="true"]
When html5="true" is set, the sound will be ignored by the lip-sync system. This also applies to sound effects:

[playse storage="door.mp3" html5="true"]

With this setup, sounds will not trigger lip-sync.

Solution for Live2D Model Displaying in Front of the Message Window

When the game screen is enlarged beyond its default size,
sometimes the Live2D model appears in front of the message window.

As a solution:
1. Set the game screen size to be larger.

Or

2. Edit tyrano.css.

Open the file tyrano/tyrano.css in an editor and delete the line that contains 'position: absolute;'. .tyrano_base{
-moz-user-select: none;
-webkit-user-select: none;
-khtml-user-select: none;

position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}

However, note that with method ②, screen centering and camera functions will no longer work. Please be aware of this limitation.

Live2D Tag Reference


[live2d_new] Define Live2D Model

  • Live2D

Loads a Live2D model.
The model is not displayed on screen immediately after executing [live2d_new].
To display it, use [live2d_show] afterwards.

ParameterRequiredDescription
name × Specifies the model name. If omitted, the value of model_id will be used as the name.
model_id × Specifies the model ID. The folder name placed under the "model" directory is the model ID. All related files (e.g., ○○.model3.json) must have the same name.
idle × Specifies the name of the idle motion. The default is "Idle". If multiple motions are set, they play randomly.
scale × Specifies the scale of the model when displayed. For example, setting it to 1.5 scales the model to 1.5 times its size. Default is 1.
x × Specifies the horizontal position. Note that the center of the screen is 0, which differs from other TyranoScript coordinates.
y × Specifies the vertical position. The center of the screen is 0, so this differs from other TyranoScript positioning.
lip × Specifies whether the character's mouth should move when speaking. Set to "text" to sync with dialogue text, or "sound" to sync with voice. Note: this reacts to all playing audio. To prevent syncing with BGM, set html5="true" in [playbgm]. Only works with models that support lip-sync.
lip_time × Sets the speed of mouth movement. Default is 100. Lower values make the mouth move faster.
lip_se × If using lip="sound", specify the sound effect buffer (buf) to react to. Default is 0.
lip_sound_level × If using sound for lip-sync, this sets the max waveform level that maps to full mouth movement. Default is 4000. Adjust this value for best results.
breath × Set to true or false. Default is true. When true, an idle breathing motion is applied. Set to false to disable.
jname × Specifies the character's display name. Required for mouth movement. The mouth moves only when the displayed speaker name matches this value via #○○.
  • Sample Code

[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]


[live2d_show] Display Live2D Model

  • Live2D

Displays the Live2D model on the game screen.
The model must be preloaded using the [live2d_new] tag before it can be shown.

ParameterRequiredDescription
name × Specifies the model name.
idle × Changes the idle motion. If multiple motions are set, they will loop randomly.
scale × Specifies the model's scale when displayed. For example, setting 1.5 scales the model to 1.5 times its size. Default is 1.
x × Sets the horizontal position of the model. Note that the center of the screen is 0, which differs from other TyranoScript positioning.
y × Sets the vertical position of the model. As with X, 0 is the center of the screen, so be aware it differs from typical TyranoScript coordinates.
  • Sample Code

[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]


[live2d_mod] Modify Live2D Model

  • Live2D

Changes parameters of the Live2D model.

ParameterRequiredDescription
name × Specifies the model name.
idle × Changes the idle motion.
scale × Specifies the scale of the model. For example, setting 1.5 enlarges the model to 1.5 times its size. Default is 1.
x × Sets the horizontal position of the model. Note that the center of the screen is 0, which differs from other TyranoScript coordinates.
y × Sets the vertical position of the model. As with X, 0 is the center of the screen, so be aware it differs from typical TyranoScript settings.
  • Sample Code

[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]

[live2d_mod name="haru" scale=1 ]



[live2d_delete_all] Delete All Live2D Models

  • Live2D

Completely deletes all Live2D models.
To use the models again, you will need to redefine them using [live2d_new].
Live2D models use a lot of memory, so it's not recommended to define many of them at once.
Use [live2d_delete_all] at appropriate intervals to clear memory and ensure stable performance.
This tag is especially useful in games that use many Live2D models.

ParameterRequiredDescription
No parameters available.
  • Sample Code

[live2d_delete_all]


[live2d_hide] Hide Live2D Model

  • Live2D

Hides the Live2D model from the screen.
To display it again, simply use [live2d_show].

ParameterRequiredDescription
name × Specify the name of the model to hide.
  • Sample Code

[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]

[live2d_hide name="haru" ]

[live2d_show name="haru" ]



[live2d_motion] Play Live2D Model Motion

  • Live2D

Plays a motion animation on the Live2D model.

ParameterRequiredDescription
name × Specify the name of the model.
mtn × Specifies the motion to play.
no × Specify the group index. Use this when multiple motion files are assigned to the same motion name. Default is 0.
force × Set to true or false. If true, the new motion will forcibly override the currently playing motion. Default is true.
  • Sample Code

[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]

[live2d_motion name="haru" mtn="Test" no=0 ]


[live2d_expression] Change Live2D Model Expression

  • Live2D

Changes the facial expression (Expression) of the Live2D model.

ParameterRequiredDescription
name × Specify the name of the model.
expression × Specify the expression to apply.
  • Sample Code

[live2d_new name="haru" model_id="Haru" ]
[live2d_show name="haru" y=-0.8 x=-0.3 scale=2.5 ]

[live2d_expression name="haru" expression="f03" ]


[live2d_restore] Restore Live2D Model

  • Live2D

This tag is used to restore Live2D models when loading from save data.
Be sure to include it in make.ks. Without this tag, models cannot be restored properly upon loading.

ParameterRequiredDescription
No parameters available
  • Sample Code

[live2d_restore ]


[live2d_fadein] Fade In Live2D Display Layer

  • Live2D

Fades in the Live2D display layer.
To ensure smooth visual presentation, first hide the layer using [live2d_fadeout],
then fully initialize the Live2D model using [live2d_new],
and finally call [live2d_fadein] to reveal the model.

ParameterRequiredDescription
time×Duration of the fade-in, in milliseconds. Default is 1000ms.
wait×Whether to wait for the fade-in to complete. Default is true.
  • Sample Code

[live2d_fadein time=2000 ]


[live2d_fadeout] Fade Out Live2D Display Layer

  • Live2D

Fades out the Live2D display layer.
Note: The model will remain hidden until you explicitly call [live2d_fadein] again.

ParameterRequiredDescription
time×Specify the duration of the fade-out in milliseconds. Default is 1000ms.
wait×Specify whether to wait until the fade-out is complete. Default is true.
  • Sample Code

[live2d_fadeout time=2000 ]


関連情報