Tutorial for ver.3

Record and Play Character Movements (Save to MySQL)

In this example, you can use MySQL to record and play back the movements of characters and some objects.

Setting up MySQL Environment

If you want to use MySQL, you will need to build a MySQL Server. The details are omitted, but the outline is as follows.

  1. Install MySQL Community Server. Operation confirmed with version [8.0.25].
    You can download MySQL product from here. (Archived Versions here)
    It can be installed using the MySQL Installer for Windows.
    • Setup Type: Developer Default
    • MySQL Root Password: Any
  2. Connect to the MySQL Server using MySQL Workbench.
  3. Paste the following command into the Query field.
    CREATE DATABASE sigverse;
    
    CREATE USER sigverse@'%' IDENTIFIED BY 'sigverse';
    
    GRANT ALL ON sigverse.* TO sigverse@'%';
    
    USE sigverse;
    
    CREATE TABLE `playbacker_motion_data` (
      `recording_id` int NOT NULL,
      `elapsed_time` int NOT NULL,
      `data_type` int NOT NULL,
      `motion_data` text NOT NULL,
      PRIMARY KEY (`elapsed_time`,`data_type`,`recording_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
  4. Execute [Query]-[Execute (All or Selection)].

In the SIGVerse setting window, set to use MySQL.

  1. Click [SIGVerse]-[SIGVerse Settings] in the Unity menu to open the SIGVerse setting window.
  2. Check [Use MySQL] in [Define symbols Settings].
UseMySQL.png

Since an error occurs in the [Console] tab of the Unity editor, add the MySQL library to the Unity editor.

  1. Access Download Site(Archived Versions) of Connector/NET.
  2. Select [8.0.15] for [Product Version], [.NET & Mono] for [Operating System], and click [Download]. *NOT 8.0.25.
  3. When you unzip the downloaded zip file, confirm that MySql.Data.dll and Google.Protobuf.dll exist in the "v4.5.2" folder.
  4. Copy the two files by drag and drop into [Assets/Plugins] on the [Project] tab.
  5. Confirm that the error on the [Console] tab has disappeared.
MySQLLibrary.png

Startup Procedure

Follow the steps below to run the Unity example scene.

  1. Open the SIGVerse project in Unity.
  2. Double-click [Assets/SIGVerse/ExampleScenes/Playbacker/Playbacker(.unity)] on the [Project] tab to open the target scene.
  3. Click the play button at the top center of the Unity to play the scene.

Recording to MySQL

  1. Select [Database Recorder] for Mode.
  2. Make some settings such as [Unique ID] and database connection information(User, Password).
  3. Click the [Start] button to start recording to MySQL.
  4. Operate the character with the arrow keys.
    (Click [Baby icon] to show/hide the panel.)
  5. Click the [Stop] button to stop recording to MySQL.

Unity (The details may differ from the latest version)

PlaybackDatabaseRecording.png

Playback from MySQL

  1. Select [Database Player] for Mode.
  2. Set the same database connection settings and [Unique ID] set in the above recording procedure.
  3. Press the [Start] button to start playback.
    (Click [Baby icon] to show/hide the panel.)
  4. When the [Stop] button is pressed or the recording time elapses, playback ends.

Unity (The details may differ from the latest version)

PlaybackDatabasePlaying.png

Reference Video


Attach file: fileMySQLLibrary.png 506 download [Information] fileUseMySQL.png 500 download [Information] filePlaybackDatabaseRecording.png 495 download [Information] filePlaybackDatabasePlaying.png 499 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2021-08-18 (Wed) 02:32:26 (981d)