[libgdx] Anatomy of an HTML5 Project?

I posted this on the libGDX forum here, but since it’s a pretty broad question, I haven’t received any replies, so I’m crossposting here.

Long story short: I run a little website that contains tutorials and an uploader for Processing and Java games. I’d like to expand to include html5 projects exported from libGDX.

I have the basics working: exporting from libGDX to html5 using gradle, which creates a dist folder that contains the files to be hosted.

The problem is, these files come in at around 70 MB (just for the default example game that shows an image on a red background). That would be okay if it was just my games being hosted, but we’re talking about multiple users uploading multiple games, so it adds up quickly!

I’m thinking that much of this 70 MB is the same for every game: the libGDX backend and GWT support code. However, I don’t really understand the anatomy of what gets exported, so I’m hoping somebody out there can break it down for me.

I work with GWT, so I understand the basics, but I’m pretty sure the output is obfuscated, so it’s a little difficult to determine exactly what’s going on. I’m trying to compare the output of 2 identical projects, but I’m hoping somebody out there already knows the answers I’m trying to reverse engineer.

Basically, is there a way to host a single shared subset of the output of a libGDX html project, that way any subsequent uploads will be much smaller than the shared codebase? What files do I need to use as the shared codebase? How can I link user uploads to these shared files, especially if the output is different every time thanks to obfuscation?

One little note for the gwt output. I think the WEB-INF subfolder in the output folder is not required and this folder makes up a huge part of the export. The export folder of my last LD game is ~70 MB, the game itself without WEB-INF is only around 10 MB (around half of it is probably from the assets.). So if I understand you correctly you should be able to build the games and then just copy everything except the WEB-INF folder to your desired location. Hope this helps.

Thanks for the reply.

Even if the 70 Mb is mostly from the unnecessary WEB-INF folder (which I believe you are correct about), it still seems a bit wasteful to have ~10 Mb per upload just due to repeated code.

However, somebody on the libGDX forum told me that the repeated code is pretty much impossible to parse out, thanks to how GWT compilation works. Ah well, 10 Mb isn’t the end of the world.

I’d still be interested to hear if anybody has any other ideas for how to approach this, but at this point my plan will be to just host the full 10 Mb per upload and not worry too much about it.

Can I ask a stupid question: if the WEB-INF folder isn’t necessary… what is its purpose at all?

Are there different files with exactly the same contents spread over multiple projects?

No. That’s the annoying part. There aren’t even the same number of files! And I’m exporting the exact same project, so I believe it’s due to GWT’s obfuscation.

I might be able to dig in a little deeper if I could output unobfuscated code from libGDX/GWT.