Unreal.js

Yes. :slight_smile: But it would take some time. :slight_smile:

nako_sung may you say what part of your program responds for return function error how you are making correction, what files and logic?

@florentine3d Suspicious line is https://github.com/ncsoft/Unreal.js/blob/master/Plugins/UnrealJS/Source/V8/Private/JavascriptContext_Private.cpp#L485 I think I have omitted copying value. :slight_smile:

:slight_smile:

For me very interesting how programming this things like this plugin. For me is very hard… If not difficult you may making screen cast how you working with correct this error. Open IDE, project, change text, debug, and put to github? How you view how some changes of cpp code reflect one other parts of program, how to you view this… For me interesting view whole cycle of develop.

It maybe making without any sound and voice…

@florentine3d Sorry, currently I have no plan to make a video about live-debugging.

Hi ,

i found your work very interesting, but as soon as i try to make a build with your plugin activated i have one problem:
if i look in the console the modules are loading, but nothing happens (my explanation is that for some weird reason the “begin play” event is not triggering, but i could be wrong. for instance, is it normal to have the HTTPChunkedInstaller module not found?).

Would you mind sharing the project for building the snippet/editor example?
I guess something is different from the one on github (for instance, you need to add a fake cpp class in order to build, and i wonder if i’m missing some other step).

Thanks

@Skia Have you tried prebuilt binaries? I will share whole steps building snippet editor on youtube because I’m out of the office to attend GDC in SF.:slight_smile:

GDC in SF? Nice!

Prebuilt binaries doesn’t support the snippet example, does they? I think they are missing the JavascriptMultiLineEditableTextBox
Beside when i try to launch the project without compiling(so with the prebuilt binaries, and not using play, that works) i have “Cannot find module V8” error.
That’s why i though to compile the plugin within the project itself: i create an empty c++ class so that unreal will pick up the plugin and compile it inside the game.

To pack with this configuration i just have to add “V8”, “JavascriptUMG”, “JavascriptHttp”, “JavascriptWebSocket” dependencies to JavascriptPlayground.Build.cs, right?

I found out that the “no error” state was due to not packing the script folder with the build (so basically nothing was loading).
Now i get “require is not defined” in the output log when i try to launch but if i trigger the console and try with “module list” i get that the module is loaded.

EDIT:

EDIT:
Ok, trying to dig more i discovered that the javascript language is executed and the main functions are working (for instance console.log works), but all the V8(?) variables/functions like require,module,process give error. The context between the Javascript Console and the script is shared correctly.

Do you have any suggestion?

@Skia, cooking needs extra manual copy for now.
This is because unreal.js plugin is a plugin which has content but it is not cooked with other game/content automatically by cooker.

Video tutorial(by @keyle) added! Getting Started with Unreal JS - YouTube

any plan to support OSX?

I think supporting OSX is doable. Maybe the most difficult and tedious step is compiling V8. :slight_smile:

How to specify the first argument of the function DrawTexture? Path to file (string) does not give results, drawn white square. In “typings” specified data type RenderTexture: Texture. How to define it?



       this.Canvas.DrawTexture(
          '/Game/Textures/crosshair.crosshair',
          {X: this.Canvas.SizeX / 2, Y: this.Canvas.SizeY / 2},
          {X: 16, Y: 16},
          {X: 0, Y: 0},
          {X: 1, Y: 1},
          {R: 1, G: 1, B: 1, A: 1},
          EBlendMode.BLEND_Translucent,
          0,
          {X: 0, Y: 0}
        );



It requires UTexture*, so you can fetch appropriate texture object by calling Texture.Load(‘/Game/Textures/crosshair.crosshair’). :slight_smile:

Many thanks. Excellent!

I am quite noob to JS and this plugin.

What can I do with unreal.js?

You can do almost everything youd could do with blueprints. For detailed information please check wiki on github.

I see allot of examples on how to call JavaScript from blueprint. Are there any examples on how to trigger an event in blueprint from JS?

EDIT:
Nvm, I found just the kind of example I was looking for.

// Blueprint class can be subclassed!
class MyActor extends Blueprint.Load(‘/Game/ExampleBlueprint’).GeneratedClass {
// constructor
ctor() {
// Subobject initialization, property initialization
this.bAlwaysRelevant = true
}

// declare UPROPERTY's here
// ; this.XXXXX/*[attribute+]+type*/;
properties() {
    this.Hello/*Replicated+EditAnywhere+int*/;
    this.World/*Replicated+EditAnywhere+Actor*/;
    this.Position/*EditAnywhere+Vector]*/;
    this.Some/*EditAnywhere+DistanceDatum*/;
}

// Overriding function doesn't need function signature
ReceiveBeginPlay() {
    super.ReceiveBeginPlay()

    console.log("Hello, this is MyActor")
}

// Override an event which was declared in Blueprint
CustomEvent() {
    console.log("This is javascript")
}

// New UFUNCTION needs proper function signature
// ; function-name(arg/*type*/,...) /*UFUNCTION-flag+another flag]*/
NewFunction(x/*int*/, y/*int*/) /*NetMulticast*/ {
    console.log(x + y);
}

}

Has anyone managed to compile the plugin for 4.12?

Yep, seems to work just fine