Monkey + Node-Webkit = fast builds

Monkey Forums/Monkey Programming/Monkey + Node-Webkit = fast builds

AdamRedwoods(Posted 2014) [#1]
Just discovered this the other day, and it's a nice way to compile quickly on the desktop for quick iterations. The advantage of this is that the HTML5 target doesn't pop up in the browser you're using. it's its own separate window.

1:
download node-webkit (pre-built binaries, win32, osx32):
https://github.com/rogerwang/node-webkit

2:
extract this into Monkey/bin/node-webkit/
make a batch file to run, similar to this (win32) "nw_runner.bat":
c:\Monkey\bin\node-webkit\nw.exe .

(don't forget that final ".")
if anyone knows a similar OSX batch file, please share!

2b:
for win32 and webgl, copy D3DCompiler_43.dll into the node-webkit folder. i found a copy with Ted, otherwise, it should be in the system folder.

3:
modify the config.winnt.txt
HTML_PLAYER="${SYSTEMDRIVE}\Monkey\bin\node-webkit\nw_runner.bat"


4:
create this file in monkey/targets/html5/template:
"package.json"

(you can make the width/height larger if you want)

5:
delete your html5 build folder, or copy the package.json into your old html5 folder, and away we go!

now when you run an HTML5 build, it pops up in a separate window.


notes:
The biggest problem i had was that Transcc seems to "lock" onto the Node-Webkit app and you need to manually stop it. too bad, as if this were not the case, you could quickly iterate as node-webkit will keep just the single process but reload the new files from your compile.


there are many options, and you get NodeJS commands. pretty snazzy. you could even package this up and distribute if you desire. *OR* you could wrap NodeJS and create a nice cross-platform GUI target.

for more info and tips, go to the wiki:
https://github.com/rogerwang/node-webkit/wiki


Paul - Taiphoz(Posted 2014) [#2]
How easy would it be to set this up as an additional target so people can get the best of both worlds.


AdamRedwoods(Posted 2014) [#3]
How easy would it be to set this up as an additional target so people can get the best of both worlds.

not that easy. you'd need to modify Transcc.
if BRL is interested, i could set this up as an unsupported "node-webkit" target and include it in the monkey builds.

I have to say, this has sped up my dev cycle!


nikoniko(Posted 2014) [#4]
AdamRedwoods wrote:
this has sped up my dev cycle!


How? By excluding launching of browser?


SLotman(Posted 2014) [#5]
Yeah, I don't get it either... what's the advantage of this over the desktop target? There's no browser there either, and you can even debug your program...


AdamRedwoods(Posted 2014) [#6]
How? By excluding launching of browser?

well, generally i have many tabs open in my browser, so having a separate window is faster and more convenient.
what's the advantage of this over the desktop target?

my desktop target is very slow to compile. the html5 is very quick.
you can even profile the code execution using the debug console.


Paul - Taiphoz(Posted 2014) [#7]
Yeah my Desktop takes about 15-30 seconds to build but my html5 builds near instantly I always have my browser open so that's less of an issue for me.

I have another query tho, given the patchy support for audio over html5 there are times when we need to test via the browser to ensure things work as intended how would this webkit handle that, hoes does it handle sound.


AdamRedwoods(Posted 2014) [#8]
audio works fine as far as i can tell.

maybe it's just a preference thing and how one wants their workflow, but i felt i needed something like this.


werton(Posted 2014) [#9]
Many thanks for the useful tip.

make a batch file to run, similar to this (win32) "nw-runner.bat"

HTML_PLAYER="${SYSTEMDRIVE}\Monkey\bin\node-webkit\nw_runner.bat"

nw-runner & nw_runner
this mistake cost me 15 minutes of my life :)


ziggy(Posted 2014) [#10]
Yeah my Desktop takes about 15-30 seconds to build
How lucky you are! I can leave the room, take a coffee, and then see whether the compilation was successful or not.


Erik(Posted 2014) [#11]
I would recommend XNA, just as fast to compile, as good or better runtime performance as the desktop target and great performance analyzing tools if you install VS 2013, https://msxna.codeplex.com/releases and http://stackoverflow.com/questions/17330810/xna-for-visual-studio-2013