Faster MV Testing in your Browser

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

I don’t know about you, but for me testing MV is actually quite a lot of effort. I mostly write plugins, but I need to re-run the project quite a lot because I write like 5 lines of code and then I want to see how it looks.

The Standard Way

Normally when you test your game, you would have a couple option.

  • You could do a full playtest.
  • You can test a battle through the troop editor, where you can set up some initial actors, levels, and equipment. Only up to 4 actors though, and doesn’t support custom equips.
  • You can also do an “Event Test”, where you highlight a bunch of event commands, right-click and test. Whether it’s a common event or map event.

Now these are all cool, but for me, it takes too long to start up the game. On my computer it takes like maybe 3-5 seconds to load up. It might not seem like much, but when you’re reloading the game like 50 times an hour, that time spent adds up.

Playtest in a Browser

If you look at your project folder, you’ll notice a file called “index”. This is basically what RPG Maker MV loads to begin the game. If you’re familiar with how the internet works, you’ll know that index.html is just a webpage. However, if you tried to load up your index.html in chrome/firefox, you’ll probably see this

Basically, it’s hard to test your game in a browser due to CORS security policy. CORS is your friend, until it works against you.

The reason is because the browser can’t make requests to files on your computer (normally). You could disable this, but that can lead to other problems.

Enter NodeJS Server

NodeJS basically lets you run javascript on your computer. It also let’s you run a server locally, so that you can pretend that your game is being hosted on a server without actually paying for a server! It also solves the browser issue, which is our goal: we want to be able to play the game in our browser, so we don’t need to deal with RPGMaker MV’s slow playtest launch.

Setting up your own Server

To save you some time, you can download and extract this file. It’s basically all of the stuff that you need. It’s for windows users, so if you’re on mac or linux you’ll need to set it up yourself.

1. Install nodeJS. Just download the setup file and follow the instructions.

2. Go to your project folder. I called it Node. Then create another folder called “public” and then drag all of your files into it. This is purely for organization purposes. Then extract the “RPGMaker_Node_Server” file that you downloaded earlier so it looks like this.

3. Run the following command. You can skip this step if you downloaded the file.

npm install node-static

Node Static is a very small library (300KB) to serve static files like javascript which are all of your plugins.

4. Next open notepad again and copy paste the following, and save it as server.js. You can also skip this step if you downloaded the file earlier.

var static = require('node-static');
var file = new static.Server('./public');
require('http').createServer(function (request, response) {
    request.addListener('end', function () {
        file.serve(request, response);
    }).resume();
}).listen(8000);
console.log("Listening on Port 8000");

5. To start your server, run the following command.

node server.js

If you downloaded my file earlier, just double click “start_server”. You should see a black window pop up that says your server is listening on port 8000. You can change this port in the server.js script.

6. Finally, open your browser and type in “localhost:8000” in the address bar, and you should be able to play your game in your browser (mine is 8080 for example)

And that’s it

You can make changes in RPG Maker MV, save them, and then refresh your game in the browser. I think it’s a lot faster than going through normal testing. If you want to do battle tests, you can just set up a bunch of events on a map with your test configurations, and then just choose which one to run (maybe with switches, auto-run, etc).

Like this Content?

If you like my content, consider becoming a patron! I provide free plugins and resources for RPG Maker developers for commercial or non-commercial use. If you find my stuff useful and would like to support my activities, a small monthly donation would help a lot.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax