Nifflas' Support Forum

Released Games => Knytt Stories => Topic started by: Exp HP on November 26, 2009, 04:44:16

Title: Annoying editor transparency display bug
Post by: Exp HP on November 26, 2009, 04:44:16
This really bugs me.  It's a difference between how the game and the editor display graphics.

In the game, whenever you have two transparent tiles or objects on top of eachother, they add in effect (meaning if you have two shadows on top of eachother, they turn darker, and if you have two glowing things on top of eachother, they get brighter).

In the Editor, two transparent tiles add in effect only if they are different.  This means that if you place the same transparent tile on the same square in two different layers, it will look like there's only one tile there.

Not only is the editor's display behavior unintuitive, but it also means that a level might look different in the game than it does in the editor.  This is demonstrated in the attached image.


Is this intentional?  Seems odd to me...

This puzzled me a lot a while ago when I was using the Lasers tileset in my level.  The lasers aren't particularly bright (not against a green background, at least), so I always had to double them up, and it bugged me that I always had to pick different lasers in order for them to look brighter.  Just today I tried putting orange on orange and realized it was still bright in the game even though it wasn't in the editor. X-P
Title: Re: Annoying editor transparency display bug
Post by: Purple Pineapple on November 26, 2009, 05:11:36
You can notice this bug aswell with transparent ground tiles:
&=transparent
*=2 times transparent

   &&&&&&&&&
    &&&&&&&&&
    &&&&&&&&&
&&&&****&&&&&
&&&&*&&*&&&&&
&&&&****&&&&&
&&&&&&&&
&&&&&&&&


The && in the middle must be doubled up on two layers, but you can't tell in the editor. I had this problem with Bass's ice castle tileset.
Title: Re: Annoying editor transparency display bug
Post by: LPChip on November 26, 2009, 11:45:37
I'd say, learn how this bug works, and turn it into a feature.

With that I mean: You can work around it, so its not a bug that has to be fixed. But when you know how it works, you can use it as a design features to make neater transparent paths.
Title: Re: Annoying editor transparency display bug
Post by: LimeLemon on November 26, 2009, 12:13:43
No feature here.
In the game [...] they add in effect

In the Editor, two transparent tiles add in effect only if they are different.

[...] a level might look different in the game than it does in the editor.
Title: Re: Annoying editor transparency display bug
Post by: Nifflas on November 26, 2009, 12:20:35
In either case, it's a Multimedia Fusion 2 artifact. I can not fix it.
Title: Re: Annoying editor transparency display bug
Post by: Pick Yer Poison on November 26, 2009, 18:38:22
I think pseudo-alpha may be the culprit here. That is, when you create a tileset with actual transparency, KS loads it as pseudo-transparency.
Code: [Select]
Where the actual block is
#####
#####
#####
#####
#####

KS loads it as

# # #
 # #
# # #
 # #
# # #
Thus, two of the same tile would have exactly the same transparent areas. That's like looking through two holes on different walls at the same time; you can see the end just as easily as you could if the second wall wasn't there at all.

I don't know if MMF 2 does this, though, so please tell me if that's not it.
I imagine this problem is a result of Game Maker's capabilities.
Fail. X-P
Title: Re: Annoying editor transparency display bug
Post by: Nifflas on November 29, 2009, 13:25:42
I don't think so, MMF2 handles actual transparency and it does it nicely. I mean, if you put a tile over another identical one but just change one pixel to be different, it should work. My wild speculation is that MMF1 before it supported the alpha channel was optimized to disregard all but one of multiple identical tiles stacked on top of each other since only one would actually need to be rendered. Then they must have forgot to change this behaviour when MMF2 got the alpha channel.
Title: Re: Annoying editor transparency display bug
Post by: Comhon on November 29, 2009, 14:46:23
I know this bug. I am using the effect in my level.
Title: Re: Annoying editor transparency display bug
Post by: Exp HP on November 29, 2009, 21:17:30
I don't think so, MMF2 handles actual transparency and it does it nicely. I mean, if you put a tile over another identical one but just change one pixel to be different, it should work. My wild speculation is that MMF1 before it supported the alpha channel was optimized to disregard all but one of multiple identical tiles stacked on top of each other since only one would actually need to be rendered. Then they must have forgot to change this behaviour when MMF2 got the alpha channel.
Then I must ask...
If this behavior is inherent to MMF2, why does the actual Knytt Stories game not exhibit this behavior?  And is there any reason you didn't implement the game's rendering behavior in the editor?

(actually, since I enjoy guessing how stuff works, I'll take a stab at answering my own questions:
In the game, you probably pre-render a composite image of the BG + all 4 tile layers when a screen is loaded to optimize game speed (which explains why you don't have any foreground tile layers), whereas you just have a bunch of sprites (or MMF2 equivalent objects) in the Editor.  Thus the game displays tile transparency correctly because your code explicitly draws them one-by-one onto an image (as opposed to sprites, which MMF2 manages for you).
And you didn't implement the game's behavior in the editor because tiles can change in the editor.)
Title: Re: Annoying editor transparency display bug
Post by: Nifflas on November 30, 2009, 10:04:14
There's a technical difference in the editor and game. The editor separates the layers into actual Multimedia Fusion 2 layers to be able to show or hide certain layers. The game itself renders everything into the same on top of each other. There must be some internal difference to how objects are handles in those situations.