Attempt at supporting double-sized images

Open-source port of PoP that runs natively on Windows, Linux, etc.

Moderator: English Moderator Team

Post Reply
David
The Prince of Persia
The Prince of Persia
Posts: 1548
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Attempt at supporting double-sized images

Post by David » March 28th, 2016, 5:12 pm

Here is my first attempt at supporting double-sized images.
Code: https://github.com/NagyD/SDLPoP/tree/double_size
(Such new graphics is not (yet) included on GitHub!)
Mac graphics is attached to this post.

Unfortunately, it looks like the Mac graphics are organized a bit differently from the DOS ones...
Attachments
screenshot_with_mac.png
A buggy screenshot of SDLPoP with Mac graphics
data_mac.zip
Mac graphics to use with SDLPoP
(1.03 MiB) Downloaded 37 times

Andrew
Wise Scribe
Wise Scribe
Posts: 313
Joined: July 16th, 2009, 4:39 pm

Re: Attempt at supporting double-sized images

Post by Andrew » March 29th, 2016, 3:02 am

SDLPoP with support for original Mac version sprites? Nice! Looking forward to the bugs being ironed out, David.

salvadorc17
Calif
Calif
Posts: 536
Joined: August 27th, 2011, 2:04 am

Re: Attempt at supporting double-sized images

Post by salvadorc17 » March 31st, 2016, 9:33 pm

David wrote:Here is my first attempt at supporting double-sized images.
Code: https://github.com/NagyD/SDLPoP/tree/double_size
(Such new graphics is not (yet) included on GitHub!)
Mac graphics is attached to this post.

Unfortunately, it looks like the Mac graphics are organized a bit differently from the DOS ones...
Yes, i have worked with mac graphics and those have different size and scale, so your algorithm to draw tiles in room will need to change a bit, i have resized all them to 128x148 for better usage.

David
The Prince of Persia
The Prince of Persia
Posts: 1548
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Attempt at supporting double-sized images

Post by David » April 2nd, 2016, 11:28 am

Another solution would be to rearrange the Mac graphics so that it becomes similar to the DOS graphics.

From: https://github.com/NagyD/SDLPoP/issues/61
myself600 wrote:My goal is to improve the original PC version using SDLPoP and the sprites from the Mac version, not to convert SDLPoP to the Mac version.
Or just start with the DOS graphics scaled to 2x, and let modders change them as they will.

salvadorc17
Calif
Calif
Posts: 536
Joined: August 27th, 2011, 2:04 am

Re: Attempt at supporting double-sized images

Post by salvadorc17 » April 3rd, 2016, 9:54 pm

David wrote:Another solution would be to rearrange the Mac graphics so that it becomes similar to the DOS graphics.
Will be cool to see that done, you can use as alternate graphics for the game...

Falcury
Wise Scribe
Wise Scribe
Posts: 369
Joined: June 25th, 2009, 10:01 pm

Re: Attempt at supporting double-sized images

Post by Falcury » April 4th, 2016, 2:38 pm

Very nice work! It will be interesting to be able to play with high resolution graphics natively. And perhaps sometime in the future we may have modders creating mods with modified Mac graphics.
I would love to try to help with this, unfortunately I don't have a lot of free time at the moment...

mYse|f
Efendi
Efendi
Posts: 6
Joined: April 10th, 2016, 5:40 pm

Re: Attempt at supporting double-sized images

Post by mYse|f » April 10th, 2016, 8:25 pm

Falcury wrote:It will be interesting to be able to play with high resolution graphics natively.
Sadly, this it's going to happen anytime soon. It's been a week since I've heard back from David, and I'm unable to continue my work until the issue is there. If this isn't going to be resolved soon, I'm afraid I'll have to abandon the effort. :(

Therefore, any help regarding this is very much appreciated!

Falcury
Wise Scribe
Wise Scribe
Posts: 369
Joined: June 25th, 2009, 10:01 pm

Re: Attempt at supporting double-sized images

Post by Falcury » April 15th, 2016, 3:39 pm

Well, sometimes things just take some time...
In my own experience it often doesn't hurt to leave a challenging project alone for a while, and come back to it later. :)
I'm sure that the problem can be solved somehow!

Welcome to the forum, by the way!

mYse|f
Efendi
Efendi
Posts: 6
Joined: April 10th, 2016, 5:40 pm

Re: Attempt at supporting double-sized images

Post by mYse|f » April 17th, 2016, 7:19 pm

Falcury wrote:Well, sometimes things just take some time...
In my own experience it often doesn't hurt to leave a challenging project alone for a while, and come back to it later. :)
I'm sure that the problem can be solved somehow!

Welcome to the forum, by the way!
I wanted to spur the interest in the issue by remaking the background of Princess's room, but before I finished it, David has provided a workable solution, so now I'm able to continue where I left off.

