Is there some way of draw sprites without flickering?
Moderator: Moderators
Is there some way of draw sprites without flickering?
Hi, I like so much this forum and I have a idea:
for example: suppose that we have a C function (sorry I don't know assembly) to draw a simple point, drawPoint(x,y,color).
So, I think that draw only one point at time it not wll provocates flickering, or is this false? Draw a entire sprite can cause flicker if the sprites number increase.
If it is true, so, we call drawPoint to draw as points of a sprite and without cause flickering.
Can I anyone more experienced confirm this to me?
Thanks in advance.
for example: suppose that we have a C function (sorry I don't know assembly) to draw a simple point, drawPoint(x,y,color).
So, I think that draw only one point at time it not wll provocates flickering, or is this false? Draw a entire sprite can cause flicker if the sprites number increase.
If it is true, so, we call drawPoint to draw as points of a sprite and without cause flickering.
Can I anyone more experienced confirm this to me?
Thanks in advance.
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Is there some way of draw sprites without flickering?
The NES does things in 8x8 pixel blocks, or "tiles".
The background is made up of a grid of these. The sprites are made up of 64 of these which don't have to be placed on a grid.
If you use a single pixel as a sprite, you still have to use a whole 8x8 block.
Flickering happens when you have more than 8 sprite tiles on the same row of the screen. So you could do "drawPoint" with sprites, but after 8 points, they might start to flicker if they were on the same line, and then after 64 points you are out of sprites to use.
Otherwise if you want "drawPoint" to draw on the background, you don't have flickering, but there is another problem that the NES doesn't normally come with enough video RAM to cover the whole screen in tiles. You can put unique pixels on 1/4 of the background fairly easily, or 1/2 of the background with a little bit of trickery. Otherwise if you want to be able to draw freely on the whole screen you'll need a special cartridge with large CHR-RAM.
Answers in this recent thread may be relevant: is mario paint possible on the NES?
The background is made up of a grid of these. The sprites are made up of 64 of these which don't have to be placed on a grid.
If you use a single pixel as a sprite, you still have to use a whole 8x8 block.
Flickering happens when you have more than 8 sprite tiles on the same row of the screen. So you could do "drawPoint" with sprites, but after 8 points, they might start to flicker if they were on the same line, and then after 64 points you are out of sprites to use.
Otherwise if you want "drawPoint" to draw on the background, you don't have flickering, but there is another problem that the NES doesn't normally come with enough video RAM to cover the whole screen in tiles. You can put unique pixels on 1/4 of the background fairly easily, or 1/2 of the background with a little bit of trickery. Otherwise if you want to be able to draw freely on the whole screen you'll need a special cartridge with large CHR-RAM.
Answers in this recent thread may be relevant: is mario paint possible on the NES?
Re: Is there some way of draw sprites without flickering?
Thanks man, good answer!rainwarrior wrote: ↑Sun Dec 11, 2022 1:38 pm The NES does things in 8x8 pixel blocks, or "tiles".
The background is made up of a grid of these. The sprites are made up of 64 of these which don't have to be placed on a grid.
If you use a single pixel as a sprite, you still have to use a whole 8x8 block.
Flickering happens when you have more than 8 sprite tiles on the same row of the screen. So you could do "drawPoint" with sprites, but after 8 points, they might start to flicker if they were on the same line, and then after 64 points you are out of sprites to use.
Otherwise if you want "drawPoint" to draw on the background, you don't have flickering, but there is another problem that the NES doesn't normally come with enough video RAM to cover the whole screen in tiles. You can put unique pixels on 1/4 of the background fairly easily, or 1/2 of the background with a little bit of trickery. Otherwise if you want to be able to draw freely on the whole screen you'll need a special cartridge with large CHR-RAM.
Answers in this recent thread may be relevant: is mario paint possible on the NES?
I will search more about it and see the link.
Re: Is there some way of draw sprites without flickering?
Man, can you indicates me how to treat sprite flickering in game? Some algorithm to it?
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Is there some way of draw sprites without flickering?
Sprites are just drawn in the order they're given in the sprite buffer. If there's more than 8 on a line, only the first 8 appear.
If you want to flicker to make sure all sprites get a turn, you just change the order of your sprites each frame.
If you want to flicker to make sure all sprites get a turn, you just change the order of your sprites each frame.
Re: Is there some way of draw sprites without flickering?
Oh, ok. I was reading here:
https://archive.nes.science/nesdev-foru ... 0591.xhtml
But, I get the idea with your help. So, thank you again. Now, I will make some experiments.
https://archive.nes.science/nesdev-foru ... 0591.xhtml
But, I get the idea with your help. So, thank you again. Now, I will make some experiments.
Re: Is there some way of draw sprites without flickering?
Also, there's limited CPU time, so if you want to plot a whole image pixel by pixel every frame you'll probably find difficulty or an impossibility. One solution would be to lower the game's frame rate so you have more time to calculate the screen.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
Re: Is there some way of draw sprites without flickering?
DOS games in the early 80's used to have this problem. PC video cards never supported hardware sprites, so all the pixel manipulation had to be done in software, and CPUs back then were fairly slow. Drawing full frames pixel by pixel every frame was completely out of question.
-
- Posts: 1565
- Joined: Tue Feb 07, 2017 2:03 am
Re: Is there some way of draw sprites without flickering?
CPU time is one thing, VBlank time is the massive killer. Even if you go PAL only you still only get what 1/3 of a screen worth?
Re: Is there some way of draw sprites without flickering?
Yeah, being able to access VRAM only during vblank is a huge bottleneck. You could, in theory, create a mapper with enough memory for two full screens worth of patterns accessible outside of vblank, but even then you still wouldn't be able to do much... The 2bpp pattern + 2-bit attributes pretty much prevents you from drawing things freely, and the CPU would still be too slow.