Page 1 of 1

Sprites vs Shapes

Posted: Sun May 31, 2020 7:59 am
by joltguy
Hi all

Can anyone explain to me what the important differences are between sprites and shapes in SmartBASIC? Are there performance advantages to one over the other or does it simply come down to how they're stored in memory (bitmap vs vector)?

Re: Sprites vs Shapes

Posted: Sun May 31, 2020 10:13 am
by Milli
joltguy wrote:
Sun May 31, 2020 7:59 am
Hi all

Can anyone explain to me what the important differences are between sprites and shapes in SmartBASIC? Are there performance advantages to one over the other or does it simply come down to how they're stored in memory (bitmap vs vector)?
I am not sure if SmartBasic uses the sprites to implement the Shapes or not but the main difference is that the sprites use the video processor to create up to 32 sprites that are overlaid onto the screen image and I believe the Shapes are actually just written onto the graphics screen and become part of it. Again I could be wrong - I personally have not used shapes since my Apple ][ days.

Re: Sprites vs Shapes

Posted: Sun May 31, 2020 11:13 pm
by joltguy
Ah okay, I do remember reading something about a sprite being treated like a layer of sorts. Since a sprite is native to the video processor I’m guessing it would come out way ahead performance-wise too.

SmartBASIC 1.0 apparently didn’t have support for sprites but they are available in version 2.0.

Re: Sprites vs Shapes

Posted: Mon Jun 01, 2020 9:10 am
by Wmaalouli
One limitation of the 9918 VDP is that you can only have 4 sprites on a single row. Additional ones will not be displayed. So when you are programming with sprites, you need to make sure that situation does not occur.

Re: Sprites vs Shapes

Posted: Mon Jun 01, 2020 2:09 pm
by joltguy
Wmaalouli wrote:
Mon Jun 01, 2020 9:10 am
One limitation of the 9918 VDP is that you can only have 4 sprites on a single row. Additional ones will not be displayed. So when you are programming with sprites, you need to make sure that situation does not occur.
Does this mean that more than 4 sprites can't appear at the same y-coordinate regardless of what their x-coordinate is?

Re: Sprites vs Shapes

Posted: Mon Jun 01, 2020 4:02 pm
by JimN-NIAD
You need to get the PDF versions of "The Hackers Guide to ADAM Vol. I & II" with volume II being more SmartBASIC specific.

Also, download the disk image of SpritePower by Digital Express. This is a well down sprite creation program using a SmartKEY interface and there is a SmartBASIC 1.0 sprite loader program that will load a sprite set into memory and allow you to use them. Another good source of SmartBASIC info are the PDF'ed newsletters of Nibbles & Bits... especially look for the listing of the game Puff as it will provide plenty of examples.

Re: Sprites vs Shapes

Posted: Mon Jun 01, 2020 9:47 pm
by joltguy
Thank you very much for all the recommendations. I will definitely give SpritePower a try. I have the Hackers Guides but just sort of skimmed them so far.

Good to know that SmartBASIC 1.0 can do sprites too! I was hoping to stick with 1.0 anyway since most of the example code that has been published over the years uses that as a target. I already found the solution to the rem/data bump bug in one of the newsletters (maybe NIAD!) so that’s not a problem anymore either. :)

Re: Sprites vs Shapes

Posted: Tue Jun 02, 2020 9:41 am
by Wmaalouli
joltguy wrote:
Mon Jun 01, 2020 2:09 pm
Does this mean that more than 4 sprites can't appear at the same y-coordinate regardless of what their x-coordinate is?
Exactly. You can easily test this out. Some games actually make use of this limitation as a "feature" :)