Sprites vs Shapes

Post your SmartBASIC questions here
Post Reply
User avatar
joltguy
Posts: 38
Joined: Wed Aug 21, 2019 5:17 am
Location: Toronto, Canada

Sprites vs Shapes

Post by joltguy » 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)?
Image

User avatar
Milli
Site Admin
Posts: 119
Joined: Fri Jul 19, 2019 3:13 pm
Location: Beaver Falls PA
Contact:

Re: Sprites vs Shapes

Post by Milli » Sun May 31, 2020 10:13 am

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.
Milli

User avatar
joltguy
Posts: 38
Joined: Wed Aug 21, 2019 5:17 am
Location: Toronto, Canada

Re: Sprites vs Shapes

Post by joltguy » Sun May 31, 2020 11:13 pm

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.
Image

User avatar
Wmaalouli
Posts: 77
Joined: Sat Jul 20, 2019 2:09 pm

Re: Sprites vs Shapes

Post by Wmaalouli » 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.

User avatar
joltguy
Posts: 38
Joined: Wed Aug 21, 2019 5:17 am
Location: Toronto, Canada

Re: Sprites vs Shapes

Post by joltguy » Mon Jun 01, 2020 2:09 pm

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?
Image

JimN-NIAD
Posts: 20
Joined: Sat Jul 20, 2019 8:23 pm

Re: Sprites vs Shapes

Post by JimN-NIAD » Mon Jun 01, 2020 4:02 pm

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.

User avatar
joltguy
Posts: 38
Joined: Wed Aug 21, 2019 5:17 am
Location: Toronto, Canada

Re: Sprites vs Shapes

Post by joltguy » Mon Jun 01, 2020 9:47 pm

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. :)
Image

User avatar
Wmaalouli
Posts: 77
Joined: Sat Jul 20, 2019 2:09 pm

Re: Sprites vs Shapes

Post by Wmaalouli » Tue Jun 02, 2020 9:41 am

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" :)

Post Reply