Hey, thank you so much for the feedback. I managed to get all of my games to show their titlescreen and the menus work too.
However love.filesystem.read() just hangs the entire script.
I though about writing an alternative using "io." but the asset being loaded is located in my ".love" file.
I suppose wrapping the asset as a string in a ".lua" script and using "require" could work but that's not ideal.
Any tips on working around this?
BTW is there any way of detecting that the code is running from love.js? Something like love's getOS function?
This could be useful so that I can adjust my love files to work across platforms without making special builds just for love.js.
PS. I've also noticed that love.system.openURL doesn't work.
Really appreciate all the help, and hoping to see love.js become more stable in the future.
Love.js - A Direct Emscripten Port
Re: Love.js - A Direct Emscripten Port
- Attachments
-
- arena.love
- updated and trimmed to ~10mb
- (10.17 MiB) Downloaded 347 times
Re: Love.js - A Direct Emscripten Port
Yep!
Zabuyaki, our upcoming beat 'em up: https://www.zabuyaki.com
Re: Love.js - A Direct Emscripten Port
I noticed that you don't have the shader folder in the .love you uploaded?ivan wrote: ↑Tue Sep 15, 2020 9:08 am Hey, thank you so much for the feedback. I managed to get all of my games to show their titlescreen and the menus work too.
However love.filesystem.read() just hangs the entire script.
I though about writing an alternative using "io." but the asset being loaded is located in my ".love" file.
I suppose wrapping the asset as a string in a ".lua" script and using "require" could work but that's not ideal.
Any tips on working around this?
Interesting, I'll look into that. What browser are you on? There is specific code that is meant to make openURL work in-browser. Are you trying to open a website or a local file?
More notes:
- love.window.showMessageBox(title, message, buttons, "info", false) -> message boxes with multiple buttons aren't supported
- Reading from inside the .love works fine. I think if you start the filepath with a / it works all the time (you start with a / sometimes, but not always)
- The love.js:9 exception thrown: TypeError: Cannot read property 'length' of undefined,TypeError: Cannot read property 'length' of undefined error is due to sound, I think. I think it is because the sound file aren't read in fully yet. So you might want to check whether they were properly init-ed before you try to play them or do something with them.
I did actually make it run a couple of times, which is why I think it's an audio loading problem.
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
Thank you so much for taking a look.
I managed to get two of my games working fully so that's very exciting (still no luck with the one mentioned above).
I will definitely be putting up public demos soon.
love.js is great and I think it should be mentioned on the love2d homepage - that would drive further usage and hopefully more development and commits.
One more suggestion - I think the love.js loader should not contain any text.
Instead of "downloading, preparing, powered by, etc..." it's better to just show a simple progress bar.
I am nitpicking here but a progress bar is more obvious and universally understood (furthemore, some games are localized and may not be in English at all).
Also, I will include you in the game credits, please let me know if you'd don't mind being credited as "Davidobot".
Thanks so much!
I managed to get two of my games working fully so that's very exciting (still no luck with the one mentioned above).
I will definitely be putting up public demos soon.
love.js is great and I think it should be mentioned on the love2d homepage - that would drive further usage and hopefully more development and commits.
I removed that folder in order to debug the more essential issues.I noticed that you don't have the shader folder in the .love you uploaded?
Chrome 85.0.4183.102 (official build) (64-bit)Interesting, I'll look into that. What browser are you on?
Yep, trying to open a website (the game's Steam page) when the demo is over.There is specific code that is meant to make openURL work in-browser. Are you trying to open a website or a local file?
This one is fine, and I believe it's not used in the web version of my games.message boxes with multiple buttons aren't supported
Great, I will investigate this further. It does look like love.filesystem.read works in certain cases and fails in others.I think if you start the filepath with a / it works all the time (you start with a / sometimes, but not always)
One more suggestion - I think the love.js loader should not contain any text.
Instead of "downloading, preparing, powered by, etc..." it's better to just show a simple progress bar.
I am nitpicking here but a progress bar is more obvious and universally understood (furthemore, some games are localized and may not be in English at all).
Also, I will include you in the game credits, please let me know if you'd don't mind being credited as "Davidobot".
Thanks so much!
Re: Love.js - A Direct Emscripten Port
I've brought this up with slime73 a few days ago. They said they were happy to bring it to mainline once it is stable.
I pushed a fix for that just now.
Would be super to hear if you discover anything!
Hm, I see what you mean. The "loader" can easily be configured. It's just in the index.html file that is generated. For example, if you want, you can edit drawLoadingText and setStatus to make the loading screen black with a white loading bar and no text.ivan wrote: ↑Wed Sep 16, 2020 10:30 am One more suggestion - I think the love.js loader should not contain any text.
Instead of "downloading, preparing, powered by, etc..." it's better to just show a simple progress bar.
I am nitpicking here but a progress bar is more obvious and universally understood (furthemore, some games are localized and may not be in English at all).
I only ported Tanner's work to 11.3 Not too much hassle. If you'd like to credit me, Davidobot is just fine. If you have links, it'd be nice to link to my website https://davidobot.net/ otherwise just the username is enough
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
Hey, I finally managed to figure it out.
The following line was causing a crash on my system:
I have disabled this line specifically for the web version of the game and it seems to run fine now.
Attached is the latest .love file if you want to take a look.
Thanks again for all of the help, I will make sure to credit both you and Tanner for your great work.
And I'll mention love.js on the official issue tracker and hopefully we can bring more attention to this great project.
Cheers!
The following line was causing a crash on my system:
Code: Select all
love.audio.stop()
Attached is the latest .love file if you want to take a look.
Thanks again for all of the help, I will make sure to credit both you and Tanner for your great work.
And I'll mention love.js on the official issue tracker and hopefully we can bring more attention to this great project.
Cheers!
- Attachments
-
- arena.love
- Skullmaster's Arena demo for the web
- (4.49 MiB) Downloaded 267 times
Re: Love.js - A Direct Emscripten Port
Nice fix, I can confirm that love.system.openURL works perfectly now.
I managed to get all of my games working and the performance is pretty good.
So far it looks like the major issue is: errors in pcall cause the entire script to fail when used in a coroutine (as mentioned earlier).
Another significant bug is that love.filesystem.read crashes when the file doesn't exist (the same happens with love.filesystem.load).
I think it's certainly possible to circumvent some of these issues by using pure Lua.
For example, there could be a "normalize.lua" script loaded ahead of time that replaces the vanilla "pcall".
Any tips for the "reload the page if screen is blank" bug?
This one is annoying and happens about 1/3 of the time.
Thanks again!
PS. Another minor bug and this one is Lua-related:
string.format("%s", true) raises an error in love.js whereas it does not with Love2D
PSS. Any tips on making love.js embed-able?
Would be awesome if the canvas object can be scaled on responsive pages.
We don't need to resize the game resolution,
just scaling the canvas so the game can be embedded in a section of the window.
I managed to get all of my games working and the performance is pretty good.
So far it looks like the major issue is: errors in pcall cause the entire script to fail when used in a coroutine (as mentioned earlier).
Another significant bug is that love.filesystem.read crashes when the file doesn't exist (the same happens with love.filesystem.load).
I think it's certainly possible to circumvent some of these issues by using pure Lua.
For example, there could be a "normalize.lua" script loaded ahead of time that replaces the vanilla "pcall".
Code: Select all
-- normalization fix for lfs.read:
local lfs = love.filesystem
local _read = lfs.read
function lfs.read(fn, ...)
if lfs.getInfo(fn) ~= nil then
return _read(fn, ...)
end
end
This one is annoying and happens about 1/3 of the time.
Thanks again!
PS. Another minor bug and this one is Lua-related:
string.format("%s", true) raises an error in love.js whereas it does not with Love2D
PSS. Any tips on making love.js embed-able?
Would be awesome if the canvas object can be scaled on responsive pages.
We don't need to resize the game resolution,
just scaling the canvas so the game can be embedded in a section of the window.
Re: Love.js - A Direct Emscripten Port
Noted all the queries as bugs in the GitHub issue tracker!
EDIT:
I think if you change the dimensions of the "canvas" element via JS on the page, it should call love.resize in-game.
EDIT:
I just pushed a new version that prints out the error if the screen is blank. This occurred when an error was thrown by love before the main window was initialised.
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
I tried adding a function to index.html which resizes the canvas automatically but it didn't quite work:
Code: Select all
window.addEventListener("resize", function(e) {
var canvas = document.getElementById("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}, false);
It would be good to intercept errors and show something as a fallback.
Other than that love.js works great. Here is one my games running with love.js:
https://2dengine.com/superchains/
I am using non-compatibility mode because the audio seems more stable.
Huge thanks again and keep up the great work!
Re: Love.js - A Direct Emscripten Port
Found another minor bug: setWrap("repeat", "repeat") doesn't seem to work correctly.
If you look at my previous arena.love build - you can see that the texture "bleeds" and doesn't repeat at all.
The shiny logo effect is supposed to look like this:
I have figured out a way to draw this effect without using quads/setWrap, but it should be noted.
Thanks again!
If you look at my previous arena.love build - you can see that the texture "bleeds" and doesn't repeat at all.
The shiny logo effect is supposed to look like this:
I have figured out a way to draw this effect without using quads/setWrap, but it should be noted.
Thanks again!
Who is online
Users browsing this forum: No registered users and 8 guests