What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
dusoft
Party member
Posts: 492
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by dusoft »

I used to develop in Love2D, but now haven't had chance past few years. Now, when I run the games, all are colorless.
I have found out that all color definition functions have been switched from 0-255 to 0-1 instead. What was the reasoning behind this in the age of everyone working with web and RGB 0-255 being one of the most widespread schemes of color addressing (or its hex version)?

What makes it worse is that Love2D is now officially completely backward incompatible with any games/soft released before 0.11.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by ivan »

dusoft wrote: Sun Oct 21, 2018 5:43 pmWhat was the reasoning behind this
Shaders
User avatar
lqdev
Prole
Posts: 4
Joined: Sun Oct 21, 2018 4:30 pm
Contact:

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by lqdev »

dusoft wrote: Sun Oct 21, 2018 5:43 pm What was the reasoning behind this in the age of everyone working with web and RGB 0-255 being one of the most widespread schemes of color addressing (or its hex version)?
Apart from shaders, there's also HDR support (which uses 16 bits per channel instead of 8)
MrFariator
Party member
Posts: 509
Joined: Wed Oct 05, 2016 11:53 am

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by MrFariator »

dusoft wrote: Sun Oct 21, 2018 5:43 pm What makes it worse is that Love2D is now officially completely backward incompatible with any games/soft released before 0.11.
There are quite a few other changes that would break backwards incompatibility beyond just setColor. Said function is easy to redefine lua-side to use the old scheme, but stuff like love.graphics.newCanvas also has seen little changes that would necessitate code changes.
MissDanish
Citizen
Posts: 65
Joined: Wed Mar 07, 2018 11:21 pm

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by MissDanish »

MrFariator wrote: Sun Oct 21, 2018 6:05 pm
dusoft wrote: Sun Oct 21, 2018 5:43 pm What makes it worse is that Love2D is now officially completely backward incompatible with any games/soft released before 0.11.
There are quite a few other changes that would break backwards incompatibility beyond just setColor. Said function is easy to redefine lua-side to use the old scheme, but stuff like love.graphics.newCanvas also has seen little changes that would necessitate code changes.
The audio stuff also changed quite a bit, in general LÖVE has never marketed itself as being backwards compatible with each new release. So if you are expecting it then it kind of shows that you aren't really familiar with how things are around here. I can't remember a single release where there weren't at least 2-3 things I had to change and I have been using LÖVE since 0.7.2
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by grump »

It's a bit disappointing that you can add a preferred version to your game, but all it does is display a warning message; the game will still break even if it just calls a function that was merely renamed in the new release. That makes the version check a completely useless feature.

With a little bit of effort, LÖVE could take care to not break API between versions and provide the old interface the game requires, maybe through a compatibility layer. From what I've seen, most changes are not that big to make such an approach unreasonable. It wouldn't be difficult at all to accept 0-1 in 11.x+, but multiply them by 255 when the game requests 0.10.x, for example.

Breaking stuff with each release makes distributing love files completely pointless. Only developers can use them, and I suppose that's what love files are meant for, but even for devs it's a pain in the ass on most systems. It's just a lazy and careless way to provide a gamedev framework.
MissDanish
Citizen
Posts: 65
Joined: Wed Mar 07, 2018 11:21 pm

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by MissDanish »

grump wrote: Sun Oct 21, 2018 7:06 pm It's a bit disappointing that you can add a preferred version to your game, but all it does is display a warning message; the game will still break even if it just calls a function that was merely renamed in the new release. That makes the version check a completely useless feature.

With a little bit of effort, LÖVE could take care to not break API between versions and provide the old interface the game requires, maybe through a compatibility layer. From what I've seen, most changes are not that big to make such an approach unreasonable. It wouldn't be difficult at all to accept 0-1 in 11.x+, but multiply them by 255 when the game requests 0.10.x, for example.

