Announcement

Collapse
No announcement yet.

Unreal.js

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hi nako,

    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

    Comment


      [MENTION=230153]Skia[/MENTION] 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.

      Comment


        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:
        http://pastebin.com/6Q5qh4W4

        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?
        Last edited by Skia; 03-17-2016, 01:38 PM.

        Comment


          [MENTION=230153]Skia[/MENTION], cooking needs extra manual copy for now. https://github.com/ncsoft/Unreal.js/wiki/Cooking
          This is because unreal.js plugin is a plugin which has *content* but it is not cooked with other game/content automatically by cooker.

          Comment


            Video tutorial(by [MENTION=26010]keyle[/MENTION]) added! https://www.youtube.com/watch?v=XxPSLjBg7DU

            Comment


              any plan to support OSX?

              Comment


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

                Comment


                  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?
                  Code:
                         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}
                          );

                  Comment


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

                    Comment


                      Many thanks. Excellent!

                      Comment


                        I am quite noob to JS and this plugin.

                        What can I do with unreal.js?

                        Comment


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

                          Comment


                            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);
                            }
                            }
                            Last edited by Postalh; 05-20-2016, 06:55 AM.

                            Comment


                              Has anyone managed to compile the plugin for 4.12?

                              Comment


                                Originally posted by SKGN View Post
                                Has anyone managed to compile the plugin for 4.12?
                                Yep, seems to work just fine

                                Comment

                                Working...
                                X