User Tools

Site Tools


proton:html5_setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
proton:html5_setup [2015/09/09 05:50]
seth
proton:html5_setup [2018/04/12 01:24] (current)
seth
Line 1: Line 1:
 ====Compiling the examples for HTML5 with Enscripten from Windows ==== ====Compiling the examples for HTML5 with Enscripten from Windows ====
  
 +
 +====WARNING:​ This page is out of date, html5 is currently being actively worked on, after it's stable this page will get updated ====
 == About and situation == == About and situation ==
  
Line 78: Line 80:
 === Tips and gotchas === === Tips and gotchas ===
  
-GL emulation is handled by emscripten with the -s LEGACY_GL_EMULATION=1. It's not that great. It works fine for 2D games but expect features to be missing for any 3d stuff you're porting. My game Mindwall is playable, but the lighting and color is wrong. ​ The way forward here is to use GLES 2+ which it can emulate with WebGL much better, but I'm not sure if I want to do that with Proton in general or not right now.+GL Limitations: ​GL emulation is handled by emscripten with the -s LEGACY_GL_EMULATION=1. It's not that great. It works fine for 2D games but expect features to be missing for any 3d stuff you're porting. My game Mindwall is playable, but the lighting and color is wrong. ​ The way forward here is to use GLES 2+ which it can emulate with WebGL much better, but I'm not sure if I want to do that with Proton in general or not right now.
  
-Networking ​if you run the .html locally but try to read/write highscores to scores.php on your webserver it's going to fail.  You'll have to actually upload your files then run it from the actual domain name for it to work, or [[http://​www.html5rocks.com/​en/​tutorials/​cors/​|check out what Cross-Origin Resource Sharings is]] and set up your server to accept stuff from your home IP address.+Networkingif you run the .html locally but try to read/write highscores to scores.php on your webserver it's going to fail.  You'll have to actually upload your files then run it from the actual domain name for it to work, or [[http://​www.html5rocks.com/​en/​tutorials/​cors/​|check out what Cross-Origin Resource Sharings is]] and set up your server to accept stuff from your home IP address. Also, having the www in your url or seems to matter too when it compares domain names.
  
 Proton'​s NetHTTP class to get/post to web sites is emulated behind the scenes with NetHTTP_HTML5.cpp,​ a special version for emscripten that uses emscripten_async_wget2_data. No code changes necessary. Proton'​s NetHTTP class to get/post to web sites is emulated behind the scenes with NetHTTP_HTML5.cpp,​ a special version for emscripten that uses emscripten_async_wget2_data. No code changes necessary.
  
-Screen size:  ​Sorry, it's hardcoded ​in shared\html5\HTML5Main.cpp right nowthis will change soon.   +Screen size:  ​This can be overridden ​in App::​PreInitVideo by changing the globals g_winVideoScreenX and Y(You may need to declare them as extern first (ie, extern int g_winVideoScreenX;​ extern int g_winVideoScreenY;​ yeah, I know, the whole thing is weird but I'm afraid of changing anything now due to backwards compatibility) By default, in HTML5Main.cpp ​it gets set to this:
- +
-As write thisit looks like this in HTML5Main.cpp:​+
  
 <​code>​g_winVideoScreenX = 480; <​code>​g_winVideoScreenX = 480;
 g_winVideoScreenY = 320;</​code>​ g_winVideoScreenY = 320;</​code>​
 +
   
-There is some weirdness to work out with screen scaling and mouse click locations turning wonky when sizes are changed in realtime. ​Right now I'm using enterSoftFullscreen(EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT,​ EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF,​ EMSCRIPTEN_FULLSCREEN_FILTERING_NEAREST) but these can be changed for different behaviorstweak as needed for now. (it's in the same file)+There is some weirdness to work out with screen scaling and mouse click locations turning wonky when sizes are changed in realtime. ​By default it will start in a window, but you can actually get it to start in fullscreen by default by uncommenting ​enterSoftFullscreen(EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT,​ EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF,​ EMSCRIPTEN_FULLSCREEN_FILTERING_NEAREST) but if you do this the mouse clicks are off a bitI don't know why.
  
-There is also the issue of a 102 kb default .html file that is generated that is doing stuff we probably don't need, I've looked in there and it is possible to remove a lot of it (the emscripten logo is in there for instance), hopefully emscripten html generator will have more options in the future, otherwise you can hand edit it and adjust your batch files I guess.  ​+Size: There is also the issue of a 102 kb default .html file that is generated that is doing stuff we probably don't need, I've looked in there and it is possible to remove a lot of it (the emscripten logo is in there for instance), hopefully emscripten html generator will have more options in the future, otherwise you can hand edit it and adjust your batch files I guess.  ​
  
-Size and compression ​- Now, you may say that 1,138 kb .js file for RTBareBones is big, but fear not - it's actually only 264 KB when you run it from my link above.+Compression ​- Now, you may say that 1,138 kb .js file for RTBareBones is big, but fear not - it's actually only 264 KB when you run it from my link above.
  
 What is this witchcraft? The server is compressing it! You can [[http://​www.whatsmyip.org/​http-compression-test/?​url=aHR0cDovL3d3dy5ydHNvZnQuY29tL1JUQmFyZUJvbmVzLmpz|check it here]]. What is this witchcraft? The server is compressing it! You can [[http://​www.whatsmyip.org/​http-compression-test/?​url=aHR0cDovL3d3dy5ydHNvZnQuY29tL1JUQmFyZUJvbmVzLmpz|check it here]].
proton/html5_setup.1441777852.txt.gz · Last modified: 2015/09/09 05:50 by seth