ElectronMV

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
ElectronMV v1.1.X ( Electron only works for windows 7 and newer )
Electron wrapper for RPG Maker MV. Wrapping MV with Electron gives a handful of benefits. One of the main benefits includes in this wrapper is being able to remember the window position, size and if it was full screened the next time it's opened. See example here:

Other benefits including; being able to create an updater for your game, creating a launcher, and more.

Installing
https://github.com/quxios/ElectronMV#installing


Running
https://github.com/quxios/ElectronMV#running-project-with-electron


Building
https://github.com/quxios/ElectronMV#building-your-game


Configuring
https://github.com/quxios/ElectronMV#configuring


Advanced
This section for for js devs or programmers.

1st, this uses the 2 package method. The package.json in the main directory is used during development, while the one inside the app/ is for production. So don't forget to add any dependencies you add to the development package into the production one as well. Don't add any dev dependencies into the production one since there's no point.

/package.json - Dev dependencies

babel-cli - To compile babel scripts when deploying or converting for vanilla MV
babel-preset-electron - Adds missing es2015 plugins and stage-0 to electron
babel-preset-es2015 && babel-preset-stage-0 - for compiling es2016 plugins for vanilla MV
electron-builder - To build the game
electron-prebuilt - electron

Creating plugins that can use dependencies
Plugins in MV are loaded through a script tag. So if you were to try some babel transformation, for example jsx, you will get an error even if you have the preset installed. So to fix this just end the file name with:

-req.js

And that plugin will be added with require instead of a script tag. Now you can go ahead and write that plugin as you would like. Just don't forget to compile it before building the game or you'll get errors.

* Note that plugins need to have the extension .js or the plugin manager in RPG Maker MV editor will not find it.

* Notes
- Some plugins may not work with this if they use any nw.js.
- Electron only works on windows 7 and newer. So if you use this your windows os requirement should be windows 7+
 
Last edited:

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,402
Reaction score
4,966
First Language
English
Primarily Uses
RMMZ
I looked at this at one point - seems interesting. Nice job!


I can say for sure it won't work with my plugin that relocates the safe file to appdata folders - it uses nw.js.
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
Thanks!

And you can also patch it. If you're using nw.js to find the appdata path you can use electron's app.getPath('appData') to find it.
 

taarna23

Marshmallow Princess
Global Mod
Joined
Jul 20, 2012
Messages
2,402
Reaction score
4,966
First Language
English
Primarily Uses
RMMZ
I totally forgot I replied here. So I could theoretically have it check which framework it's running under and have it get the path the appropriate way. That's pretty cool.
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
@taarna23 Yup



An easy way to check if it's running with electron is to check for:


Imported.QElectron


or

Code:
process.versions.electron
 
Last edited by a moderator:

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
Just updated to 1.1.0


https://github.com/quxios/ElectronMV/

  • Edited index.html to run with Electron if running with nw.js. This means that you can play test ElectronMV Projects with the play test button in the MV Editor.
  • Added 2 new .bat files; deploy.bat, nwjsToEMV.bat
    - Use deploy.bat to deploy / build your game for production. The nwjsToEMV.bat just runs the play.bat in a new cmd instance.
  • Included a sample -req.js plugin for js devs
 
Last edited by a moderator:

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
Update 1.1.1
https://github.com/quxios/ElectronMV/
  • Fixed re-sizable always returning true
Added a video on installing it:
Will probably remake later on with a voice over instead of having text.

Update 1.1.2
  • Changed to run electron locally
 
Last edited:

Nefiron

Warper
Member
Joined
Dec 20, 2015
Messages
2
Reaction score
1
First Language
Danish
This is amazing. I've had the same thoughts for long but never got around to do it.
This will also give people the opportunity to make a wrapped environment if they want to do server request and extended features for their game.

There's a ton of application potentials with this solution.

Well done!
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
Exactly! And thanks
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
Update 1.1.3
  • Changed up some of the coding style ( added semicolons ) to make RMMV style a bit more.
  • Changed a few code in the rendererMain.js
  • Fixed a bug where the window wouldn't move to save position if the x/y was 0
For more details, you can see the commits

To update, you only need to replace electronMain.js and electronRenderer.js
 

Krimer

Veteran
Veteran
Joined
May 10, 2013
Messages
147
Reaction score
108
First Language
Ukrainian
Interesting tool, thanks for your work.

Tried with new version of MV(1.5.0) playtest from play.bat works fine.
But then i tried deploy.bat. After deploying i have this error when game startup.
Then i tried old MV version 1.4.1. Playtest works fine but after deploying and click somewhere on game map with mouse got this error
This tests I was doing with clear new projects of each MV versions. Maybe I miss something?
 
Last edited:

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
@Krimer Yeah I was going to patch for 1.5.0 today. And it worked on previous versions so you previous error shouldn't be due to this, but an error with a plugin that you are using (either an error with the plugin itself or an incompatibly with the plugin and electronMV). So you'll need to figure out which plugin is causing that error.

