Upgrading from v1.4.1
Learn all you need to know about upgrading your game!
Last updated
Learn all you need to know about upgrading your game!
Last updated
Monogatari has been completely rewritten and many things have changed, however, the script syntax and overall functionality has stayed almost the same so porting your game from v1.4.1 to the newest version is not that complicated!
Lets start with the easiest task, the best way to port your game is starting fresh and that means downloading the newest version available and move your files there, step by step instead of trying to update your old project.
Lets start with the assets, they are now saved on a directory called assets. Here is an equivalence of where you used to store your assets before and where you should store them now:
Why did this changed you may ask. Well, by creating an universal assets directory, it is easier to both keep your assets out of version control systems (git and others) and also, it allows you to host your assets remotely in an easier way. More info on this will be made available later on.
Your players most likely have lots of save files and we want them to keep them even though we're updating the engine. By default, the new version handles storage in a different way which will result on the save files not showing up. To allow your players to keep their save files, we need to change this.
Go over to the options.js
file
Find the Storage
configuration almost at the bottom of the file
Edit the Adapter
property and set it to an empty string (''
)
Edit the Store
property and set it to an empty string (''
)
Now its time to copy your storage object. The js/storage.js
file is still the place where you'll put all the items you want to save on your game, the syntax has changed just a bit.
Storage on v1.4.1
Storage on v2.0.0
As you can see, it really is just a matter of changing the let storage = { ...storage };
format to the new monogatari.storage ({ ...storage });
format, you can copy your storage object exactly as it is!
Previously, when you wanted to modify the storage, you would modify the variable directly like this:
Modifying the storage like that is no longer possible since it has been moved to a function. While you can look at all the new syntax on the storage documentation, the easiest way to update the syntax is by replacing all occurrences of it you have on your script for something like this:
Just like with the storage, assets declaration syntax has changed just a bit, here's a small comparative on how the assets declaration looks like on your script.js
file on both the old and the new version.
Assets declaration on v1.4.1
Assets declaration on v2.0.0
Just as with the storage and assets, the way to declare the script for your game has changed its syntax, here's a comparison on the old and new way:
Script declaration on v1.4.1
Script declaration on v2.0.0
Declaring independent labels for your script is possible as always, and really useful to split your game into multiple files, here's a comparison on how this was achieved on the past and how it's done now.
Individual Labels on v1.4.1
Individual Labels on v2.0.0
The syntax for some of the actions you can perform on your script has been changed. Here's a small list of the ones that changed, however, it is best if you check their individual page to see all the new features!
Previously, a file called strings.js was distributed with Monogatari where you would put all your string translations, mainly used for the UI. Now, those translations are handled internally but you can still add strings to them or modify them. Here's some comparison on how it worked before and how it works now.
Strings declaration on v1.4.1
Strings addition on v1.4.1
Strings declaration and addition on v2.0.0
Asset
Old Directory
New Directory
Music
audio/music/
assets/music/
Voice
audio/voice/
assets/voices/
Sounds
audio/sound/
assets/sounds/
Characters
img/characters
assets/characters/
Backgrounds / Scenes
img/scenes/
assets/scenes/
UI Assets
img/ui/
assets/ui/
Video
video
assets/videos/
Action
Old Syntax
New Syntax
show <character_id> <sprite_id>
show character <character_id> <sprite_id>
hide <character_id>
hide character <character_id>
show <image_id>
show image <image_id>
hide <image_id>
hide image <image_id>
display message <message_id>
show message <message_id>
scene <scene_id>
show scene <scene_id>
notify <notification_id>
show notification <notification_id>
particles <particles_id>
show particles <particles_id>
stop particles
hide particles