[[Tutorial for ver.3]]


* Record and play character movements (saved in MySQL) [#rfc4309f]

In this scene, you can record and play back the movement of characters and some objects to MySQL.

** MySQL environment construction [#be7e0a5b]

If you are using MySQL, you need to go through a few steps first.

First, build MySQL Server. The details are omitted, but the outline is as follows.

+ Install MySQL Server. The version has been confirmed in [8.0.15]. ~
You can download MySQL related information from [[here] https://dev.mysql.com/downloads/]]. (Archived Versions [[here>https://downloads.mysql.com/archives/]]) ~
It is also convenient to install MySQL Workbench.
+ Create a Schema (database) named "sigverse".
+ Create a MySQL user with update privileges for "sigverse".
+ Create a table called “playbacker_motion_data” under “sigverse”. ~
The table creation script is as follows.
 CREATE TABLE `playbacker_motion_data` (
   `recording_id` int (11) NOT NULL,
   `elapsed_time` int (11) NOT NULL,
   `data_type` int (11) NOT NULL,
   `motion_data` text NOT NULL,
   PRIMARY KEY (`elapsed_time`,` data_type`, `recording_id`)
 ) ENGINE = InnoDB DEFAULT CHARSET = utf8;


Also, set MySQL to use SIGVerse setting screen.

+ Click [SIGVerse]-[SIGVerse Settings] in the Unity editor to open the SIGVerse settings screen.
+ Check [Use MySQL] in [Define symbols Settings].

#ref(UseMySQL.png)

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

+ Access [[Download Site>https://downloads.mysql.com/archives/c-net/]] of Connector / NET. (Archived Versions)
+ Select [8.0.15] for [Product Version], [.NET & Mono] for [Operating System], and click [Download].
+ Drag and drop MySql.Data.dll and Google.Protobuf.dll in the "v4.5.2" folder after unzipping the zip file under [Assets/Plugins] on the [Project] tab of the Unity editor. 
+ Check that the Unity Editor error is gone.

#ref(MySQLLibrary.png)


** Startup procedure [#t3463616]

Start the [Assets/SIGVerse/SampleScenes/Playbacker/Playbacker(.unity)] scene with reference to [[here>Tutorial for ver.3#open_scene]].


** Recording to MySQL [#kb03705c]

+ Select [Database Recorder] for Mode.
+ Make some settings such as [Unique ID] and database connection information.
+ Click the [Start] button to start recording to MySQL.
+ Operate the character with the four-way controller. ~
(Click [Baby icon] to show/hide the panel.)
+ Click the [Stop] button to stop recording to MySQL.

#ref(PlaybackDatabaseRecording.png)


** Playback from MySQL [#e12bcc33]

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

#ref(PlaybackDatabasePlaying.png)

Front page   New List of pages Search Recent changes   Help   RSS of recent changes