priority for displaying sprites
priority for displaying sprites
When 2D objects overlap on the screen what kinds of things should come out on top? For instance I am wondering whether I should give the player the highest priority or if it would be better if enemy bullets and the like were displayed first. What do you think?
-
- Posts: 7681
- Joined: Wed Jan 26, 2005 1:28 am
- Location: Bedford, UK
- Contact:
Surely whatever has the highest altitude would make sense. I don't know of any shmups where meshing sprites does not produce a hit, therefore eliminating both sprites.
In terms of "grazing" I would say its important for the bullet to be seen at all times, otherwise you can't see it. Sometimes this is done by changing the color of the bullet as it passes through/under/over the main ship.
In terms of "grazing" I would say its important for the bullet to be seen at all times, otherwise you can't see it. Sometimes this is done by changing the color of the bullet as it passes through/under/over the main ship.
This industry has become 2 dimensional as it transcended into a 3D world.
Enemy bullets/hazards on top of everything else
then Player sprite, then Enemy sprites (or these two reversed)
then Player shot
then Medals, Bonuses, Pickups
then come numerals indicating chain, bonus value, etc.
You want the most important/dangerous (enemy bullets, enemies themselves) to be on top, generally. This is especially key in manics. Of course, you can break the rules to make things interesting, like putting a cloud on top which obscures things, but this generally just annoys the player because under the cloud you have no idea where the bullet is, etc.
then Player sprite, then Enemy sprites (or these two reversed)
then Player shot
then Medals, Bonuses, Pickups
then come numerals indicating chain, bonus value, etc.
You want the most important/dangerous (enemy bullets, enemies themselves) to be on top, generally. This is especially key in manics. Of course, you can break the rules to make things interesting, like putting a cloud on top which obscures things, but this generally just annoys the player because under the cloud you have no idea where the bullet is, etc.
It's not always that straight forward though is it?
What about FX for explosions etc? For accuracy they should probably be on top but as this could obscure everything it doesn't always make it fair on the player or for good gameplay.
If there is any conflict like this then gameplay should always take priority.
What about FX for explosions etc? For accuracy they should probably be on top but as this could obscure everything it doesn't always make it fair on the player or for good gameplay.
If there is any conflict like this then gameplay should always take priority.
maybe something like this, bg/fg layers depend on how you're making the game though
hud / stats
fg layer 3
power ups
bullets enemy
player
bullets player (including impact effects)
enemy_alive air
explosions air (death)
enemy_death air
air to ground projectile/bombs
air to ground explosions
enemy_alive ground
explosions ground (death)
enemy_death ground
bg layer 2
bg layer 1
bg layer 0
hud / stats
fg layer 3
power ups
bullets enemy
player
bullets player (including impact effects)
enemy_alive air
explosions air (death)
enemy_death air
air to ground projectile/bombs
air to ground explosions
enemy_alive ground
explosions ground (death)
enemy_death ground
bg layer 2
bg layer 1
bg layer 0
heh, well there aren't going to be quite that many layers as I'm working with the TG-16.
I'm thinking I will fix the score/etc. at the highest priority, and the player (and player's weapons) at the lowest. Everything else will be variable but perhaps I can have enemy projectiles always take the highest priority sprite that is available. When other objects are created they will be assigned to the lowest priority sprite that is available.
I should have a one-level demo finished in about two weeks.
I'm thinking I will fix the score/etc. at the highest priority, and the player (and player's weapons) at the lowest. Everything else will be variable but perhaps I can have enemy projectiles always take the highest priority sprite that is available. When other objects are created they will be assigned to the lowest priority sprite that is available.
I should have a one-level demo finished in about two weeks.
I think there's a difference between layer and priority. In the case of layers, everything at layer A is either above or below everything at layer B. With priority, I think of it more as, "given that the processor might not be able to render every sprite before the frame has to be output, which sprites get drawn first?" This situation, when the hardware can't render everything in time, leads to either slowdown (render everything) or flicker (render only the highest priority sprites until time's up). The priority numbers can change from frame to frame.
I guess in that sense, priority was mostly a big deal for NES games. I don't know how good the PCE was with sprites. I don't recall any flicker in Blazing Lazers, but I never got to spend a lot of time at it.
For layers, bullets > enemies > powerups > player objects. I dunno about score, it could fit in anywhere.
I guess in that sense, priority was mostly a big deal for NES games. I don't know how good the PCE was with sprites. I don't recall any flicker in Blazing Lazers, but I never got to spend a lot of time at it.
For layers, bullets > enemies > powerups > player objects. I dunno about score, it could fit in anywhere.