News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_zhulien

Amstrad Plus Sprites vs Amiga Sprites

Started by zhulien, 04:41, 30 October 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zhulien

Hi sprite experts, just wondering if the plus machines allow such sorcery as described in this Amiga-related video?



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


andycadley

You can multiplex sprites like this, although it's harder to pull off because:



       
  • There is no copper, the best you have is a raster interrupt that allows you to wait for a specific line. Horizontal timing can only be achieved with t-state counting.
  • Unlike the Amiga, you can't easily just repoint a sprite at a different image. Instead you have to write all 256 pixels of the sprite into the ASIC registers. This not only takes a far chunk of time, but it's also something you have to do at a point the sprite isn't being drawn, otherwise you'll get visual corruption.
Neither of those should put you off trying it out though.

Cwiiis

I added sprite multiplexing in a game I'm working on the other week and depending on what you want to do with it, it's actually surprisingly easy... My game only consists of a few unique sprites - the player, one enemy type (of which there are 8 instances) and another miscellaneous sprite. The enemy only has 2 frames of animations and can face in two directions, so takes 4 sprites - I decided to duplicate this in sprite memory 3 times and use multiplexing to be able to have 8 of them and alternate flickering if there are too many per scanline (which very, very rarely happens with that many duplicates - I may just duplicate them twice in the end).

So that's 12 sprites used for 8 enemies with 2 frames of animation, that leaves me 4. Two I use for the player so I can double-buffer animation. I can upload the next frame of animation over multiple frames (since it isn't 50Hz animation anyway) and flip once the frame upload completes. I only need 1 after that, which leaves me 1 last one to use for anything I like (or 5 spare if I choose to only duplicate the enemy frames twice).

With respect to the multiplexing, I split the screen vertically in 3 and recalculate the sprite registers based on the part of the screen that's going to display within that split - this doesn't take much, in the unlikely event I notice too much flickering, I (for now at least) have a lot of spare cycles to split the screen in a more granular fashion. I use Plus line interrupts for this, it makes the splitting and timing easier than relying on the standard CPC raster interrupts.


I quite like this scheme, but this only works for this particular game - I think the trick with multiplexing on the Amstrad Plus is to think of a scheme that works for your specific use-case and work around its limitations. It's not as flexible as a machine that lets you do hardware flipping or changing sprite pointers, but it's still very useful.


roudoudou


prehistorik 2 use multiplexing on moving sprites for foreground palm trees (leaves and trunks)




My pronouns are RASM and ACE

andycadley

Quote from: Cwiiis on 09:58, 30 October 21

[size=78%] I think the trick with multiplexing on the Amstrad Plus is to think of a scheme that works for your specific use-case and work around its limitations. It's not as flexible as a machine that lets you do hardware flipping or changing sprite pointers, but it's still very useful.[/size]


Yes 100% this. You have to craft your sprite usage somewhat and think about the limitations as you're arranging things rather than just having a generic multiplexer that you can use for most anything.


I have a shoot-em up multiplexer that worked similarly and would cycle which sprite is used for which enemy so that you could reuse animations as long as different enemies are on different frames. It would similarly only miss some sprites off if too many were in the same area (trying to flicker different sprites each frame)


I also have an idea for a space invaders clone but I haven't actually tried it out yet (and it may sit on the pile of half baked ideas for some time as I rarely get time for coding these days)

sigh

Quote from: andycadley on 20:50, 30 October 21

I also have an idea for a space invaders clone but I haven't actually tried it out yet (and it may sit on the pile of half baked ideas for some time as I rarely get time for coding these days)
If you do - may I request for a co-op mode and also a split screen VS mode please? :D

andycadley

I'm not entirely sure how a split screen space invaders would work (or if it would fit in with what I had in mind) but I'll certainly think about it. Assuming I ever actually do anything.  :laugh:

sigh

Split screen would be side by side and it would be - who destroys all the enemies first. There could also be a special game mechanic where shooting the flying UFO that goes across the top of the screen, ends up sending an enemy onto the opponents side.

Powered by SMFPacks Menu Editor Mod