The package.json file is a manifest file. It’s like a description for nwjs to read. It provides an easy access to options that you can’t do normally, unless you do script calls towards it. This guide will provide info that is helpful to RPG Maker MV devs. Grab your favorite code editor (or Notepad) let’s edit this to our pleasure.
The necessary stuff:
These are the options that are necessary to get the game working within nwjs. These are already filled by MV, but it’s good to know them, since there may be a necessity to edit stuff.
“name”: This is thename of the program. This is used to create a Chromium profile (which will allow you to have a separate GPU Cache and storing cookies). If the value is empty, the default nwjs profile will be used. This is important to edit (especially if you store cookies or do something GPU intensive), since if you decide to use an older version of nwjs, it will throw a Profile Error. You can either have it as <Game Name> or <Developer>/<Game Name>. Examples:
Code:
“name”: “MV Game”, “name”: “KADOKAWA/MV Game”,
“main”: This is the location of the index.html file. This is needed so the game can start once the executable runs. The path must be based on the perspective of the package.json file. Example:
Code:
“main”: “www/index.html”
Control Fields:
These adjust features within nwjs.
“nodejs”: This boolean variable turns on or off NodeJS. Best to keep this on unless there’s a necessity.
Code:
“nodejs”: true,
“node-main”: Specifies a node.js script to run at startup. Use this only if you need to run a JS file at startup.
Code:
“node-main”: “www/startup.js”
“bg-script”: If you want to run a script in the background, specify the file here.
“chromium-args”: Specify what command line arguments you want to use when running the game. These provide a lot of options, so head over to this page for a breakdown. Example of how to use it:
Code:
"chromium-args": "--enable-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers --enable-zero-copy --enable-gpu-async-worker-context"
“js-flags”: Add flags for the JavaScript intepretter. The default in MV is only the --expose-gc flag. See this page for all the flags.
Code:
“js-flags”: “--expsoe-gc”
Window Settings:
This is where you adjust the window of the game (not the game’s actual resolution). In order to make these settings, it needs to be written like this:
Code:
"window": { "title": "<Insert Title Here>", "toolbar": false, "width": 1280, "height": 720, "icon": "icon/icon.png" }
Anything you need to add must be within the curly bracers.
“icon”: The icon for the game. Used when the game runs.
Code:
“icon”: “www/icon/icon.png”
“id”: The Window ID. This is used to remember the size and the position of the window. This must be unique.
Code:
“id”: “MV Game”,
“title”: The text that shows up in the title bar of the game. You can put anything there but it will show up for a bit until the game loads up.
Code:
“title”: “Game Title”,
“toolbar”: Deprecated since 0.13.0. It shows the stock toolbar. Pretty useless, in all honesty.
Code:
“toolbar”: false,
“width” and “height”: Specifies the resolution that the executable will start. Best to match these with the game’s resolution.
Code:
“width”: 1280, “height”: 720,
“min_width” and “min_height”: Specifies the minimum resolution of the game’s window that it can resize.
Code:
“min_width”: 720, “min_height”: 480,
“fullscreen”: The executable start in full-screen.
Code:
“fullscreen”: false,
“kiosk”: Turns on or off Kiosk mode. The game will enter in full-screen mode (and you won’t be able to exit full-screen mode unless you’ve included an option to exit kiosk mode) and the game’s window will be on top of all other windows. Handy for showcases.
Code:
“kiosk”: false,
“resizable”: If this is false, the window won’t resize by the user.
Code:
“resizeable”: false
Now there are more settings that you can adjust (I wanted to cover the settings that will be the most useful) so take a look at nwjs’ documentation and see what you like. I hope you find this useful.