Home | Documentation | Atomic Chat | Github

Running JS project from console


#1

Hi, I’m coming from Urho and trying to learn AGE. My platform is Linux Mint, I’ve built AEG from source.

I’m trying to start my JS project from the command line, without using AtomicEditor. I’ve manged to do it with:

PATH_TO_EDITOR/AtomicEditor --player --project PATH_TO_PROJECT

The problem is that there’s too much debug output and it’s hard to find error messages in it.

With Urho3D I could launch my Lua project using Urho3DPlayer, and I could pass additional parameters to suppress the debug output (-q), so I tried the same with AEG. After building my project from AtomicEditor, I get player executable and .pak file. Then I tried to use AtomicPlayer to execute my Resources folder that contains un-packed scripts and assets. I use this command:

Linux-Build/AtomicPlayer -pp PATH_TO_PROJECT -p Resources Resources/Scripts/main.js

After I’ve copied over some missing assets from CoreData and PlayerData, the AtomicPlayer runs with no errors, but it shows just the black screen. With Urho3DPlayer I could specify starting script as parameter, while AtomicPlayer just ignores it.

Can I execute my un-packed Resources with AtomicPlayer?

Also, is there a way to get default Log object from JS, so that I can do setLevel(LOG_WARNING) on it?


#2

The AtomicPlayer binary is designed to run a packaged JS/TS/C#/C++ project on 6 platforms.

For JS/TS/C++ project, the editor can run in player mode as you have been doing with the --player switch. This will run from a project directory and use the unpackaged resources/scripts/cache processed assets, etc. There is also documentation on the wiki for setting up JS/TS projects to run directly from Atom and VSCode, with VSCode debugging support.

Executing Scripts/main.js as a consistent entry point is a convention, and the engine will attempt to execute that script first. It would be pretty easy to create a player binary that also worked with unpackaged resources and could be fed a script to execute. This could potentially be a mode of the AtomicPlayer binary. @shaddockh Any thoughts on gains with this vs --player switch?

On the debug spam and not being able to quiet it… what seem to be the biggest offenders on the log? You could try adding, -log error, to the command line. though -q should be working


#3

Thanks for good explanation. You are right, -q works even with AtomicEditor executable.

I get this error message on every startup (not suppressed with -q):

[0518/205652:ERROR:browser_main_loop.cc(231)] Running without the SUID sandbox! See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.

The most annoying debug output was:

[Thu May 18 18:43:47 2017] DEBUG: Resized scratch buffer to size 52272 [Thu May 18 18:43:47 2017] DEBUG: Resized scratch buffer to size 52320 [Thu May 18 18:43:47 2017] DEBUG: Resized scratch buffer to size 52512 (few dozen more lines like this)

I think that one went away when I rebuilt the engine without --debug flag.


#4

@JoshEngebretson One benefit I could see with a standalone player would be that it might be easier to embed in Nuget/NPM/VSCode Marketplace. This could support pure command line development, especially if also bundled with AtomicTool. If someone wants more, such as the scene editor, then they can always download the full Atomic Game Engine.

It sounds like you want to really continue with the modular story, so that lends itself to breaking it out into totally separate components; Standalone Player, Standalone Scene Editor, etc.