Wow! Fantastic job getting it to work in a emulator!
to avoid different parts being drawn at a different "depths"
Hmmm... I see what you mean. Would just rendenting them "flat", or just scaling it up/down (drawing it as a square, and scaling it accordingly to Y-position) fix this?
If anyone wants to pursue this idea seriously, one thing to be done is to parametrize the way all (0...31) sprites are handled, and to create profiles for different games. As I said, I only looked at Knightmare (sprites 0...3 are the knight, 4...5 the arrows, etc.). Other games will have other sprites assigned to these numbers.
No doubt about it. Maybe a XML kind of file, specifying how which sprite is handled? This way it turns into an expandlable system: just check CRC, and if there is a "rom_name.improved.xml" or something present, read from it and apply the changes?
One thing that can be done to not have so much empty space, is to simple have a background image - took the liberty of editing your image to show it
...and if the emulator generates the trapezoid as a texture, would be simply a matter of scaling it as -1,1 and placing another trapezoid left and right (waaaaay distorted, I know) to just fill the screen from side to side)
Edit: Come to think of it, mirroring the field wont be a good idea. Specially in games like Zanac, the boss would appear doubled or tripled in the screen! ^_^
I like your background. Makes it much nicer. I guess this too can be added as a configurable parameter. In addition, it is necessary to be able to indicate which part of the screen actually needs to be transformed. For example, sky jaguar uses a different section of the screen than knightmare does.
Hmmm... I see what you mean. Would just rendenting them "flat", or just scaling it up/down (drawing it as a square, and scaling it accordingly to Y-position) fix this?
That sounds roughly like how I fixed it. Let me elaborate. You can see in the image that the knight is drawn correctly. Before fixing it, the horns, blue part and black part of the knight (sprites 0, 1, 2) were drawn at wrong x positions relative to each other. This is because each of the three sprites has a different y position, leading the (naive) transformation to put them at different depths, and applying a different scaling (wider/narrower) to them.
For the cannon balls and birds I didn't yet fix it. The problem is perhaps best visible if you look at the shadows of the birds. If yo look carefully you see that the shadows are not exactly drawn under the birds. Reason is that each bird is drawn at a higher y position than its shadow. Thus, the naive transformation applies a different scaling to these positions. The effect is that the scaling applied to the shadows is "wider" than the scaling applied to the birds.
The hack that I applied to fix the appearance of the knight was to draw sprites 1 and 2 (the horns and black part) at the same depth as sprite 0 (the blue part). The same trick would fix the other problems (e.g. draw shadow of bird at same depth as bird) but I didn't yet figure out the sprite numbers used.
Another thing that I didn't do yet is sprite zooming. Sprites further away should be smaller.
Also, I used a very crude transformation algorithm. We obviously need some kind of anti aliasing to make it look good.
Would it be possible to render sprites at different scales?
e.g... the ones further in the back at 1x, the ones in front larger ... it would give an appearance of "increased" resolution.
And I have to say the trapezoid works way better than a rotated image... at least for Knightmare it does.
Fantasizing a bit further on Slotman's background, would be nice to be able to use a custom image there so one could create a custom background fitting with the game... that or something that would automatically determine the colors based on what's showing in the game, but that might be tricky.
A few considerations:
As for fixing the sprite scaling, the XML could have sprite groups, groups of sprites rendered together? I don't know how knightmare does it, but I guess games if a game does sprite cycling, this would break :/
I like your background. Makes it much nicer. I guess this too can be added as a configurable parameter. In addition, it is necessary to be able to indicate which part of the screen actually needs to be transformed. For example, sky jaguar uses a different section of the screen than knightmare does.
Hmmm... didn't think of that, but it actually it make a LOT of sense! It could actually keep the side panel on screen! Nice!
Also, I used a very crude transformation algorithm. We obviously need some kind of anti aliasing to make it look good.
Are you rendering that image manually like that? If you're using OpenGL, wouldn't it be easier to just create a texture with the image information and apply it to a "distorted" quad? That would give you automatically a "blurry" effect
Would it be possible to render sprites at different scales?
That's the general idea, yes. I don't think the ones in the front would be larger, but actually, the ones in the back/top of the screen, smaller
It would be just a simple linear transform = y [0..191(maybe less? 191 would actually be bigger?)], to scale [0..1] - and maybe this could also be set by the config file... this is already giving me headaches hehehe
Fantasizing a bit further on Slotman's background, would be nice to be able to use a custom image there so one could create a custom background fitting with the game... that or something that would automatically determine the colors based on what's showing in the game, but that might be tricky.
Yeah, the idea is to have a custom background - I just draw that thing in a couple of seconds as an example
Another idea would be (not so sure how that would work out) to just get the last 8x8 block on each side, and repeat it until it covers the screen. But this would be a LOT of work, and I'm not sure how good the result would be :/
Did you guys see this 3DNES emulator? https://www.youtube.com/watch?v=Ti2fwroyP2A
Knightmare in 3D may look similar to this
https://www.youtube.com/watch?v=lX4b5C2YrY4
3dnes, (called 3dsen now) playing FINAL Fantasy and Dragon Quest.
Anyone interested in making a msx emulator version of this?