Unknown bug in html5 version (SOLVED)

I have trouble with the html5 version of my project. It works well enough if run from the editor or if bundled as a Windows application, but the html5 version hangs at a specific point (and sometimes at seemingly random other points).

Here’s a link to both version. The broken html5 version is also available on the community page.

The html5 version stops working at 16:56, which is the time where the first hungry peep reaches a food dispenser and is buying food. Advancing time by more than 5 minutes seems to trigger it as well sometimes.

I’m trying to pinpoint the bug more closely, but it’s slow, as I have to keep bundling it to test it, (Edit: Damn! I just noticed the “Build HTML5” option in the project menu. That’s going to simplify things…) so I thought I’d create this topic first and update it if I can find out what exactly is the issue.

In any case, the html5 build is behaving differently from what I see in the editor.

Edit: Forgot to mention - I’ve tried uploading a zip, building the html5 playable on the community page and running it in my browser locally. The bug is present in all of these versions. I’ve also tried building a “debug” version instead of “release” to no avail.

Update:

I’ve nearly tracked the bug down. It’s an old pal that has to do with pathfinding - the peep’s location becomes nil which breaks any functions that try to get that value. It used to plague me enough that I still have the line

print("DAMN "..peepID.." HAS A NIL ROUTE AGAIN! TIME IS "..getTime(time)..", DATE "..date)

in the code to notify me should it reappear. The bug only reappeared in the html5 build, though, so I didn’t get the memo. (BTW, is there a way to view console when running a html5 build? That would be helpful).

Anyway, it’s 1:33 AM and I need to go to work tomorrow, so finding the exact place where things go wrong is going to have to wait. Hopefully I’ll solve this with a fresh pair of eyes.

Yeah, these things can be tricky to track down. Is the location changed in many places in your code? We’re not talking a vector3 game object position right?

The browser dev console should work and show you print() statements.

1 Like

Please refrain from posting offensive language on the forum (i.e. swear words).

2 Likes

Ah! Solved!

Turns out I was modifying a for-cycle value within the cycle itself. Dumb. I replaced it with a copy instead and it’s working like a charm.

Is there any use in finding out what was the exact difference in execution between the html5 version and others, or is that of no interest? I remember reading that messing with for cycles can have unexpected results, so I guess this was the difference between builds is the “unexpected” part.

@britzl The location changes all the time, but it’s just a number. Thanks for pointing me towards the dev console! That helped a lot.

@Mathias_Westerdahl Noted.

3 Likes