Update 1.1.4
  • Fix for MV 1.5.0 by adding the missing lib to the index file
For this update, you only need to grab the new index.html file, other files are basically the same besides a few numbers changed in them. Also remember, when updating your Electron MV project due to an MV update, NEVER replace the index.html file, electron MV requires a custom index.html file. Most of the time when MV updates say to replace the index.html you don't have to because that file hardly ever changes with the updates, only time you have to update it is if they added a new file in the lib folder. If there ever is a change to it, I'll update the electron index.html to work with the latest MV version.
 

Krimer

Veteran
Veteran
Joined
May 10, 2013
Messages
147
Reaction score
108
First Language
Ukrainian
I know about new lib and add it manually to your index before. But after your update I don't change anything, use only your files.
And i still have the same error for 1.5.0.
Playtest(play.bat) works fine but deployed project doesn't(getting error "WebAudio.initialize not a function")
Test project is clean new project without any plugins.

Did you test deployed project? Maybe i just miss something, but I've done all steps in your readme file.
I think something goes wrong in deployment. Because if I copy files from folder "compiled" and paste them to "app" folder - even playtest(who works before) will stop working with the same errors.

upd:
I've done some investigations and i can say - deployment corrupt game files, at least for me. Some round brackets just disappear in game files after deployment. They disappear selectively not all.

Here is examples

It's only some of them.
Can you check it? Maybe i'm not alone :)
 
Last edited:

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
I just tested and it's not corrupting it, but "cleaning" it. You can fix that error by removing the babel compiling in the package.json. So grab the new package.json:
https://github.com/quxios/ElectronMV/blob/master/package.json

If you are using any babel in any of your plugins, then you'll need to manually compile them yourself now.
 

Krimer

Veteran
Veteran
Joined
May 10, 2013
Messages
147
Reaction score
108
First Language
Ukrainian
Nice, thanks. Without "cleaning" thing all works with no problem. But anyway will test it more.
 

EduHdz404

Warper
Member
Joined
Jul 25, 2017
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMXP
ElectronMV v1.1.X ( Electron only works for windows 7 and newer )
Electron wrapper for RPG Maker MV. Wrapping MV with Electron gives a handful of benefits. One of the main benefits includes in this wrapper is being able to remember the window position, size and if it was full screened the next time it's opened. See example here:

Other benefits including; being able to create an updater for your game, creating a launcher, and more.

Installing
https://github.com/quxios/ElectronMV#installing


Running
https://github.com/quxios/ElectronMV#running-project-with-electron


Building
https://github.com/quxios/ElectronMV#building-your-game


Configuring
https://github.com/quxios/ElectronMV#configuring


Advanced
This section for for js devs or programmers.

1st, this uses the 2 package method. The package.json in the main directory is used during development, while the one inside the app/ is for production. So don't forget to add any dependencies you add to the development package into the production one as well. Don't add any dev dependencies into the production one since there's no point.

/package.json - Dev dependencies

babel-cli - To compile babel scripts when deploying or converting for vanilla MV
babel-preset-electron - Adds missing es2015 plugins and stage-0 to electron
babel-preset-es2015 && babel-preset-stage-0 - for compiling es2016 plugins for vanilla MV
electron-builder - To build the game
electron-prebuilt - electron

Creating plugins that can use dependencies
Plugins in MV are loaded through a script tag. So if you were to try some babel transformation, for example jsx, you will get an error even if you have the preset installed. So to fix this just end the file name with:

-req.js

And that plugin will be added with require instead of a script tag. Now you can go ahead and write that plugin as you would like. Just don't forget to compile it before building the game or you'll get errors.

* Note that plugins need to have the extension .js or the plugin manager in RPG Maker MV editor will not find it.

* Notes
- Some plugins may not work with this if they use any nw.js.
- Electron only works on windows 7 and newer. So if you use this your windows os requirement should be windows 7+
Would this work with Rpg Maker XP?
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
@EduHdz404 Nope, only works with MV since it's written with JS and is basically a webpage.
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
710
Reaction score
228
First Language
English
Primarily Uses
Will the electron wrapper work on Mac or Linux. Ie if I do the wrapper with my deployed MV game, can I send this to my friend with a mac book and they can run it? Or can I copy all of it and put it in my Linux VM and run it? Or is it windows only?
 

Quxios

Veteran
Veteran
Joined
Jan 8, 2014
Messages
1,055
Reaction score
785
First Language
English
Primarily Uses
RMMV
@Zarsla It should though you would need to change the build commands in the package.json to work for mac/linux. Also none of the bat files will work on mac/linux so you would need to use the cmd prompt. And because the bat files dont work, that means you won't be able to use my hook (hitting play from the editor makes the batch file run), so you need to manually run your game every time like a normal electron app or edit the hook to not use the batch.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top