leveleditor / CAMM-Crystal-Alien-Map-Maker

CAMM (Crystal Alien Map Maker) open source level/map editor for CrystAlien Conflict.
https://crystalien-redux.com/camm.php
GNU General Public License v2.0
41 stars 5 forks source link

Buggy Images In CAMM on Mac OS #2

Open roberttkahelin8 opened 6 years ago

roberttkahelin8 commented 6 years ago

works fine

buggy camm

The top image is the png export. It works fine. But the bottom image shows in-app displaying some building shadows correctly, while some others and all units shadows don't appear correctly at all. Tiles work fine.

leveleditor commented 6 years ago

You're running CAMM on a Mac using Mono right? Have you tried installing the latest version of Mono? Perhaps it's been updated since last time: https://www.mono-project.com/download/stable/#download-mac (Stable channel button on the right)

If I run CAMM on Ubuntu or Windows using Mono it doesn't have this issue, so it appears that only the Mac version has issues displaying the transparent PNG images.

It's weird though, the code to create the exported PNG file is the same (literally the same function call) as the code to display the map on the screen. The only difference is the destination (file vs. screen). Map drawing function: https://github.com/leveleditor/CAMM-Crystal-Alien-Map-Maker/blob/dad4df0d0e5a1c41a93bae833212330e72b0b677/Crystal-Alien-Map-Maker/src/Objects/Map.vb#L374-L466 PNG export code (calls ActiveMap.Draw, see function above) https://github.com/leveleditor/CAMM-Crystal-Alien-Map-Maker/blob/dad4df0d0e5a1c41a93bae833212330e72b0b677/Crystal-Alien-Map-Maker/src/GUI/Forms/FrmEditor.vb#L1066-L1074

Unfortunately without a way to test the program on a Mac myself, I can't fix any problems that are Mac specific like this one. Anyone who has a Mac and is able to debug and fix this could send a pull request.
I get the feeling this is a bug in Mono though. So it may have to be fixed upstream, in Mono or one of it's dependencies like libpng.

roberttkahelin8 commented 6 years ago

I am just glad CAMM works on Mac, however I will test Mono again with an updated library and all that stuff to see if the problem still persists. If it does, I'll specify which version is buggy on Macs.

roberttkahelin8 commented 6 years ago

Update! The shadows are not the problem, its the actual png files are the problem. sorry about that leveleditor, i missed a spot.

screen shot 2018-07-19 at 3 50 27 pm

There are no shadows in the image above toggled.

leveleditor commented 6 years ago

Did you update Mono and run it on that? Your screenshot shows you are running it in Wine, which from my experience is very unstable so I can't support it in any way. Can you give some more info such as: what happens when you run it under Mono only without Wine, and what's the Mono version and Mac OS version.

Looks like it needs to be run using the following command in Terminal: mono --arch=32 "Crystal Alien Map Maker.exe"

roberttkahelin8 commented 6 years ago

Ok, now without using Wine and Completely relying on the updated latest Mono Version, I still get some image problem, but, the shadows do work. The baseplates are over contrasted or too bright. Also, side note, Mono uses yellower edges than Wine does for "Windows" based windows, kinda resembling Windows 98 or something similar (yellow edges are not a bug though..., thats probably due to my Unix based system rendering).

screen shot 2018-07-24 at 3 38 19 pm

My OS: macOS High Sierra (10.13.2) My Video Card: Intel Iris Plus Graphics 640 1536 MB Type of Computer: MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports) Processor: 2.5 GHz Intel Core i7, 64-bit.

Brian151 commented 6 years ago

@roberttkahelin8

No idea what is the root cause of this, but looks to me like what's happened is the opacity is being treated in a very binary matter, it's either fully opaque, or fully transparent. This same issue afflicts the majority of Minecraft textures.

leveleditor commented 6 years ago

Interesting results here. It's safe to say that the underlying bugs lie within either the Mono source code or one of the libraries it makes use of such as libpng. Finding the cause of these kind of bugs inside this third party source code would be difficult at best, which might explain why they haven't been fixed yet.

I imagine I'd get better results by rewriting the whole GUI to use something like GTK# which was designed to be cross platform, instead of Windows Forms. This simply isn't feasible to do anytime soon as it would require a substantial rewrite and probably converting the code from VB to C#.

Short of that, I can't think of any ways to get around these bugs right now.

I'll leave this issue open though since it's clearly a problem if we want this to run on Mac decently.