Great, I managed to figure out how to switch source files:
https://2dengine.com/lovejs/?g=commando.love
https://2dengine.com/lovejs/?g=arena.love
https://2dengine.com/lovejs/?g=chains.love
https://2dengine.com/lovejs/?g=collisions.love
Looks like I broke the caching feature, but I will try to get that fixed.
Attached is the latest player code. I will send a pull request once the cache is fixed.
Love.js - A Direct Emscripten Port
Re: Love.js - A Direct Emscripten Port
- Attachments
-
- lovejsplayer.zip
- (3.16 MiB) Downloaded 2298 times
Re: Love.js - A Direct Emscripten Port
I get the security aspect, but I don't think it's such a necessary precaution here. For example, you can just change https://github.com/Davidobot/love.js/bl ... ame.js#L29 and load the "game.data" (which is just a .love file) from any hosted url.
The majority of index.js can be cut out if you assume the passed argument is a .love file and not a folder - the file size is necessary if the passed thing is a folder.
I believe all you need to do for a portable .love file is provide the file's metadata (https://github.com/Davidobot/love.js/bl ... ex.js#L120, which is created here https://github.com/Davidobot/love.js/bl ... dex.js#L96 and used here https://github.com/Davidobot/love.js/bl ... me.js#L127 ). Alternatively, just scrap the metadata and change game.js#L127 to just read in the provided .love file with the correct file size.
EDIT: looks like you managed without my help while I was typing this up maybe some of these ramblings will be useful.
The majority of index.js can be cut out if you assume the passed argument is a .love file and not a folder - the file size is necessary if the passed thing is a folder.
I believe all you need to do for a portable .love file is provide the file's metadata (https://github.com/Davidobot/love.js/bl ... ex.js#L120, which is created here https://github.com/Davidobot/love.js/bl ... dex.js#L96 and used here https://github.com/Davidobot/love.js/bl ... me.js#L127 ). Alternatively, just scrap the metadata and change game.js#L127 to just read in the provided .love file with the correct file size.
EDIT: looks like you managed without my help while I was typing this up maybe some of these ramblings will be useful.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Love.js - A Direct Emscripten Port
Cross domain xmlrpc requests are certainly possible, but it has caveats. For example, if the domain hosting the player uses SSL and the other domain doesn't then the request may get blocked.Davidobot wrote: ↑Tue Feb 02, 2021 3:38 pm I get the security aspect, but I don't think it's such a necessary precaution here. For example, you can just change https://github.com/Davidobot/love.js/bl ... ame.js#L29 and load the "game.data" (which is just a .love file) from any hosted url.
Great, I will look into this. Any help is greatly appreciated!I believe all you need to do for a portable .love file is provide the file's metadata (https://github.com/Davidobot/love.js/bl ... ex.js#L120, which is created here https://github.com/Davidobot/love.js/bl ... dex.js#L96 and used here https://github.com/Davidobot/love.js/bl ... me.js#L127 ). Alternatively, just scrap the metadata and change game.js#L127 to just read in the provided .love file with the correct file size.
PS. Yes, I managed to get the cache fixed. Basically I am getting the package size during the xmlrpc request and then storing it in the cache. My solution is hacky but I don't want to rewrite the entire game.js file. I have also added a proper useragent check and the &f=1 parameter which hides the fullscreen button.
BTW does anybody know where I can find the nogame.love file for 11.3?
So yea, it will need more work, but here is what I have so far. Next, I will think about how this the player be embedded on websites.
- Attachments
-
- lovejsplayer.zip
- (3.16 MiB) Downloaded 2090 times
Re: Love.js - A Direct Emscripten Port
Super! No solution is "hacky" if it works What's the useragent check do? Also, did you manage to figure out why it sometimes gives a MIME error for wasm?ivan wrote: ↑Tue Feb 02, 2021 3:57 pm PS. Yes, I managed to get the cache fixed. Basically I am getting the package size during the xmlrpc request and then storing it in the cache. My solution is hacky but I don't want to rewrite the entire game.js file. I have also added a proper useragent check and the &f=1 parameter which hides the fullscreen button.
BTW does anybody know where I can find the nogame.love file for 11.3?
So yea, it will need more work, but here is what I have so far. Next, I will think about how this the player be embedded on websites.
The code for nogame can be found here: https://github.com/Davidobot/love/blob/ ... nogame.lua you can just rip that and put it into a .love
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Love.js - A Direct Emscripten Port
Checks if we are using a mobile browser in which case it goes into compatibility mode.What's the useragent check do
Also discovered navigator.deviceMemory which could be used to define and clamp the allocated memory.
I remember researching into this a while ago, but I can't recall the cause for this warning.Also, did you manage to figure out why it sometimes gives a MIME error for wasm?
Thanks for the nogame, but I can't get it to run. I get "pthread_sigmask()" is not supported.
Also have some issues running love files using a relative path, but these are minor gripes.
Thanks so much for the help!
Re: Love.js - A Direct Emscripten Port
Got it, thanks!
Maybe something to do with the string encoded images? I might try to get a version running when I find the time...
Thanks so much for your contributions. I early await accepting your pull requests
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
personal page and a raycaster
Re: Love.js - A Direct Emscripten Port
Thanks it was an oversight on my part. The nogame.love works fine with love.js.Maybe something to do with the string encoded images? I might try to get a version running when I find the time...
Thanks again for the help!
-
- Citizen
- Posts: 66
- Joined: Tue Jan 14, 2014 11:03 pm
Re: Love.js - A Direct Emscripten Port
I love the idea of a small executable where one could drop it’s game and generate the web version. I guess it will have to be a separate download. Definitely the right spirit!
I’m getting a loading failed on all the latest examples posted and locally as well.
I’m getting a loading failed on all the latest examples posted and locally as well.
Re: Love.js - A Direct Emscripten Port
You don't need to build the web player. Just copy it on a server and it will work. It won't work locally without a server. If you are getting "loading failed" you probably need to flush your browser cache or open a new incognito window.
You need to use the g= argument to specify which love file to load:
index.html?g=mygame.love
The love file has to be in the same folder as the player until we figure this out.
You need to use the g= argument to specify which love file to load:
index.html?g=mygame.love
The love file has to be in the same folder as the player until we figure this out.
- Attachments
-
- lovejsplayer.zip
- (3.31 MiB) Downloaded 2023 times
-
- Citizen
- Posts: 66
- Joined: Tue Jan 14, 2014 11:03 pm
Re: Love.js - A Direct Emscripten Port
yes, was testing from a local webserver. The new zip file works marvelously
Who is online
Users browsing this forum: Bing [Bot] and 0 guests