HTML5 Level Load, Variables in JS

TerryRogers
Thu, 22 Jan 2015 15:44:14 +0000
Platform & Builds

Hello.

I’m trying to handle multiple levels in my project for HTML5. Our export has been trimmed as much as possible of all unused content, reduced textures and lightmaps to accomodate the size restrictions, etc. We have two levels in our project, with an elevator that connects them. The plan was to have both levels connected by an elevator, with the player starting on the first floor at an external entrance to the building (so coming back down the elevator would spawn you in a different part of the level).

First, I looked up how to get the separate spawns working in Blueprints (though I am a programmer, I’m new to UE and don’t want to add on code for a project that doesn’t have any right now, expecially because of HTML5 exporting. I’ve learned quickly to stick with what works and not to fool around with it too much unless you want to start from scratch). I followed examples such as this one, but was unable to make any cast to objects such as MyCharacter or MyHUD (the project was based on the First Person Shooter example), be it in my project or others. I’ve read that this is a problem in 4.5, and even after fiddling with experimental menus and reinstalling/recompiling engines, I gave it up as a lost cause.

So instead I tried just a simple Open Level command on a box trigger. This worked well, except that the program crashes after making several trips through the elevator due to constantly expanding memory arrays going past the 32 bit limit. Seems there’s some sort of memory leak, and I’m not sure where it could be since, aside from the level loads, all that’s been added to the Shooter example were assets/maps. So I’m either missing a step in the open level process that requires you to clean up something or there’s something else going on.

Finally, we thought we might try just splitting the levels off into separate pages. However, in this case we’d still want the user to be able to enter the elevator and either have the page load the next level, or at least alert the user to click a link to go to the next page, so we’d need some cross communication: a variable to track, or have it call a javascript function, something. The only mention of this I found was in this question but it’s not very clear. I read the linked page, but it seems to require knowing function names (assuming they are made available by UE in the first place), which from what I’ve read is not something that’s accessible with Blueprints (at least, I’ve been told that you can convert Blueprints to straight C/C++, which would be essentially what I would need).

So, tl;dr: Having problems with loading levels. Open Level itself has memory issues, I can’t do casting to change spawns like I want, and I don’t know how to/if it’s possible to access a Blueprint variable from the page’s JS. The only other alternative I see is splitting the pages up and forcing users to manually cycle through levels when they’re done, which is a poor user experience. Any insight on at least the memory issue? Solving that is likely easier that the JS one, unless it’s a UE4.5 issue that I can’t solve. Cannot upgrade beyond 4.5 because we can’t export in 4.6 and don’t have the time to convert the project anyway. I’d be extremely happy to know it’s just some little cleanup operation that I have to do manually that was forgotten. Thanks for the help.

3 posts - 1 participant