Jump to content

Photo

Blend characters with background


14 replies to this topic

#1 Yaron Nir OFFLINE  

Yaron Nir

    Star Raider

  • 98 posts

Posted Wed Feb 6, 2019 6:43 AM

If you look this WIP :

You will notice a rectangle behind the main moving characters. It seems character mode was used and no PMG. The clipping area of the software sprites looks funny.

Is there a way to fix that? How do you blend the character with the background once it goes over other character ?
I am more interested in the logic behind it than giving me the code that does it

Tnx

#2 Cyprian_K OFFLINE  

Cyprian_K

    Chopper Commander

  • 108 posts

Posted Wed Feb 6, 2019 8:23 AM

idk, but WIP looks cool



#3 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 14,332 posts
  • Location:United Kingdom

Posted Wed Feb 6, 2019 8:24 AM

You'd have to OR the data of both bitmaps into a single character cell. This would mean dynamically changing the character set using spare characters specifically devoted to 'cross-overs'.


Edited by flashjazzcat, Wed Feb 6, 2019 8:25 AM.


#4 Yaron Nir OFFLINE  

Yaron Nir

    Star Raider

  • Topic Starter
  • 98 posts

Posted Wed Feb 6, 2019 9:16 AM

Do you mean XOR between main char and background char?

Will that eat tones of CPU?

Can you give some game references that does this technique ?

#5 flashjazzcat OFFLINE  

flashjazzcat

    Quadrunner

  • 14,332 posts
  • Location:United Kingdom

Posted Wed Feb 6, 2019 9:50 AM

Basically, yes. I'm not sure how damaging the CPU overhead would be or whether all possible combinations of superimposed bitmap could be pre-computed (this would require a lot of spare characters).

 

I'm no game programmer, unfortunately, so am not well placed to point out any tutorials, but at the very least you'd require a background mask for the image in front. Bits in the background would be ANDed with the background mask to clear a silhouette of the image in front, and then the foreground bits are ORed in.



#6 emkay OFFLINE  

emkay

    Quadrunner

  • 9,673 posts
  • What's up?
  • Location:Holy Grail ;)

Posted Wed Feb 6, 2019 2:21 PM

The interesting part of that "demo" is that it is demonstrating the limits of the A8. Character modes won't help much for speed, if people want to have fluent and detailed animation with high fps on the screen.
Every character mode steals too much CPU cycles already, before a software sprite is moved.
The solution for such games is still Mode D with underlaying or overlaying PMg .

#7 Schlortt ONLINE  

Schlortt

    Space Invader

  • 22 posts

Posted Wed Feb 6, 2019 4:22 PM

Zone Ranger is one example that uses XOR but to perfectly mask, especially on a character that stays in focus like this, you would want to pre-render or use an AND and then an OR.  The explanation that resonated most for me was in the "Image Masks" section of this article:

https://en.wikipedia...ask_(computing)

 

I know Popmilo has done a lot of work in this area.  See this thread as well which discusses performance and other concerns: 

 

http://atariage.com/...=+soft +sprites



#8 Yaron Nir OFFLINE  

Yaron Nir

    Star Raider

  • Topic Starter
  • 98 posts

Posted Wed Feb 6, 2019 4:29 PM

Thanks Schlortt!!

#9 emkay OFFLINE  

emkay

    Quadrunner

  • 9,673 posts
  • What's up?
  • Location:Holy Grail ;)

Posted Thu Feb 7, 2019 12:32 AM

Thanks Schlortt!!


They didn't answer your question.
The Bit calculations for Software sprites could take 7 times more CPU cycles per sprite, than just using byte boundaries. Well, it depends on the size of the sprite, but it takes a lot CPU . The coder aimed the 25fps for a smooth gameplay and, of course clean displaying of the scrolling. You might know that the scrolling is at 25fps, so you have to assure 25 fps updates on all software sprites, to have no jitter in the movement of the sprites.
And , as there were several different objects in different direction with 25 fps moving , there is no real chance to handle the borders without ruining the animations.

#10 Heaven/TQA OFFLINE  

Heaven/TQA

    Quadrunner

  • 11,164 posts
  • Location:Baden-Württemberg, Germany

Posted Thu Feb 7, 2019 2:25 AM

Gremlins / Conan / Hard Hat Mack / Droll etc use XOR sprites...

 

gets messy with background but its easy to use and easy to erase ;)



#11 tebe OFFLINE  

tebe

    Dragonstomper

  • 786 posts
  • Location:Poland

Posted Thu Feb 7, 2019 3:54 AM

XOR = low mem usage, faster (PANG - title screen, MARIO BROS.)

#12 Yaron Nir OFFLINE  

Yaron Nir

    Star Raider

  • Topic Starter
  • 98 posts

Posted Thu Feb 7, 2019 5:23 AM

Gremlins / Conan / Hard Hat Mack / Droll etc use XOR sprites...

 

gets messy with background but its easy to use and easy to erase ;)

 

i must say that conan has a very poor performance. the characters are flickering , the movement is not smooth and very slow.

in gremlins the background is mostly black so not many overlaps between characters

hard at mac is faster than conan, but still flickery and the XOR looks not so good.



#13 Yaron Nir OFFLINE  

Yaron Nir

    Star Raider

  • Topic Starter
  • 98 posts

Posted Thu Feb 7, 2019 5:27 AM

XOR = low mem usage, faster (PANG - title screen, MARIO BROS.)

pang does an excellent work with blending the software sprites (chars) with the background. not sure it is XOR though,i think AND and then OR was used.

 

in mario, the chars flicker and the XOR looks not so good



#14 emkay OFFLINE  

emkay

    Quadrunner

  • 9,673 posts
  • What's up?
  • Location:Holy Grail ;)

Posted Thu Feb 7, 2019 6:53 AM

pang does an excellent work with blending the software sprites (chars) with the background. not sure it is XOR though,i think AND and then OR was used.


In Pang it doesn't matter , if a sprite is moving at either 3,5,7,1,15, 25 or 50 fps, as the screen is still. As soon as HW-Scrolling is used, all software sprites have to be synchronized to the scrolling speed.

#15 emkay OFFLINE  

emkay

    Quadrunner

  • 9,673 posts
  • What's up?
  • Location:Holy Grail ;)

Posted Fri Feb 8, 2019 2:30 AM

Btw: The Atari has several options to show a moving object on a scrolling screen, without Bit handling.
If wanted, the background could be exchanged to COLPF2 and 3, the object is allowed to walk over a chessboard, without any bit calculations.
Then there is still the option to multiplex the PMg. For the stones in the background (for example). It may take a lot CPU , but every moving object would be saved from extra Bit calculations.

The really nifty solution could be to build the main Sprite on character graphics, as in the game, but to also use the PMg for that range of where the masking is needed.




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users