Mode 74 big sprites

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Mode 74 big sprites

Post by danboid »

Am I right in thinking that Flight of a dragon is the only game currently written using mode 74? Is that all we have in the way of example code except for the few demos in the Uzebox repo kernel dir?

If I want to draw a single 8x8 sprite under mode 74, it seems I should be able to borrow sprite.c and sprite.h from FOAD and call sprite_blit() but what if I want to use larger sprites? I'm hoping to use approx 2x4 tile (ie 16x32 pixel) sprites so how would you advise I go about this?

Might it be best to try and replicate MapSprite2() with M74 somehow? That might not be wise or even possible.

A mode 74 tutorial would be lovely please!
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Mode 74 big sprites

Post by D3thAdd3r »

Wish I knew more on M74, but it must be possible to simulate MapSprite2() like you suggest. For simple use cases that is probably the best, though I can understand this being left to the user due to sheer amount of variations possible.

There seems to be a custom mega sprite format used in FoaD, and I would guess this is because it is not simply square frames drawn, some tiles in a square wouldn't contain a sprite? Pure guess but FoaD frames might offset sprites from 8x8 boundaries. This would effectively achieve "partitioned sprites" without having to bake it into the graphics. FoaD seems to embed "importance" which is a technique for rolling off less important sprite in the event of overflow. FoaD is very advanced basically.

All that being said, did you check out StormForce? A good UCC game, and it might show an easier to understand demonstration of M74. AFAIK that is so far the only M74 game not made by Jubatian(yet).
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Mode 74 big sprites

Post by Artcfox »

Did you read https://uzebox.org/wiki/Mode_74_Quickstart

The last paragraph explains the calls and the order needed to blit sprites each frame/restore the background. I think you can use M74_BlitSprite() to blit an 8x8 sprite and you can either use the BlitMap format that I used/described in my WIP demo forum post (partitioned sprites), or use an inefficient rectangular array if you want to use more RAM tiles that necessary by blitting on a grid pattern, but you will waste flash, RAM, and CPU cycles doing it with maps aligned to a rectangular grid, versus using partitioned sprites.
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: Mode 74 big sprites

Post by danboid »

Yes I've read the M74 quickstart. I will look at the stormforce source to see what I can learn from that.
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Mode 74 big sprites

Post by Artcfox »

You should be able to use this code: https://uzebox.org/forums/viewtopic.php?p=33683#p33683
if you replace the call to MyBlitSprite() with M74_BlitSprite().

I included a graphic showing how you can partition your sprites to use as little ram as possible like the Weber's rant on partitioned sprites explains.
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: Mode 74 big sprites

Post by danboid »

Thanks Artcfox!

I think I'll be concentrating on getting my joystick built but I shall try your code soon.
Post Reply