Unreal.js

@nero Unfortunately VS2013 doesn’t support autocompletion for javascript. Unreal.js provides *.d.ts which can be read by “Visual Studio Code”. If you are coding with Typescript, VS2015 will be fine.

Typescript support for VS 2015 can be downloaded inside VS2015. After installing that, writing *.ts instead of *.js will give you almost perfect auto completion, because TypeScript is super set of JavaScript.

  • I updated *.d.ts which loosened weight to make IDE happier (because Visual Studio Code seemed not to be capable of handling large *.d.ts). So please check out new *.d.ts (/Examples/Content/Scripts/Typings)

I’m copying my message from reddit to here so maybe you can see it faster.

I’m using ue4 from the start with blueprints cuz i’m mostly a technical artist. I’m learning c++ too. But when i see unreal.js, it made me excited cuz maybe, just maybe i won’t need to learn more c++ for ue4. Here are some of my questions. (Bear that in mind cuz im not a programmer, sorry for noobish questions.)

  1. As i see you only support for visual studio with autocomplete. Is it possible to use webstorm or another IDE like that with that type definition file?

  2. Since you say, you only use unreal.js for rapid prototyping and editor extensions, is it really slow for real games when you compare it to blueprint?

  3. I can see the most of it’s advantages comparing to blueprint (like having full access to whole api) but what are the disadvantages? I’m sure there are a lot of people like me that only uses blueprint and doesn’t know much about how things work under hood and wondering how is unreal.js compared to blueprint or c++ for unreal engine.

Btw, thanks for bringing more awesomeness to ue4.

@theknoppix

> 1. As i see you only support for visual studio with autocomplete. Is it possible to use webstorm or another IDE like that with that type definition file?

Javascript autocompletion is brand-new feature from Microsoft, which is only available with MS products currently (as far as I know).

> 2. Since you say, you only use unreal.js for rapid prototyping and editor extensions, is it really slow for real games when you compare it to blueprint?

No. Actualy it will be much faster than Blueprint, but it requires JIT to be completed in run time, which will introduces ‘warm-up’ overhead. Latest version of V8 provides ‘snapshot’ of memory, which allows bulk-loading. I think there are some rooms to overcome this overhead.

> 3. I can see the most of it’s advantages comparing to blueprint (like having full access to whole api) but what are the disadvantages? I’m sure there are a lot of people like me that only uses blueprint and doesn’t know much about how things work under hood and wondering how is unreal.js compared to blueprint or c++ for unreal engine.

I think most disadvantages are what I wrote above, and Unreal.js has no mobile port currently, this seems to be a major disadvantage of current version.

Thanks!

Check it out :slight_smile: THREE.js TorusKnot now in Unreal:

It’s also really cool that saving will auto-update triggering the Blueprint to re-initialize the mesh. So as soon as I hit save in Sublime, UE4 immediately updates the mesh. Really really cool

Just ported unreal.js to android this weekend, well, it’s hardly a port since there’s only couple lines of change. (Most time was spent on building V8 properly)

@mflux it’s amazing, :slight_smile:
@nate Could you PR your android build? :slight_smile:

@nako_sung, sure, will make a PR later today.

Wow it looks quite awesome to me. Thanks a lot for working on something like this and spending time to answer all of my questions.

@nate thank you for PR :slight_smile: It works!
@theknoppix happy hacking!

I managed to implement pseudo-livereload by getting source code from gist.github.com which is triggered by clicking ‘reload button’. :slight_smile: It’s fun!

Quick question , is the Javascript Script Source File path relative to anything? I’ve only been able to get it working by giving it an absolute path.

JavascriptContext tries to resolve path with given Paths and base path which querier-javascript lies on. Default paths are ‘Engine/Plugins/UnrealJS/Content/Scripts’ and ‘Game/Content/Content/Scripts’.

‘Game/Content/Scripts/ABC/def.js’ can require(‘…/DEF/ghi.js’) to find ‘…/Scripts/DEF/ghi.js’

Holy cow this is awesome! Thanks for working on this!

Awesome! Well done!

This is so cool! I have a question. Will Epic Games make this plugin as built-in feature in the future? Could this happen? Thanks.

So this is the error I run into,

Anyone else try this on Win10, VS2015?

$ cd Unreal.js/Examples/Content/Scripts && npm i
Error: EPERM: operation not permitted, mkdir ‘C:\Program Files (x86)\Git\Unreal.js’
at Error (native)

Error: ENOENT: no such file or directory, open ‘C:\Program Files (x86)\Git\Unreal.js\Examples\Content\Scripts
pm-debug.log.36f31f097e76036e95a7573b8d6cb22c’
at Error (native)

Has anyone come across this - and if so can you plz tell me how you fixed it^?

Unrealscript rises from the graaaave! Mwaaahahahahahahaaah

@rrstuv did you try within cmd.exe? Actually “npm i” is needed only for ‘springy demo’, so you can just ignore it.

@DaveVoyles @RuMad @SumFX Thank you! :slight_smile:

, what are you using to debug your JS?

The JS console in Unreal is obviously quite limited, since you can’t console.log( object ) and have it show internals. I’ve also experienced cases where live-reload doesn’t really work: it keeps reloading previous cached versions instead of the latest versions. Are there any workarounds to that?