Skip to content

add second palette#16538

Closed
spacek531 wants to merge 7 commits into
OpenRCT2:developfrom
spacek531:green-remap-import
Closed

add second palette#16538
spacek531 wants to merge 7 commits into
OpenRCT2:developfrom
spacek531:green-remap-import

Conversation

@spacek531

@spacek531 spacek531 commented Jan 29, 2022

Copy link
Copy Markdown
Collaborator

Custom content creators struggle with handling 8-bit png when creating and editing sprites, and most tools to create custom content for RCT2 utilise a different palette than OpenRCT2. The OpenRCT2 palette does not have unique RGB values for every palette color - several animated water colors have the same RGB value, which cause problems when importing and exporting in true color.

This PR attempts to address both issues by providing native support for the RCT2 palette as well defining one's own palette to import/export with.

todo:

  • plan of action for animated water colors

features:

  • color 0 exports as opaque on custom palettes with opaque 0th pixel

testing plan:

  • build gx using 3 different palettes
  • append image to gx using 3 different palettes
  • export gx using 3 different palettes
  • exportall using 3 different palettes
  • exportalldat using 3 different palettes
  • build g2 and run game
  • run game with parkobj with image loading (X123M3-256's trains work for this)

testing results:

  • build with green
  • build with custom
  • append with green
  • append with custom
  • export with green
  • export with custom
  • exportall with green
  • exportall with custom
  • exportalldat with green
  • exportalldat with custom

@duncanspumpkin

Copy link
Copy Markdown
Contributor

Wouldn't the better option be that you can specify a user defined palate? What happens when someone wants to use it with some other remap colour.

@spacek531

Copy link
Copy Markdown
Collaborator Author

I did think of that, but I didn't think of an elegant way to add it to the sprite entry of a sprite list manifest.

@duncanspumpkin

Copy link
Copy Markdown
Contributor

You could just provide a 1x256 bitmap of your colours. I think that would work.

@spacek531

Copy link
Copy Markdown
Collaborator Author

that is a good idea

@Gymnasiast Gymnasiast self-requested a review January 29, 2022 13:17
@ZehMatt

ZehMatt commented Jan 29, 2022

Copy link
Copy Markdown
Contributor

I have to agree with @duncanspumpkin I don't think this is practical doing it this way, user defined palettes would avoid adding code for every specific case.

@IntelOrca

Copy link
Copy Markdown
Contributor

We also have an option to use the raw indices that are stored in .png file. This is faster and would allow you to use any colour, because the game would only use the raw byte index for each pixel rather than using a colour lookup table.

@spacek531

Copy link
Copy Markdown
Collaborator Author

I know that, but the tools to create 8-bit images elude me, and this was the easiest option.

@Gymnasiast

Gymnasiast commented Feb 6, 2022

Copy link
Copy Markdown
Member

Wouldn't the better option be that you can specify a user defined palate? What happens when someone wants to use it with some other remap colour.

I should point out that every other tool in existence uses green as the primary remap instead of orange. As such, I think building it in makes more sense in this case.


Since I’m not a fan of adding another parameter for the green remap, I have done a refactor which should make it easy. See here: #16601

After that one is merged, this PR should be updated to use it. Additionally, since palette: keep and this are mutually exclusive, the green palette should be triggered by palette: green, IMO.

@duncanspumpkin

Copy link
Copy Markdown
Contributor

Wouldn't the better option be that you can specify a user defined palate? What happens when someone wants to use it with some other remap colour.

I should point out that every other tool in existence uses green as the primary remap instead of orange. As such, I think building it in makes more sense in this case.

As that is not true that is the reason why i suggested having the ability to provide any palette.

@Gymnasiast

Copy link
Copy Markdown
Member

As that is not true that is the reason why i suggested having the ability to provide any palette.

Ok, can you name a tool that doesn’t use green for primary remap? The Object Editor, Trigger’s tools and the RCT2 GUI Editor all use that palette.

@spacek531

Copy link
Copy Markdown
Collaborator Author

As that is not true that is the reason why i suggested having the ability to provide any palette.

Ok, can you name a tool that doesn’t use green for primary remap? The Object Editor, Trigger’s tools and the RCT2 GUI Editor all use that palette.

Landmark editor uses an alternative palette. I vaguely recall one other, but I don't remember its name or what it did.

@spacek531

spacek531 commented Feb 9, 2022

Copy link
Copy Markdown
Collaborator Author

I'm looking to suggestions on making the command line parsing less bad, as well as setting the actual data of each PaletteBGRA. And open to suggestions on removing the new header file. I added it because I added the palette as an optional parameter which has to be declared above the function declaration, and I didn't know how to do that without moving the declaration 256 lines of data above the declaration or moving them into a header.

@Gymnasiast

Copy link
Copy Markdown
Member

As that is not true that is the reason why i suggested having the ability to provide any palette.

Ok, can you name a tool that doesn’t use green for primary remap? The Object Editor, Trigger’s tools and the RCT2 GUI Editor all use that palette.

Landmark editor uses an alternative palette. I vaguely recall one other, but I don't remember its name or what it did.

Do you have a link? I tried Googling, but didn’t see anything that looked like a RCT sprite editor/exporter.

@spacek531

Copy link
Copy Markdown
Collaborator Author

Do you have a link? I tried Googling, but didn’t see anything that looked like a RCT sprite editor/exporter.

https://www.nedesigns.com/index.php?app=core&module=attach&section=attach&attach_id=25880

From the NEDesigns website. IIRC there are two links, one of them worked when I tried it and one of them didn't. I don't remember where the other link is.

@spacek531

Copy link
Copy Markdown
Collaborator Author

I found an issue with the example palettes, the 0th pixel is 255 255 255 255 instead of 0 0 0 0. I'm not in a position to fix it right now, so if there's any danger of this PR being merged in the next several hours, please hold back until they are fixed.

@spacek531

Copy link
Copy Markdown
Collaborator Author

I found an issue with the example palettes, the 0th pixel is 255 255 255 255 instead of 0 0 0 0. I'm not in a position to fix it right now, so if there's any danger of this PR being merged in the next several hours, please hold back until they are fixed.

This issue has been resolved. I think the PR is ready for review, less any suggestions regarding what I asked about earlier.

@spacek531

spacek531 commented Mar 12, 2022

Copy link
Copy Markdown
Collaborator Author

I have been thinking about OpenRCT2's palette collisions with sparkling water and I wanted to see if any tools do not have palette collisions. It appears none of the tools avoid palette collisions, I think because no scenery actually uses all of the animated water colors.

I've written more of my findings here: #16611

As far as the effect on this PR, since there is no standard on which to base these colors on, I think this PR is an opportunity to create a new standard for animated water pixels and apply it to both the RCT2 and OpenRCT2 palette.

@Gymnasiast Gymnasiast left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks OK, want to test.

@Gymnasiast Gymnasiast added the testing required PR needs to be tested before it is merged. label Mar 14, 2022
Comment thread src/openrct2/drawing/ImageImporter.h Outdated
Comment thread src/openrct2/drawing/ImageImporter.h Outdated
Comment thread src/openrct2/drawing/ImageImporter.h
Comment thread src/openrct2/drawing/ImageImporter.h Outdated
Comment thread src/openrct2/CmdlineSprite.cpp Outdated
@spacek531 spacek531 force-pushed the green-remap-import branch from 97bea1d to 94cd622 Compare April 6, 2022 17:13
@spacek531

Copy link
Copy Markdown
Collaborator Author

I do not have a plugin that uses custom images to test against.

@IntelOrca

Copy link
Copy Markdown
Contributor

@spacek531

Copy link
Copy Markdown
Collaborator Author

The image api demo works fine in this branch. Please can this be merged before any other changes are made?

@tupaschoal

Copy link
Copy Markdown
Member

The image api demo works fine in this branch. Please can this be merged before any other changes are made?

Before which other changes?

@spacek531

Copy link
Copy Markdown
Collaborator Author

Any others that affect image import code that I have to work around and require another review and delay things further until the next change that affects image import code that I have to work around and require another review that delay things further and so on.

@spacek531

Copy link
Copy Markdown
Collaborator Author

I've tested all the functionality and I am happy with it. Is there anything else left before this PR can get merged?

@spacek531

Copy link
Copy Markdown
Collaborator Author

Is this PR now defunct since libsawyer is being created? I wish there was better communication.

@tupaschoal

Copy link
Copy Markdown
Member

@IntelOrca ?

@IntelOrca

Copy link
Copy Markdown
Contributor

These changes can be ported now to gxc in libsawyer.
I guess there is an argument for this still existing in object and plugin, but it looks like we are heading more into embedding GX files now for best performance.

@spacek531

Copy link
Copy Markdown
Collaborator Author

It feels like I'm missing something critical in libsawer... I've poked around but I have yet to find where the sprite functions are actually used.

@IntelOrca

Copy link
Copy Markdown
Contributor

It feels like I'm missing something critical in libsawer... I've poked around but I have yet to find where the sprite functions are actually used.

I am not sure what you are looking for.

@karst karst mentioned this pull request Sep 10, 2022
10 tasks
@karst

karst commented Dec 20, 2022

Copy link
Copy Markdown
Member

Here's two color table files for the palette index. OpenRCT2 is default gxc, OpenRCT2 green is the green palette used here. You can easily convert between the two by just swapping the index.

Palette color tables

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale and will be closed in 14 days if no action is taken. To keep it open, leave a comment or remove the stale-pr label. If you're awaiting feedback from a developer, please send us a reminder (either here or on Discord).

@Gymnasiast

Copy link
Copy Markdown
Member

Keep this open please.

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale and will be closed in 14 days if no action is taken. To keep it open, leave a comment or remove the stale-pr label. If you're awaiting feedback from a developer, please send us a reminder (either here or on Discord).

@Gymnasiast

Copy link
Copy Markdown
Member

Keep this open please.

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale and will be closed in 14 days if no action is taken. To keep it open, leave a comment or remove the stale-pr label. If you're awaiting feedback from a developer, please send us a reminder (either here or on Discord).

@github-actions

Copy link
Copy Markdown

This pull request has been closed due to inactivity. If you want to continue with this, or are awaiting a review, don't hesitate to reach out to a developer. We'll gladly re-open this PR! You can tag us here, or send us a message on Discord.

@github-actions github-actions Bot closed this Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale-pr testing required PR needs to be tested before it is merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants