HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.93k stars 427 forks source link

Throw error on sparrow v1, prevent error when adding frames of size 0 #3096

Closed Cheemsandfriends closed 2 months ago

Cheemsandfriends commented 3 months ago

In Adobe Animate, there's two versions of Sparrow, that basically work out as the same thing, but the only difference is that the width and height attributes are shortened by their initials, As can be shown here:

Spritesheet exported with Sparrow V1: Spritesheet exported with Sparrow V2:

(Also something to mention, Sparrow V1 doesn't seem to support a trimmed version, aka "frameX" and "frameY")

Plus it fixes a common issue that occurs with debugging, And that is when a spritesheet presents a 0x0 instance frame. This is due to a way to simbolise that the frame its using, its an empty one, but flixel doesn't seem to push those frames, causing sometimes massive errors all over the screen. This also fixes it.

Geokureli commented 2 months ago

I was wondering about this, do you actually know anyone that use sparrow v1? is there a program out there that is only capable of producing v1? would it be just as effective and useful if you detected v1 and threw an error saying "Outdated sparrow version detected, be sure to export using sparrow v2 in your programs settings"?

Cheemsandfriends commented 2 months ago

I don't see why not implement it, its just changing looking two values that are shortened basically, and to go through the hassle of throwing an error to detect an older version seems to much than just support it.

(also, I tried to find a texture packer that exported Sparrow V1s, but I struggled to even find packers that exported Sparrow itself aside from Adobe Animate)

Geokureli commented 2 months ago

It's my policy to not add solutions to problems nobody is having, this is open source 101. Is allowing people to use v1 really helping anyone? or is it potentially confusing people about the capabilities of sparrow. If I'm wrong here, I wanna hear it from someone who would actually use this fix

Geokureli commented 2 months ago

Can you give a small example I can use to reproduce the other issue? Also can you share a sparrow v1 atlas and it's v2 counterpart so I can test this

Cheemsandfriends commented 2 months ago

Surely! I made this in a whim trying to test it myself. Don't get confused, Man hi 2 is in fact Sparrow v1 and Man hi is Sparrow v2

Man hi.zip

Cheemsandfriends commented 2 months ago

It's my policy to not add solutions to problems nobody is having, this is open source 101. Is allowing people to use v1 really helping anyone? or is it potentially confusing people about the capabilities of sparrow. If I'm wrong here, I wanna hear it from someone who would actually use this fix

fromSparrow inherently doesn't tell that its a specific version, any user could see the name, read a bit the description and assume "Well, I suppose it has to support both versions right?" Also, the fact that there are two versions imply that Sparrow (The game engine for iOS) had once used this format in early versions. Throwing an error to them could potentially make the user believe the function does not work at all (which, I reiterate again, why even do it in the first place since we're not saying that the changes are astronomically different).

Cheemsandfriends commented 2 months ago

I suppose the solution would be to change the description to specify which version should be used, but I'm genuinely not keen on doing that myself, plus maybe throwing an error is a tad harsh?

Geokureli commented 2 months ago

Throwing an error to them could potentially make the user believe the function does not work at all

afaik the only way to export v1 is to select it in a dropdown in adobe animate which also has v2, the error specifically says "Use sparrow V2"

but also the fact that no one has ever complained about a crash with fromSparrow with the error "could not find attribute 'width'" makes me think this is a non issue

Geokureli commented 2 months ago

plus maybe throwing an error is a tad harsh?

I don't know why people fear errors, or think that throwing an error should be avoided. I'm not scolding the dev, I'm making it very clear to devs that there are better options available during the development process. I doubt anyone will ever see this error, and if they do I doubt they will feel it's "harsh". The alternative is a feature that likely no one should ever use and will likely go unmaintained until it eventually breaks, or gets in the way of maintaining something people actually do use.