Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magic pink won't become transparent on macOS (both Intel and ARM64) #431

Open
SimonN opened this issue Mar 5, 2022 · 12 comments
Open

Magic pink won't become transparent on macOS (both Intel and ARM64) #431

SimonN opened this issue Mar 5, 2022 · 12 comments
Labels
1-critical Mac Doesn't happen on Linux or Windows

Comments

@SimonN
Copy link
Owner

SimonN commented Mar 5, 2022

Workaround: Mass-replace the magic pink with proper transparency. You need ImageMagick 7.x installed. Open a shell, navigate to Lix's directory, then run:

find images/ data/images/ -name \*.png -exec magick {} -transparent \#FF00FF {} \;

Originally reported by naymapl in #430:

Lix 0.9.42 builds and runs on Mac mini m1 that runs macOS ARM64. (We had to edit dub.json as in #430.) Some graphics have problems:

  • Lix doesn't replace the magic pink with transparency. This happens in the mouse cursor and it also happens on terrain. This affects physics, the lix will walk over the pink rectangle.
  • Lix doesn't recolor the symbols on the UI buttons. The symbols are light grey, not the expected desaturated light blue.

cameo69 reports that this same bug also manifests on an Intel Mac.

Zrzut ekranu 2022-03-4 o 09 22 48

@SimonN
Copy link
Owner Author

SimonN commented Mar 5, 2022

@naymapl wrote:

ok. I check source and all png files have this pink layer. Maybye is better to create source png files with real transparent layers ?

That would fix the pink, and give you correct physics. If you want it really fast, you could, in theory, go through the tiles in images/ yourself and replace the pink with full transparency (alpha 0) in all images.

Even replacing pink with transparency in the image files would still leave the wrongly-colored symbols on the buttons, but those aren't as important.

Lix 0.9.42 should, by itself, replace the pink with transparency and recolor the button symbols, but it doesn't. I've already investigated the source roughly: Allegro 5 and the addons are initialized, and I compute the colors with al_map_rgb_f afterwards. This should rule out any endianness issues.

But this is the first time that somebody is running Lix on macOS ARM64. Anything might be the problem. I'll investigate.

@naymapl
Copy link

naymapl commented Mar 5, 2022

Answer is not so simple :D

mouse l

I prepare file with transparent layer and now have no cursor :D

Zrzut ekranu 2022-03-5 o 17 10 43

@naymapl
Copy link

naymapl commented Mar 5, 2022

Ok - now is working - I maybye use wrong file name ;)

@naymapl
Copy link

naymapl commented Mar 5, 2022

Is it any way to make it bulk ? It so many images to make one by one :D

https://graphicdesign.stackexchange.com/questions/16120/batch-replacing-color-with-transparency

I found this but no idea how run this with LixD images.

@SimonN
Copy link
Owner Author

SimonN commented Mar 5, 2022

Lix images are normal PNGs with alpha. Assuming you have ImageMagick 7.x installed, here's a loop:

find images/ data/images/ -name \*.png -exec magick {} -transparent \#FF00FF {} \;

find -exec \; runs the command (that is in-between exec and \;) per file, and {} becomes the found filename.

Still looking for the problem in Lix or Allegro on macOS ARM64. What I do in Lix should work on all systems. Really makes me wonder...

@naymapl
Copy link

naymapl commented Mar 5, 2022

Thank you so much - working perfect ;) Now game looks perfect on Apple Silicon macOS.
Zrzut ekranu 2022-03-5 o 18 03 23

If you want to test something just let me know.

btw will be nice to create lixd.app with icon for your app, for example with this app:

https://github.com/machinebox/appify

@SimonN
Copy link
Owner Author

SimonN commented Mar 19, 2022

(Sorry for late reply.)

Great to hear that you can play singleplayer well! I'll keep this workaround in mind then -- the shell loop to recolor all graphics.

The in-game recoloring still fails for the button icons. But the grey button icons (instead of pale blue) aren't a problem for singleplayer playability. You can still tell what's what.

But in multiplayer, you'd have 8 identical-looking player colors instead of 8 different lix colors. This would be more serious, you wouldn't be able to tell apart lix of different players. Thus, I won't close this bug yet.

@cameo69
Copy link

cameo69 commented Jun 3, 2022

Hi, for what it's worth, I have the same problem on an Intel Mac. And I think I cannot win Level 11 "Beneath the Lab" like this because Lemmings are repelled by the pink. Hence no way to get them out of the game :-(

Pasted Graphic 4

Guess I will try changing all graphics as suggested.

@cameo69
Copy link

cameo69 commented Jun 3, 2022

find images/ data/images/ -name *.png -exec magick {} -transparent #FF00FF {} ;

did the trick. Thank you so much.

image

@SimonN
Copy link
Owner Author

SimonN commented Jun 4, 2022

Thanks for the report that this bug manifests on the Intel Mac!

I haven't investigated since March 2022, but it's getting more important again. Lix is largely unplayable on all Macs until we mass-replace the pink with the shell loop, and even then, the UI elements remain unrecolored.

@SimonN SimonN changed the title Magic pink won't become transparent on macOS ARM64 Magic pink won't become transparent on macOS (both Intel and ARM64) Jun 4, 2022
@SimonN
Copy link
Owner Author

SimonN commented Jan 24, 2023

My new year's resolution for 2023 is to solve this recoloring bug.

I still don't have a Mac, but I have a first theory for you to test:

Clone my unstable Lix repository.
Check out branch issue431. I deleted this and merged it into Lix 0.10.7.

  1. Check out a more recent Lix version, 0.10.7 or newer, e.g., the current 0.10.14.
  2. Build and run Lix as usual.

Do the levels from your earlier screenshots (Beneath the Lab, or the basher tutorial) still show the pink rectangles?

@SimonN
Copy link
Owner Author

SimonN commented Mar 15, 2023

@cameo69, please post the output of dub build -f. I'm interested in the line Performing "release" build [...].

E.g., naymapl on ARM had Performing "release" build using ldc2 for aarch64, arm_hardfloat. Do you get "hardfloat" too? Background: I have some theories about the ALLEGRO_COLOR struct: Possible longer float than 32-bit, possible padding even though the struct is { float, float, float, float }.

SimonN added a commit that referenced this issue Mar 25, 2023
@SimonN SimonN added the Mac Doesn't happen on Linux or Windows label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-critical Mac Doesn't happen on Linux or Windows
Projects
None yet
Development

No branches or pull requests

3 participants