Does browser logs affect exported game performance when it produces large results?

0 favourites
  • 12 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Title. And the exported type is NWJS.

  • Yes it does. Especially if you log a lot (inside loops/every tick).

  • This post got me worried. I always thought that if you disable DevTools on export, then all "browser log" actions will be automatically skipped/disabled too. But turns out this is not the case, they are still executed and still very much affect the performance.

    I will have to replace "browser log" actions with a function in hundreds of events, and remember to disable the function before exporting.

  • I haven't tested but you can redefine the function to do nothing with a line of code. It's quite the hack though.

    console.log = function() {}
    
  • Or maybe you could add an "Is in preview" condition for the browser log actions

  • I had 1070 "browser log" actions in the project. Replaced them all with a function call today. Took me several hours even with a fair bit of hacking.

  • I had 1070 "browser log" actions in the project. Replaced them all with a function call today. Took me several hours even with a fair bit of hacking.

    Posts like these always make me realize how small my projects actually are. Geez man. Perhaps a "disable logging" action in the browser plugin wouldn't be the worst idea or an option on exporting.

    But just to confirm, this actually does work and should practically have no overhead. It's probably just bad practice :D

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I wonder but haven't tested: Once you export with nwjs and disallow chrome dev tools, can a player force chrome dev tools back on? Would it be easy as opening package.nw and adding an extra parameter, or more tricky?

    I am not sure the power of chrome dev tools, and I'm sure minifying would obsfucate variable names and such, but I suppose maybe worth knowing in case you had browser log commands that output important info since you'd assume noone would see it.

    Assuming you could run JS this way, would there be any common vector of attack that someone could exploit?

    Random example relating to multiplayer, is it obvious for someone to write some JS to force-send messages to host or peers? Or would it be easy to write JS to "output any incoming messages into browser log" to gather information about messages (and thus exploit further)?

  • I would get rid of them just in case.

  • Once you export with nwjs and disallow chrome dev tools, can a player force chrome dev tools back on?

    Yep: just edit package.json and delete --disable-devtools, and dev tools works again.

    You can't really disable dev tools. If someone wants them they can get them. Disabling dev tools is not really a security measure, it basically just disables the built-in shortcuts. Still, even if you have dev tools, it's not necessarily easy to make any useful changes, especially if you advanced minify the export.

  • I had 1070 "browser log" actions in the project. Replaced them all with a function call today. Took me several hours even with a fair bit of hacking.

    I have to ask, what are you logging that possibly requires that many events?

  • I have to ask, what are you logging that possibly requires that many events?

    Well, last time I checked our project had about 10K events..

    Most of console logging actions are disabled of course. But there are still hundreds of active ones.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)