HTML5 engine arguments

I’m trying to pass engine arguments to an HTML5 build following the instructions - but it’s not working. Am I doing something obviously wrong? Initially I was trying the engine-setup script tag which was added in 1.9.5 but no luck with that, so switched to the other method of editing the engine arguments field in the HTML5 section of game.project as a simpler first step to understanding it.

The example arguments in the docs contain multiple types of hyphen, which I’ve corrected. Have also tried sys.get_config_string() instead of the deprecated sys.get_config()

Using Defold 1.9.6 on Mac, engine SHA1 11d2cd3a9be17b2fc5a2cb5cea59bbfb4af1ca96

Project setup

Script:

local foo1 = sys.get_config_string("foo1")
local foo2 = sys.get_config_string("foo2")
print(foo1) -- bar1
print(foo2) -- bar2

Console log from Chrome:

WARNING:DLIB: Unable to convert 'true' to int
dmloader.js:769 INFO:ENGINE: Loading data from: archive:game.dmanifest
dmloader.js:769 INFO:LIVEUPDATE: Liveupdate folder located at: /data/.17efa59bb859e46d6c87270c1ebde76343a562e9
dmloader.js:769 INFO:LIVEUPDATE: Found no legacy liveupdate zip file references
dmloader.js:769 INFO:LIVEUPDATE: Found no legacy liveupdate index paths
dmloader.js:769 INFO:ENGINE: Initialised sound device 'default'
2dmloader.js:769 DEBUG:SCRIPT: nil

You are not supposed to put quotes on strings in game.project fields, they are already strings by default. Now you just put quotes as part of the string in it. Just set Engine Arguments to:

--config=foo1=bar1, --config=foo2=bar2

The rest looks fine, it should print “bar1” and “bar2” to the console with that.

4 Likes

And it look like the example in the manual is wrong, so I made a pull request for the docs. Fixed quotation marks and hyphens in engine arguments instructions by HalfstarDev · Pull Request #526 · defold/doc · GitHub

4 Likes

Thanks (I actually submitted a PR too, but then deleted it when I saw yours)

With a bit of experimentation I was able to get it working in a custom template too.

I suspect the docs for engine-setup are also out of date, in fact a script with any id containing CUSTOM_PARAMETERS works, but the other documented approach doesn’t (even after fixing obvious the hyphens etc)

 <script id='engine-setup' type='text/javascript'>
    var extra_params = {
        ...,
        engine_arguments: ["–config=foo1=bar1","--config=foo2=bar2"],
        ...
    }
2 Likes