News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_SpDizzy

Best approach for light/lantern effect on tilemap. Help needed.

Started by SpDizzy, 19:04, 29 November 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SpDizzy

Hi guys,

Can someone shine a light about the best approach for a lantern effect on screen, where only part of the tilemap is visible as the player walks, and the rest just zeros?
I was wondering about this 2 possibilities:

1 / Draw the full tilemap once at the enter of the screen (as is done in any other screen), and then 'mask' in some way just the part of the screen that has to be visible.
2 / Draw just the 'circle' part of the tilemap leaving the rest of the screen with zeros, and update tilemap pointers on player movement.

Atached as example, capture of desired effect from masterpiece 'La Abadia del Crimen'.

Thanks so much in advance for support,

ervin

I would definitely go with option 2.
That would be much less work for the cpu.

SpDizzy

Thanks so much for your response ervin, really appreciate your help and support.Let me explain my idea, please. Sorry if it's not well arranged yet on my mind.
Trying to go for a 256 x 144 screen where 50% will be 'lighten' most of time, and rest not visible.So, when the player moves left/right part of that not visible area will be 'lighten', showing on screen.
That initial idea pointed me to think on second approach as a possibility.
2/ Second approach is meant to drawn once, and only once, full tilemap on screen area 256 x 144, and XOR (don't know if it will be the correct operator) with circle shape that will be showed.So for next update, XOR again to retrieve background/tilemap, change circle coords based on player moves, and so on...
Again, don't know if the idea is correct aligned on my mind, neither if it will be much cpu consuming. I think a 10 fps rate will be great achievement.
1/ As for first approach, I understand there's no need to draw full tilemap, and just visible/lighten circle area, so much less overhead.But this area has to be updated on every player movement, and it is 50% of screen area (aprox 150 x 122), such a huge dirty region.
Is any real possibilily, beyond my imagination, for any of the approaches?

In case it will be on any help, working under #cpctelera 1.4.2 release

Powered by SMFPacks Menu Editor Mod