Thanks for the welcome! :)

Sance
Efendi
Efendi
Posts: 17
Joined: December 30th, 2013, 4:59 pm

Re: Attempt at supporting double-sized images

Post by Sance » November 25th, 2016, 9:00 pm

I hope this feature will get implemented, it's just the extra that SDLPoP needs to be an important port that offers significantly more than the original DOS version. Also: it would be awesome as hell to play the game on the speed of the DOS version with Mac graphics, in my opinion that's the best of both worlds (DOS for gameplay, Mac for graphics). :)

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3278
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Attempt at supporting double-sized images

Post by Norbert » November 25th, 2016, 10:35 pm

David wrote:Or just start with the DOS graphics scaled to 2x, and let modders change them as they will.
This sounds like the easiest solution. If all PNG images are scaled 2x without interpolation - ImageMagick can do this in bulk - then even scaling it back to 1x with SDLPoP ("nearest" SDL_HINT_RENDER_SCALE_QUALITY) should give the program an unchanged appearance. After that, mods that use DAT files can be assumed to use 1x and for mods that use PNG files SDL_QueryTexture() could be used to check the height of a PNG image to determine the scaling factor.

Falcury
Wise Scribe
Wise Scribe
Posts: 369
Joined: June 25th, 2009, 10:01 pm

Re: Attempt at supporting double-sized images

Post by Falcury » January 22nd, 2018, 12:48 pm

I just took a look at this. I checked out the double_size branch, fast-forwarded to the latest master and added the data files that David attached to the first post. I also removed the .DAT extensions from the data folder names.
I noticed that only the top left quadrant was being rendered. I managed to fix this by multiplying the surface dimensions by SCALE in make_offscreen_buffer().

Some observations:

Images that are not there in the DOS version:
PRINCE.DAT: res174-183 are added (potion bubbles for green and poison potions, apparently)
PV.DAT:
* res931 is added (princess standing)
* res963-965 are added (alternate torch frames, just for the princess cutscene?)
VDUNGEON.DAT: res220-229 are added (are these rough tile edges?)
VPALACE.DAT:
* res220-229 are added (rough tile edges?)
* res244 and res245 (blue stripes) have part of the tile below them (as opposed to res324-325)
* res348 added (don't know what this is)

Other differences:
* Level door (res233) is in one piece.
* The font does not seem to distinguish between small and capital letters.

Bugs:
* Naturally, SDLPoP isn't aware of the extra resource images that exist in the Mac graphics.
* Lots of objects are drawn slightly in the wrong place.
* Guard palette changes do not seem to be working correctly.
* The leveldoor is buggy: can see a slur of the image above the door (doesn't get redrawn properly).
* Transparency isn't always working. This seems to happen because the non-transparent blitter is used for some images, whereas the Mac version apparently uses transparency for that same image.
* Potion bubbles do not get drawn properly.
* Health flasks and text at the bottom of the screen are drawn slightly too low, causing them to partly fall off the screen.
* The health flasks are drawn too close together.
* The shadow is a bit weird.

Another thing I noticed:
Animations are sometimes a bit 'wobbly', e.g: look at the kid's feet during the turning animation, or the kid's y-position during standing jump animation. (If I remember correctly, the original Mac version has this as well)
Norbert wrote:
November 25th, 2016, 10:35 pm
David wrote:Or just start with the DOS graphics scaled to 2x, and let modders change them as they will.
This sounds like the easiest solution. If all PNG images are scaled 2x without interpolation - ImageMagick can do this in bulk - then even scaling it back to 1x with SDLPoP ("nearest" SDL_HINT_RENDER_SCALE_QUALITY) should give the program an unchanged appearance. After that, mods that use DAT files can be assumed to use 1x and for mods that use PNG files SDL_QueryTexture() could be used to check the height of a PNG image to determine the scaling factor.
Upscaling the DOS graphics to 2x would of course work (whether by preprocessing the images beforehand, or by upscaling while loading the 1x image), but it may cause some other inconveniences. For the 4:3 aspect ratio and integer scaling features, I expect that we would need twice the monitor resolution to get the same effect. Another disadvantage is that we would pay the CPU cost for double-resolution rendering, even though this is really not necessary for DOS graphics.

Also, modifying the Mac data files will not really help much to get the Mac graphics working properly, because the differences between the Mac and DOS files still need to be accounted for: extra images that are not in the DOS version, transparency differences, potion bubbles, possibly negative image drawing offsets, all that. It is looking like the best thing to do is to simply account for the remaining DOS/Mac differences in the source code.

Maybe in the end there should be a setting that specifies whether DOS-style or Mac-style graphics are used? (Maybe distribute the Mac data files in a separate folder?) Then modded images could be assumed to be 2x when Mac graphics are specified.

Post Reply