Breaking stuff with each release makes distributing love files completely pointless. Only developers can use them, and I suppose that's what love files are meant for, but even for devs it's a pain in the ass on most systems. It's just a lazy and careless way to provide a gamedev framework.
I disagree, adding such a compatibility layer would probably make the framework slower and more bloated. Which would be very undesirable for a lot of people.
If you're serious about distributing your game you should probably just distribute a .exe, a .app and use one of the methods for distributing on Linux. It's bad to solely rely on the latest version working with your game, it also makes progress harder for LÖVE if we constantly have to worry about compatibility with older games.
MrFariator
Party member
Posts: 509
Joined: Wed Oct 05, 2016 11:53 am

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by MrFariator »

grump wrote: Sun Oct 21, 2018 7:06 pm Breaking stuff with each release makes distributing love files completely pointless. Only developers can use them, and I suppose that's what love files are meant for, but even for devs it's a pain in the ass on most systems. It's just a lazy and careless way to provide a gamedev framework.
If you search around you will quickly find out that LÖVE is in no way unique about breaking API compatibility between different revisions, just ask a developer using Unreal. What often happens is that development studios will simply "lock" onto specific version (see node/npm for example) and develop the product with it, perhaps even modifying that specific version to suit their unique needs. Any time you see a "this product was intended to be used with version x.y.z", it's more about informing the user that things may not work as expected without the correct version and which version to get if that is the case, rather than providing compatibility.

All in all, backwards compatibility is a nice idea, but it can lead to various problems like bloat and loss of performance like pointed out by MissDanish, but also issues like causing confusion by allowing multiple methods achieve the same end-result. That last bit is kind of a headache to maintain.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by grump »

MissDanish wrote: Sun Oct 21, 2018 7:11 pm I disagree, adding such a compatibility layer would probably make the framework slower and more bloated.
Not necessarily. It incresases the size of the runtime a little, but there would be virtually no runtime cost involved after the version the game requires has been detected. The main cost comes from development of such a feature, as you have correctly stated. That is now shifted from the framework devs to the game devs and end users who have to worry about the version installed on the target system. That is bad design, if you ask me.
If you're serious about distributing your game you should probably just distribute a .exe, a .app and use one of the methods for distributing on Linux.
Sure. The question is, what is the purpose of love files then? The only purpose they seem to have is sharing them with other devs. No end user can use them in a reliable way. I don't know if there is stated purpose from the devs - but they are clearly useless for anything else than testing purposes in a relatively short time frame.
It's bad to solely rely on the latest version working with your game
It's also bad to solely rely on the end users AND the developers to have the correct version installed (if love files are meant for distribution).

Using older love files on Linux is a major pain in the ass for anyone who wants to give support to other devs, or play older creations that have no proper distribution, just a plain love file in a 4 year old forum thread. Still painful on Windows, but less so.

Maybe I'm gonna make a LÖVE distribution that runs every love game, regardless of the version it was written for. It's gonna be "large" and redundant, but who would actually care about 50 MB more installed on their 2 TB harddrives for not having to worry about the stupid versions anymore? Too bad it'll be 3 years late, considering that LÖVE is practically dead.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: What was the reasoning for changing setColor from RGB 0-255 to 0-1 interval?

Post by grump »

MrFariator wrote: Sun Oct 21, 2018 7:30 pm All in all, backwards compatibility is a nice idea, but it can lead to various problems like bloat and loss of performance like pointed out by MissDanish, but also issues like causing confusion by allowing multiple methods achieve the same end-result. That last bit is kind of a headache to maintain.
LÖVE is TINY. Storage space is HUGE, even on phones. We're talking about KB vs. GB. Bloat is no argument imho, it could be done in a few hundred KB if done right, and it doesn't have to be baked into every runtime.

Confusion is a question of API design and implementation. Bad design, more confusion. It's too late now to think about compatibility - it should've been done with the first release, when the answer to that question was "yeah, fuck that".
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 49 guests