Jump to content
IGNORED

DPC+ Sprites Disappear For A Frame


KevKelley

Recommended Posts

I had noticed that on occasion some of the sprites (not all) disappear for one frame. I tried getting  picture to demonstrate.  While my game does have some flicker, I had noticed sometimes a couple sprites that have no overlap, like the Balloon Boy and the Toolbox (both copies - player4 and player5) would flicker off for one frame.  

 

I am not sure if anyone had ever noticed something like this before or if there is something I am missing that may be contributing to some disappearing..

LM_2023_09_18_NOPUNCH_b.bas_dbg_aaa54938.png

LM_2023_09_18_NOPUNCH_b.bas_dbg_aaa53d95.png

  • Like 1
Link to comment
Share on other sites

2 hours ago, Karl G said:

Where is the toolbox in the first screenshot? I'm not seeing it.

 

Can you find any pattern to where you see these sprites disappear for a frame? That may give some clue.

I’ve been trying to find a pattern. In the two images, the boy and toolbox disappear (I think that the bird and top balloon just flickered).

 

I know I have flicker, but I also try and keep the bottom pretty separate from each other and when the balloons go off screen or reappear I have them go above the boy and man on the sidewalk. 
 

I had noticed that the bottom sprites disappeared when all 3 balloons were on screen, so I don’t suspect it is due to them causing the sprites below to flicker.

 

My best guess, and I will have to check, is that when I have some sprites share a horizontal plane (i.e. the bird, spark, and balloon) it messes with the flicker management in DPC+ kernel. I don’t know much about it under the hood so I will see if I can pinpoint a cause. 
 

I do find it interesting and if I am close I will just try and make creative ways to reduce the flicker. For instance, I just added the balloons reduce size when flying off screen. Or maybe I reposition some things subtly, like have the boy move. This isn’t a big issue but since it is almost complete I am trying to polish it off and learn in the process. 

Link to comment
Share on other sites

I think the DPC+ kernel needs 5 scanlines (might be more, might be less) between sprites to consider them to be in different zones.  So, I believe the flicker you are seeing is due to the nature of the sprite sorting algorithm...  to quote myself from another thread:

Quote

The sprite sorting routine in the bBasic multisprite kernel is designed to both (A) put the sprites in drawing order while also (B) trying to rotate the order of the sprites that currently overlap.  Those two disparate things are handling by a single sorting algorithm, so compromises have been made to support both.  I believe the DPC+ bBasic kernel uses the same or a similar algorithm.

 

I can't be certain that this is the issue you are running into... There's always the potential that there's a variable being trampled.

  • Like 1
Link to comment
Share on other sites

So after some observation I noticed it occurred when certain things would happen. One instance would be when I would use my “cheat” to test the game. But the other time was when I would grab a balloon. The balloon boy and lives would disappear (when I was testing the toolbox did not appear yet). 
 

So I went to the balloon grab code and the only thing I could think of was I added a “drawscreen” in there. When I removed that drawscreen I didn’t see the sprites disappear in further extended tests. 
 

So I wonder if it is because when I grab the balloon I reposition the sprite so when drawscreen is initiated, my moving the sprite and immediately using drawscreen messed with the sorting algorithm. 
 

So now I will have to test to see if there is any benefit to the drawscreen command and if the trade off of a couple sprites disappearing for a frame is worth it. 

 

Link to comment
Share on other sites

1 hour ago, KevKelley said:

So I went to the balloon grab code and the only thing I could think of was I added a “drawscreen” in there. When I removed that drawscreen I didn’t see the sprites disappear in further extended tests. 

That's probably it. For your extra drawscreen, you probably aren't setting the DFRAC* lines that are supposed to go in the game loop for that frame. 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...