Author Topic: Real-time sprite scaling  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.333
    • Awards
Re: Real-time sprite scaling
« Reply #25 on: 18:55, 05 July 21 »
Looking forward to the update.

Online Trebmint

  • 464 Plus
  • *****
  • Posts: 481
  • Country: zw
    • Awards
Re: Real-time sprite scaling
« Reply #26 on: 19:55, 05 July 21 »
Hi, I recall that I actually wrote an article on sprite scaling for Amstrad Action back in the day. As I recall it was pretty good. Might be worth looking at.
https://www.cpcwiki.eu/imgs/7/79/Amstrad_Action108_21.jpg


It actually creates its own self modifying code, so its not too slow. If anyone tries it let me know if it works or is any good :)

Offline andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.003
    • Awards
Re: Real-time sprite scaling
« Reply #27 on: 20:06, 05 July 21 »
Hi, I recall that I actually wrote an article on sprite scaling for Amstrad Action back in the day. As I recall it was pretty good. Might be worth looking at.
https://www.cpcwiki.eu/imgs/7/79/Amstrad_Action108_21.jpg


It actually creates its own self modifying code, so its not too slow. If anyone tries it let me know if it works or is any good :)
I remember reading it back in the day and thinking it was a pretty cool approach, if that counts.  :laugh:

Online Skunkfish

  • Supporter
  • 6128 Plus
  • *
  • Posts: 711
  • Country: gb
  • Editor of Colour Personal Computing
    • CPCSTORE.CO.UK - Dedicated to the Amstrad CPC
    • Awards
Re: Real-time sprite scaling
« Reply #28 on: 08:49, 06 July 21 »
Hi, I recall that I actually wrote an article on sprite scaling for Amstrad Action back in the day. As I recall it was pretty good. Might be worth looking at.
https://www.cpcwiki.eu/imgs/7/79/Amstrad_Action108_21.jpg


It actually creates its own self modifying code, so its not too slow. If anyone tries it let me know if it works or is any good

That definitely went over my head at the time!

Did you have a game in mind when you wrote that Rob?
An expanding array of hardware available at www.cpcstore.co.uk (and issue 3 of CPC Fanzine!)

Online Trebmint

  • 464 Plus
  • *****
  • Posts: 481
  • Country: zw
    • Awards
Re: Real-time sprite scaling
« Reply #29 on: 01:48, 07 July 21 »
That definitely went over my head at the time!

Did you have a game in mind when you wrote that Rob?
I don't think so. I think I might of been planning to use it for title screen, but its so long ago I can barely remember.

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.333
    • Awards
Re: Real-time sprite scaling
« Reply #30 on: 13:44, 07 July 21 »
Out of interest, how difficult would it be to create a 'Wing Commander' type game using this method and your gallery method? They also look like they could work for on rail shooters.

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.447
  • Country: au
    • index.php?action=treasury
    • Awards
Re: Real-time sprite scaling
« Reply #31 on: 16:27, 07 July 21 »
Hi folks.

I've uploaded scale_2.dsk to the original post.
It runs quite a lot faster than the previous versions, but it's still slow.
There is still much work to be done, but I think there is still a lot more speed to be gained.

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.447
  • Country: au
    • index.php?action=treasury
    • Awards
Re: Real-time sprite scaling
« Reply #32 on: 16:29, 07 July 21 »
Out of interest, how difficult would it be to create a 'Wing Commander' type game using this method and your gallery method? They also look like they could work for on rail shooters.

My apologies if you are asking this question of Trebmint.

In the case of my program however...
For very large sprites it's hard to say.
For smaller sprites (and certainly a smaller, spectrum-sized screen), it might be quite doable.
I've built into the program the ability to have a sprite sized anywhere from 1 tile up to 8x8 tiles, and any combination in between (e.g. 1x2 tiles, 5x3 tiles etc).

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.333
    • Awards
Re: Real-time sprite scaling
« Reply #33 on: 19:11, 07 July 21 »
My apologies if you are asking this question of Trebmint.

In the case of my program however...
For very large sprites it's hard to say.
For smaller sprites (and certainly a smaller, spectrum-sized screen), it might be quite doable.
I've built into the program the ability to have a sprite sized anywhere from 1 tile up to 8x8 tiles, and any combination in between (e.g. 1x2 tiles, 5x3 tiles etc).

