• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 Obfuscation Still Happening in Debug Mode? Can't Debug Crash.

Y

yossariano

Guest
Hey all-

We have a project for which our HTML5 build is getting a black screen crash which doesn't happen in the Windows build. We're trying to debug it by running in Debug mode (F6/the little bug icon), reproducing, and checking the console. However, the crash message is obfuscated despite us being in debug mode. We can see the output of show_debug_message() in the logs via the debug popup, but the actual error itself looks like

GML:
Unhandled Exception - Uncaught TypeError: Cannot read property '_Vb1' of null in file undefined at line undefined
Clicking through to the "source" tab shows obfuscated code:

Code:
for (var _Sb3 = 0; _Sb3 < _Dj._Vb1._UQ.length; ++_Sb3) {
  var _Tb3 = _Dj._Vb1._UQ[_Sb3];
  if (_Tb3 !== null && _Tb3 !== undefined && _Tb3._Sc1 == _MS.id) {
    _Rb3 = _Tb3._ZN;
    break
  }
}
So it looks like we're accessing an undefined variable on an instance, trying to get length. We've tried combing through our code to find where this could be happening but haven't had any luck. If we could disable the obfuscation this would be a super easy fix. But without the obfuscation this has cost us many fruitless hours.

The documentation about debugging HTML5 says that running in debug mode should show unobfuscated source code. Is this documentation incorrect? Or are we missing a setting or something else that might cause this behavior? Any insight is appreciated.

Runtime version 2.3.1.409
 
Last edited by a moderator:

chamaeleon

Member
The Javascript generated from the code you write should be unobfuscated. The GMS HTML5 runtime code (all various GMS GML functions you may call, the entire event loop, and so on) should remain obfuscated. Your code should be included as comments (and therefore searchable by simply picking names you know you used for your own definitions of variables and functions, etc.), directly followed by the Javascript code generated from it.
 

barthec

Member
Hi
I get "Unhandled Exception - Uncaught TypeError: Cannot read properties of undefined (reading '_tg') in file" and I also have no clue what to look for. HTML5 debugging is a joke.
 

rwkay

GameMaker Staff
GameMaker Dev.
We open sourced the HTML5 Runner so you if you Clone the Repository from GitHub at https://github.com/YoYoGames/GameMaker-HTML5 and then point your HTML5 source path to that in GMS2 -> Preferences/Settings -> Platform Settings -> HTML5 -> Path to HTML5 Runner, and then deselect the Obfuscate in the debug section (personally I select Pretty Print only in the debug section). Then when the project is built you should get all the source unobfuscated (no matter what you build with) - obviously it is up to you how you release but I would advocate only releasing the obfuscated code (it is much more compact).

This should allow you to work out what is going wrong.

NOTE: Sometimes issues only show in obfuscated code, if you let us know on the Github issues then we will take a look at fixing any issues you find.

Russell
 

barthec

Member
So, I found out what was my issue: Draw event and in code "shd_get_alpha = shader_get_uniform(shd_flash_player, "_alpha");" so this "shd_get_alpha" was probably getting null. But Debugger showed nothing what to look for and that was only my knowledge what could go wrong. I checked object by object. After fixing lines in code it runs.
@rwkay I will check HTML5 Runner, thx.
 

barthec

Member
We open sourced the HTML5 Runner so you if you Clone the Repository from GitHub at https://github.com/YoYoGames/GameMaker-HTML5 and then point your HTML5 source path to that in GMS2 -> Preferences/Settings -> Platform Settings -> HTML5 -> Path to HTML5 Runner, and then deselect the Obfuscate in the debug section (personally I select Pretty Print only in the debug section). Then when the project is built you should get all the source unobfuscated (no matter what you build with) - obviously it is up to you how you release but I would advocate only releasing the obfuscated code (it is much more compact).

This should allow you to work out what is going wrong.

NOTE: Sometimes issues only show in obfuscated code, if you let us know on the Github issues then we will take a look at fixing any issues you find.

Russell

That HTML5 Runner does not work. White page while running game.
 
Top