Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (799)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (865)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [libgdx] Anatomy of an HTML5 Project?  (Read 6394 times)
0 Members and 1 Guest are viewing this topic.
Offline KevinWorkman

« JGO Plugged Duke »


Medals: 288
Projects: 12
Exp: 12 years


HappyCoding.io - Coding Tutorials!


« Posted 2014-12-29 19:54:18 »

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?

HappyCoding.io - Coding Tutorials!
Happy Coding forum - Come say hello!
Offline atombrot
« Reply #1 - Posted 2014-12-30 13:24:40 »

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.
Offline KevinWorkman

« JGO Plugged Duke »


Medals: 288
Projects: 12
Exp: 12 years


HappyCoding.io - Coding Tutorials!


« Reply #2 - Posted 2014-12-30 16:17:56 »

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.

HappyCoding.io - Coding Tutorials!
Happy Coding forum - Come say hello!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KevinWorkman

« JGO Plugged Duke »


Medals: 288
Projects: 12
Exp: 12 years


HappyCoding.io - Coding Tutorials!


« Reply #3 - Posted 2014-12-30 17:11:08 »

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

HappyCoding.io - Coding Tutorials!
Happy Coding forum - Come say hello!
Offline Riven
Administrator

« JGO Overlord »


Medals: 1370
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2014-12-30 17:13:53 »

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

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline KevinWorkman

« JGO Plugged Duke »


Medals: 288
Projects: 12
Exp: 12 years


HappyCoding.io - Coding Tutorials!


« Reply #5 - Posted 2014-12-30 17:16:50 »

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.

HappyCoding.io - Coding Tutorials!
Happy Coding forum - Come say hello!
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (201 views)
2019-09-04 15:33:17

hadezbladez (4922 views)
2018-11-16 13:46:03

hadezbladez (1815 views)
2018-11-16 13:41:33

hadezbladez (5196 views)
2018-11-16 13:35:35

hadezbladez (1025 views)
2018-11-16 13:32:03

EgonOlsen (4397 views)
2018-06-10 19:43:48

EgonOlsen (5230 views)
2018-06-10 19:43:44

EgonOlsen (2973 views)
2018-06-10 19:43:20

DesertCoockie (3876 views)
2018-05-13 18:23:11

nelsongames (4308 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!