Yes - I was thinking about your chunky pixel curator and also what you are attempting now. The reason I was thinking of Wing Commander style is because the actual play area is quite small as most of the game is taken up by the hud. Also, there aren't any real backgrounds as it's just stars, so the only things that really scale are the enemies and bullets as I don't think that the explosions scales.

In many ways, you have already started this with the chunky pixel curator; black background and animated characters?


https://www.youtube.com/watch?v=mfRvCSBD4q0

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.447
  • Country: au
    • index.php?action=treasury
    • Awards
Re: Real-time sprite scaling
« Reply #34 on: 04:38, 08 July 21 »
Hmmm, I think a simplified version of Wing Commander's presentation may indeed be possible.

However, with the larger pixels in Chunky Pixel Curator, it would be a lot faster, as those pixels are all byte-sized (pardon the pun!).
No byte-splitting or rotating is required for pixels of that size, and I wouldn't need different code paths for masked vs unmasked tiles.
Unmasked tiles are of course faster to draw.

I might do a byte-sized version of my current project once I feel I can't make it any faster.

[EDIT] In either case, for a project like Wing Commander (or anything with sprites that can go off-screen), clipping would need to be taken into account.
And that's much harder with the project I'm working on.

It's certainly possible (in fact I had it working in my BlitzMax prototype), but it would be very difficult, and all the extra code (for every clipping case) would take up a lot of memory.

Writing a generic clipping routine would take up much less RAM of course, but would run a lot slower.
Although it could be done quite efficiently with self-modifying code (which is what I did in Chunky Pixel Curator)... hmmm...
« Last Edit: 04:46, 08 July 21 by ervin »

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.333
    • Awards
Re: Real-time sprite scaling
« Reply #35 on: 01:01, 09 July 21 »
Would you be able to achieve this on a 64kb machine?

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.447
  • Country: au
    • index.php?action=treasury
    • Awards
Re: Real-time sprite scaling
« Reply #36 on: 15:32, 09 July 21 »
Would you be able to achieve this on a 64kb machine?


The program is currently running on a 464, but with more graphics the available RAM will run out quite quickly.
Also, as I expand the code to make it faster (by removing asm CALLs and inlining code), the code size is growing rapidly.
So it's hard to say...

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.447
  • Country: au
    • index.php?action=treasury
    • Awards
Re: Real-time sprite scaling
« Reply #37 on: 18:08, 09 July 21 »
Alrighty, I've uploaded scale_3.dsk to the original post.

I'm afraid I will no longer develop this particular program.
While it is now much, much faster than the original program, it is still nowhere near as fast as what I was hoping to achieve.

The main reason is the byte-splitting/combining required to achieve pixel accurate scaling.
The overhead is just too great.

Instead I will use the ideas from this program in a new project.
I'm interested in seeing how much faster this scaling technique can be without needing to split/combine bytes.

So I'll try a program that draws large "pixels" that are one byte in width, and therefore 4 rasters in height.
It will look very blocky of course, but should run much faster.
« Last Edit: 18:09, 09 July 21 by ervin »

Offline sigh

  • 6128 Plus
  • ******
  • Posts: 1.333
    • Awards
Re: Real-time sprite scaling
« Reply #38 on: 12:52, 10 July 21 »


Instead I will use the ideas from this program in a new project.
I'm interested in seeing how much faster this scaling technique can be without needing to split/combine bytes.

So I'll try a program that draws large "pixels" that are one byte in width, and therefore 4 rasters in height.
It will look very blocky of course, but should run much faster.
Your last upload was much faster.
If you are worried about it looking blocky, would you consider to use mode 1 instead? That would also give you extra ram for graphics.

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.447
  • Country: au
    • index.php?action=treasury
    • Awards
Re: Real-time sprite scaling
« Reply #39 on: 15:36, 10 July 21 »
Your last upload was much faster.
If you are worried about it looking blocky, would you consider to use mode 1 instead? That would also give you extra ram for graphics.

I could use mode 1, except that I want large graphics that take up the same amount of screen real estate, no matter what mode is used.
And that means that the sprites will take up the same amount of RAM, no matter which mode is used.
 :(

In any case, I'll see what sort of speed I can achieve with the larger "pixels".
The speed difference should be significant.

I'm considering entering this year's cpcretrodev with a simple game that requires high-speed sprite scaling, and if large pixels make that possible, then that's what I will need to focus on.