Community

SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on December 09, 2021, 09:15:52 PM

Title: SCI0 - Pic Size Maximum?
Post by: Doan Sephim on December 09, 2021, 09:15:52 PM
A friend of mine did a rework of an image for Betrayed Alliance Book 1, but he's using Photoshop. When I converted the image into SCI0, its size clocked in at 43 MB.

I wonder, is there a maximum size for these resources and if, so, how close am I to it (as I'll still need to add Priority and Control lines).
Title: Re: SCI0 - Pic Size Maximum?
Post by: Daventry on December 10, 2021, 06:16:29 AM
Max 64 Kb
Title: Re: SCI0 - Pic Size Maximum?
Post by: Charles on December 10, 2021, 08:49:58 AM
Just out of curiosity, how do you convert a photoshop image into SCI0 format?

Title: Re: SCI0 - Pic Size Maximum?
Post by: Kawa on December 10, 2021, 08:52:33 AM
Just out of curiosity, how do you convert a photoshop image into SCI0 format?
Not by using the built-in "trace a bitmap" function I'd wager, that's a good way to fly too close to the 64k limit.

No, what you'll want to do is redraw the entire damn thing, using the *other* trace function. The one where you get a translucent copy as a guide. I'm not explaining this well.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Doan Sephim on December 10, 2021, 09:31:31 AM
Just out of curiosity, how do you convert a photoshop image into SCI0 format?
Not by using the built-in "trace a bitmap" function I'd wager, that's a good way to fly too close to the 64k limit.

No, what you'll want to do is redraw the entire damn thing, using the *other* trace function. The one where you get a translucent copy as a guide. I'm not explaining this well.
I used the conversion tool in SCI COmpanion, not the trace over tool. If the pics go over the limit though, I will definitely use the tracing tool
Title: Re: SCI0 - Pic Size Maximum?
Post by: Doan Sephim on December 10, 2021, 10:08:09 AM
It looks like you might be losing some detail with the flowers in the grass. Are the original photoshops the same resolution as the game? If so, I wonder if it's that "smooth" option that's causing the loss? You might try switching the option in the converter to Solid colors.

Also a hybrid of bmp conversion and tracing might be the best option here. The conversion handles solid colors very inefficiently in my experience, so you could try going back and deleting all the 100s of lines it produces for that solid dark green patch and then use the fill tool. Just a suggestion.

The new reworked background looks great BTW!

Thanks! I think the loss of details was really from me saving this screenshot with paint into aJPEG - the actual PIC resource looks really nice. I just took that screenshot to illustrate the conversion tool I was using (and I wasn't super careful about the settings for that reason too)

Yes, I agree that the conversion is very inefficient, but if it doesn't go over the max, is it really a problem? I'm asking sincerely, because I don't actually know if it matters much or not
Title: Re: SCI0 - Pic Size Maximum?
Post by: doomlazer on December 10, 2021, 10:15:45 AM
Thanks! I think the loss of details was really from me saving this screenshot with paint into aJPEG - the actual PIC resource looks really nice. I just took that screenshot to illustrate the conversion tool I was using (and I wasn't super careful about the settings for that reason too)

Yes, I noticed after I posted that it looks perfect in the original picture, which is why I removed my comment. I don't think there is any reason to trace if you aren't exceeding the limit. edit: Large backgrounds reduce total available heap for the room.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Collector on December 10, 2021, 10:41:54 AM
I'd stay away from JPEG altogether. The lossy format can introduce artifacting. That artifacting could add inaccurate and sometimes bizarre results and possibly increase size from adding unintended details.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Kawa on December 10, 2021, 11:52:08 AM
Besides unintended details, the main problem with the bitmap converter is that it doesn't do dithering. Those rocks are painted in dot for dot for dot with individual Pen commands. No wonder the result is absurdly big in storage requirements!

Also, fills. Just plain solid-color fills. Nope, you get lines. And then if the fills aren't solid those lines get a crapton of pen dots on top.

(All of this will also affect load and offscreen-drawing time which might not seem quite so bad on a modern system but oh boy.)
Title: Re: SCI0 - Pic Size Maximum?
Post by: Charles on December 10, 2021, 11:57:35 AM
Hah, I was just about to say that exact same thing.  It's the sort of thing that definitely makes me cringe when i see it, but hey, it's under the size limit (you said 43MB, but I think you meant 43KB).

I ran the converter myself and I have to say, I was impressed at how accurate it reproduced the original raster image.  Of course, I'm sure it helps that the original is already limited to 16 colours.  So, really whatever helps speed up the workflow.

EDIT: Also just realized that because the dithering is baked in, ScummVM's undither option won't do anything. Which I personally find a shame (although I think I'm in the minority with that opinion). Regardless, in a project like this, I do still believe workflow and time efficiency is king.  Really solid looking background, btw. Excited for your progress.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Kawa on December 10, 2021, 12:02:29 PM
It's accurate because it's doing a crap job lol. Sounds like a paradox, but it's true.

But really, what do you expect? For the bitmap importer to recognize line art for what it is? To have an AI take your bitmap and redraw it in proper lines and fills? Get real.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Doan Sephim on December 10, 2021, 12:28:37 PM
(All of this will also affect load and offscreen-drawing time which might not seem quite so bad on a modern system but oh boy.)
So if someone were to play the game on era-appropriate hardware, it would cause a slower load time for that screen?
Title: Re: SCI0 - Pic Size Maximum?
Post by: Kawa on December 10, 2021, 12:31:12 PM
So if someone were to play the game on era-appropriate hardware, it would cause a slower load time for that screen?
Absolutely certainly.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Doan Sephim on December 10, 2021, 12:56:18 PM
So if someone were to play the game on era-appropriate hardware, it would cause a slower load time for that screen?
Absolutely certainly.
That's good to know. For this reason I will definitely want to sketch over it to keep the file size down. Thanks for that info!
Title: Re: SCI0 - Pic Size Maximum?
Post by: Doan Sephim on January 09, 2022, 03:19:46 PM
So if someone were to play the game on era-appropriate hardware, it would cause a slower load time for that screen?
Absolutely certainly.
Kawa, would you happen to know what size threshold there would be before the size of a room begins causing undo stress on an old system? I ask because some of the new pieces we're working on for the update for Betrayed Alliance Book 1 are hitting around 24KB or so.
Title: Re: SCI0 - Pic Size Maximum?
Post by: gumby on January 10, 2022, 08:29:12 AM
I think you might be able to emulate how an older machine would perform like within DosBox.
Title: Re: SCI0 - Pic Size Maximum?
Post by: Kawa on January 10, 2022, 09:04:39 AM
I'd need an old system to test that on. Though I wouldn't call it stressful; it's mostly just hoping that the raw picture resource fits into memory so it can be rendered into the static screen buffers. The raw resource can then be freed. All that just means the bigger the picture resource (the more commands), the longer it'll take to render.

If my fantasy computer (which runs a 68020 at 16 MHz) can render the SQ3 robot freighter pilot screen (8.43 KB) in less than three seconds using only C code... I would bet actual money that the cave entrance, the new and pretty version, could fit in less than 10 KB if you properly hand-traced it just for the dithering, and render on the same order of magnitude on an old system.

Also, *undue.