Page 1 of 1

Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Sat Nov 14, 2020 2:33 am
by Jazorhe
Hi all,

I am currently encountering issues when distributing a Windows executable.

I am developing my game on macOS.

My steps to creating a Windows executable is below, following this link:
https://love2d.org/wiki/Game_Distributi ... on_the_web

- Compress in MacOS using either command line or right-click > compress
- Rename the compressed file with .love suffix
- Move the .love file into the extracted Windows 32bit / 64bit love2d directory (downloaded from: https://www.love2d.org/)
- In the command line, use: cat love.exe game.love > game.exe to create the executable
- Run the game

The results are as followed:
- The Game Runs
- There is no sound in the game on Windows side, but on the Mac version (.love version), all audio plays correctly
- Sprites also look different on the Windows side (see attached images), it was meant to be a square box around some text from a sprite sheet, however, the top of the sprite has been cutoff in the Windows .exe distribution.

Could anyone please advice what is happening here? I am currently participating in a Game Jam and this game will soon need to be shipped.

What are the common problems when creating Windows executable on a mac and what could have been done in the source code/distribution process to avoid these potential issues?

Thanks, guys.

Re: Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Sat Nov 14, 2020 2:52 am
by Jazorhe
My second screenshot seems to be lost.

Here is re-attaching it again:

Re: Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Sat Nov 14, 2020 12:15 pm
by ReFreezed
It sounds like you're doing things correctly. Are you including the sound files in the .love file? Do you use the correct letter case for all filenames in the .love file and in the code? For the drawing, are you rendering things unscaled at integer coordinates? Nearest-neighbor filtering can hide lines of pixels if the image is drawn with a smaller scale for example. Do the quads for the sprite sheet use the correct values?

Also, does the .love file work on Windows? I.e., running: love.exe game.love

Re: Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Sun Nov 15, 2020 11:12 am
by Jazorhe
ReFreezed wrote: Sat Nov 14, 2020 12:15 pm It sounds like you're doing things correctly. Are you including the sound files in the .love file? Do you use the correct letter case for all filenames in the .love file and in the code? For the drawing, are you rendering things unscaled at integer coordinates? Nearest-neighbor filtering can hide lines of pixels if the image is drawn with a smaller scale for example. Do the quads for the sprite sheet use the correct values?

Also, does the .love file work on Windows? I.e., running: love.exe game.love
Hi, thanks for responding to my question.

I found the issue to the audio and its unrelated to love2d, it is in my Windows VM settings.

As for the sprite, I found the issue with rendering position not being integer all the time and that messed with the sprites somehow.

However, I encountered a new issue that could be related. I need to scale these images in the Playstate, some needs to be scaled 2 times and there is no issue rendering them, some other needs to be scaled 1.5 times and here comes the issue:

- Things are rendering correctly when run on macOS (.love file)
Screen Shot 2020-11-15 at 9.56.57 pm.png
Screen Shot 2020-11-15 at 9.56.57 pm.png (26.35 KiB) Viewed 5053 times
- Things become blurred when run on Windows (both .love and .exe files)
Screen Shot 2020-11-15 at 9.56.45 pm.png
Screen Shot 2020-11-15 at 9.56.45 pm.png (30.26 KiB) Viewed 5053 times
I believe this is a scaling rendering issue, but how may I solve this?

Thank you.

Re: Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Sun Nov 15, 2020 7:49 pm
by ReFreezed
It looks like the top image is drawn on a high-resolution screen and the bottom on a low-resolution screen. There are many different solutions to this problem, but you should basically make sure the thing you're rendering to (the screen or a canvas) has a high enough resolution if you want to have odd scaling of things (allowing you to render "sub-pixels" or pixels with different sizes), otherwise you'll end up with the bottom screenshot where some of the pixels of the scaled image appear one real pixel bigger/smaller on the actual screen/canvas than other pixels of the image.

You could render the whole game to a canvas with a higher resolution and then draw the canvas scaled-down on the screen (with linear filtering). For example, if you want your game screen to be 100x80 pixels, create a canvas 4 times as big, render everything to it at 4 times the scale, and then render the canvas to the screen with 1/4 scale.

I do feel this is really another VM issue though, if I were to guess. You should test the game outside any VM, or ask someone else to test it.

Re: Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Sun Nov 15, 2020 11:04 pm
by Jazorhe
Thanks for your advice. I will look through these things and find out what is happening.

Re: Love2d Distribution on Windows have no sound, and has sprite issue

Posted: Mon Nov 16, 2020 12:00 am
by ReFreezed
Here's an idea. Does your Mac have a Retina display? I.e. the pixel density is twice as high. If the VM doesn't know that or doesn't handle that well and therefore is using a half the resolution for the virtual screen for Windows, then that would explain why the VM vs macOS screenshots look different, and also why scaling images specifically to 1.5 times looks fine in macOS (as they take up 3 actual screen pixels) but not in Windows in the VM window (as they take up 1.5 screen pixels, which would cause that ugly effect).