{"id":19584,"date":"2018-05-04T17:35:00","date_gmt":"2018-05-04T17:35:00","guid":{"rendered":"http:\/\/www.gamasutra.com\/view\/news\/317608"},"modified":"2018-05-04T17:35:00","modified_gmt":"2018-05-04T17:35:00","slug":"blog-first-impressions-of-the-scripting-in-rpg-maker-mv","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2018\/05\/04\/blog-first-impressions-of-the-scripting-in-rpg-maker-mv\/","title":{"rendered":"Blog: First impressions of the scripting in RPG Maker MV"},"content":{"rendered":"<p><strong><em><small>The following blog post, unless otherwise noted, was written by a member of Gamasutra\u2019s community.<br \/>The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.<\/small><\/em><\/strong><\/p>\n<hr \/>\n<p>I started looking into RPG Maker MV to update some of my VX Ace scripting <a href=\"https:\/\/www.youtube.com\/watch?v=ZEgdmCNf63k&amp;t=48m12s\">panels<\/a> and <a href=\"http:\/\/www.gamasutra.com\/blogs\/DylanWolf\/20170307\/293065\/RPG_Maker_VX_Ace_Ruby_scripting_crash_course.php\">posts<\/a>, and\u2026 it\u2019s different. If you\u2019ve read some of those posts, here\u2019s a few things that might help with the transition.<\/p>\n<h2>JavaScript all the way down<\/h2>\n<p>Where RPG Maker VX Ace uses Ruby, MV uses JavaScript, and it\u2019s more than just swapping out a scripting engine.<\/p>\n<p>For example, if you build your project for web, the index.html file is literally just a list of the code files in your project:<\/p>\n<p><img decoding=\"async\" alt=\"RPG Maker MV web build index.html file\" src=\"http:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2018\/05\/blog-first-impressions-of-the-scripting-in-rpg-maker-mv.png\" \/><\/p>\n<p><em>RPG Maker MV web build index.html file<\/em><\/p>\n<p>This seems like a smart move, because it makes it easier to support multiple platforms. There\u2019s at least one way to run HTML5 on every platform.<\/p>\n<p>It also means you have access to <em>all<\/em> of the code in your project. For someone who\u2019s comfortable digging into the inner workings of the engine, that\u2019s huge. It allows for a lot of flexibility, but it means you also have to be careful. (Regular backups or <a href=\"http:\/\/www.gamasutra.com\/blogs\/DylanWolf\/20180502\/317397\/Using_Source_Control_with_RPG_Maker_VX_Ace.php\">source control<\/a> are, again, crucial.)<\/p>\n<h2>&#8230; which is a double-edged sword.<\/h2>\n<p>VX Ace\u2019s Ruby code seemed to use fairly standard object-oriented programming practices. This made it easier to explain\u2013classes are templates for things that can exist, methods are actions those things can take, properties define the details of those things, etc.<\/p>\n<p><a href=\"http:\/\/shop.oreilly.com\/product\/9780596517748.do\"><img decoding=\"async\" alt=\"\" class=\"alignright\" src=\"http:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2018\/05\/blog-first-impressions-of-the-scripting-in-rpg-maker-mv.gif\" \/><\/a>JavaScript is not exactly a traditional object-oriented language. It\u2019s not that it doesn\u2019t have those concepts, but they\u2019re not exactly first-class concepts.<\/p>\n<p>In JavaScript, classes are functions. Class methods are defined by assigning properties to the \u201cprototype\u201d property of the class. It\u2019s all sort of backwards if you\u2019re just learning. Rather than writing code, you\u2019re often writing code that (more or less) writes the code you\u2019re going to use later.<\/p>\n<p>(To make things more confusing, MV tends to throw multiple classes into the same file, whereas VX Ace\u2019s script editor had a well-organized list of classes.)<\/p>\n<p>But it\u2019s not actually bad. You can do some powerful things if you know what you\u2019re doing. It\u2019s probably not where you want to start programming, though.<\/p>\n<p><img decoding=\"async\" alt=\"RPG Maker MV code example\" src=\"http:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2018\/05\/blog-first-impressions-of-the-scripting-in-rpg-maker-mv-1.png\" \/><\/p>\n<p class=\"wp-caption-text\"><em>This plugin included in the default MV project changes where the Title Screen menu is shown by replacing the methods on the Window_TitleCommand class responsible for positioning.<\/em><\/p>\n<p>I\u2019m not sure you can just wing it as easily as you can in VX Ace. If you\u2019re interested in programming MV, I would suggest some good JavaScript tutorials first\u2013specifically, ones that focus on the language, not simply its use on the web. <a href=\"http:\/\/shop.oreilly.com\/product\/9780596517748.do\"><em>JavaScript: The Good Parts<\/em><\/a> by Douglas Crockford is a good resource and a fairly quick read.<\/p>\n<h2>Built for real development tools<\/h2>\n<p>One of the most frustrating things about working with VX Ace as a developer is everything is stuck in a binary file. Code was only editable through the RPG Maker application. <a href=\"http:\/\/www.gamasutra.com\/blogs\/DylanWolf\/20180502\/317397\/Using_Source_Control_with_RPG_Maker_VX_Ace.php\">Collaborating through source control<\/a> was a pain, because there was simply no way to merge changes.<\/p>\n<p>In MV, it\u2019s all text. All of the code is JavaScript and all of the data is JSON (JavaScript Object Notation). That means it\u2019s possible to merge changes from multiple users (although it\u2019s still possible to create conflicts that require manual resolution).<\/p>\n<p><img decoding=\"async\" alt=\"A map file in RPG Maker MV\" src=\"http:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2018\/05\/blog-first-impressions-of-the-scripting-in-rpg-maker-mv-2.png\" \/><\/p>\n<p class=\"wp-caption-text\"><em>A map file in RPG Maker MV<\/em><\/p>\n<p>(Interestingly enough, it\u2019s really the same pattern. VX Ace uses built-in Ruby serialization to store this data, where MV uses built-in JavaScript serialization. It\u2019s just that built-in JavaScript serialization is text.)<\/p>\n<p>One side effect is that you can bring your own editor rather than using an in-application scripting editor. I use <a href=\"https:\/\/code.visualstudio.com\/\">Visual Studio Code<\/a>, but there are lots of IDEs that support JavaScript out there. The benefit is, you get syntax highlighting and, in some cases, code completion and navigation. (Since JavaScript is a dynamic language, the information needed to make these features work isn\u2019t guaranteed to be there, unlike strongly typed languages like C#.)<\/p>\n<p>Since you can build for the browser, you can also debug your code using your browser\u2019s built-in developer tools. This is good, because the playtesting mode error display doesn\u2019t seem to be as robust as it is in VX Ace. You\u2019ll get the exception type and error message, but not the filename and line number.<\/p>\n<h2>Plugin architecture<\/h2>\n<p>While you can find a number of \u201cplugins\u201d for VX Ace out there on the internet, they often just involve dropping code into a blank page of the script editor. That is, you structured them the same way you would any other additional code.<\/p>\n<p>MV has a plugin system not unlike WordPress\u2019s. Each plugin is stored in a separate JavaScript file, which contains various metadata (name, description, author, etc.) in the comments. You can add them to your project, enable\/disable them, and set configurable parameters.<\/p>\n<p><img decoding=\"async\" alt=\"RPG Maker MV Plugin Manager\" src=\"http:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2018\/05\/blog-first-impressions-of-the-scripting-in-rpg-maker-mv-3.png\" \/><\/p>\n<p class=\"wp-caption-text\"><em>RPG Maker MV Plugin Manager<\/em><\/p>\n<p>Plugins execute as soon as they\u2019re loaded, so they can create, add to, and replace functionality. (Remember what I said about JavaScript code that writes code you use later?) You can enable and disable plugins through the RPG Maker application.<\/p>\n<p>Plus, the plugin system seems fairly well documented in RPG Maker help, along with the default JavaScript library.<\/p>\n<p>Plugins seem like a good, modular way to structure your code, rather than scatter it throughout the default RPG Maker MV code base.<\/p>\n<h2>What&#8217;s next?<\/h2>\n<p>I\u2019ve already worked through my <a href=\"http:\/\/www.gamasutra.com\/blogs\/DylanWolf\/20170313\/293561\/RPG_Maker_VX_Ace_Ruby_scripting_Thinking_through_a_UI_change.php\">previous \u201cgold window\u201d example<\/a> in MV, and I found it a little trickier. (Again, playtesting mode doesn\u2019t give you as much information about unhandled errors.)<\/p>\n<p>The good news is, I could build the same thing in the plugin system in only a few lines of code, simply by replacing a method. To me, that\u2019s a win, but I\u2019m not sure what the newbie-friendly blog post for MV scripting looks like.<\/p>\n<hr \/>\n<p><a href=\"https:\/\/www.dylanwolf.com\/2017\/09\/16\/rpg-maker-mv-scripting-first-impressions\/\">This post originally appeared on my personal blog, dylanwolf.com.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following blog post, unless otherwise noted, was written by a member of Gamasutra\u2019s community.The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company. I started looking into RPG Maker MV to update some of my VX Ace scripting panels and posts, and\u2026 it\u2019s different. If you\u2019ve read [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":19585,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-19584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/19584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=19584"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/19584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/19585"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=19584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=19584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=19584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}