Author Topic: Anti-aliasing???/Fade to black  (Read 3712 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Anti-aliasing???/Fade to black
« on: June 03, 2014, 12:53:52 pm »
I am thinking about rebooting an old game I was working on a while back, and as I was thinking about it, something very ingenious came to me. Let's say for a minute that the game's map is done in 3/4 level greyscale. I was wondering if it would be possible to have, at some point in the game, a timer to start running, and as that timer elapses, the map actually starts to darken (i.e. the greyscale slowly becoming darker until eventually the whole map is just black). If I could do this, then how hard would it be to have the effect not occur within a certain radius around a moving player?

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Anti-aliasing???/Fade to black
« Reply #1 on: June 03, 2014, 12:56:25 pm »
For the whole screen, just play with the contrast. It's not possible with only a part of the screen, except by successively lowering the gray level of the screen (ie making white pixels light-gray, light-gray pixels dark-gray etc), which is a very cheap solution anyway.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Anti-aliasing???/Fade to black
« Reply #2 on: June 03, 2014, 01:00:43 pm »
I'm gonna Pm you my idea... the contrast wouldn't work...

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: Anti-aliasing???/Fade to black
« Reply #3 on: June 03, 2014, 01:04:58 pm »
Why not just posting it here ?

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Anti-aliasing???/Fade to black
« Reply #4 on: June 03, 2014, 01:05:57 pm »
Well i kinda wanted the reboot to be a secret, but here it is:

Idea... Zelda reboot. Once you hit a certain point in the game, you get a message telling you darkness is spreading from wherever and you need to hurry or you'll lose the light. From that point on, the world darkens slowly. But, along the way you learn a light giving spell that can remove that effect within a certain area around you.


How difficult is this to do? Also, for this to be most effective, should it be 3 or 4 level grey?
« Last Edit: June 03, 2014, 01:17:54 pm by ACagliano »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Anti-aliasing???/Fade to black
« Reply #5 on: June 03, 2014, 01:24:49 pm »
You could add more and more black pixels all over the screen until only the character is left.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Anti-aliasing???/Fade to black
« Reply #6 on: June 03, 2014, 01:30:05 pm »
You could add more and more black pixels all over the screen until only the character is left.

I was wondering about some sort of bit-masking... but I'm really not knowledgeable of the concepts involved.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Anti-aliasing???/Fade to black
« Reply #7 on: June 03, 2014, 04:51:58 pm »
Here, you have a byte
Code: [Select]
XXXX XXXX
bit-masking is taking only some of these bits by using a bit mask and using binary AND
Code: [Select]
_XXXX XXXX
&1111 0000
=XXXX 0000
Here, you should use OR to only turn bits to 1 if you want to darken the screen.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Anti-aliasing???/Fade to black
« Reply #8 on: June 03, 2014, 06:29:51 pm »
One rather cheaty way to do it that would cost no rendering time (barring a one-time cost when changing the palette) would be to place a copy of all graphics in RAM, and when changing the palette, repopulate all the graphics data from the originals, but with palette adjustments made. Due to the potentially large RAM requirement, this may not be ideal/feasible.

A more traditional way would be to alter the perceived palette in the drawing code. If you use 3-level grayscale, you might do something like this:

Code: [Select]
Lbl Light
 0→D
Return

Lbl Dark
 1→D
 Fill(L₃,768,-1)
Return

Lbl PtOff
 Pt-Off(r₁,r₂,r₃)
 !If D
  Pt-Off(r₁,r₂,r₃+8)ʳ
  Return
 End
 Pt-On(r₁,r₂,r₃+8)
Return

4-level grayscale is a bit trickier, but it could look something like this:

Code: [Select]
Lbl Light
 0→D
Return

Lbl Med
1→D
Return

Lbl Dark
 2→D
 Fill(L₆,768,-1)
Return

Lbl PtOff
 !If D
  Pt-Off(r₁,r₂,r₃)
  Pt-Off(r₁,r₂,r₃+8)ʳ
  Return
 End
 !If -1
  Pt-Off(r₁,r₂,r₃)
  Pt-On(r₁,r₂,r₃+8)
  Pt-Off(r₁,r₂,[FFFFFFFFFFFFFFFF])ʳ
  Pt-Change(r₁,r₂,r₃+8)ʳ
  Pt-On(r₁,r₂,r₃)ʳ
  Return
 End
 Pt-Off(r₁,r₂,r₃)ʳ
 Pt-On(r₁,r₂,r₃+8)ʳ
Return

As you can see, the medium darkness logic is sort of tricky, and that may cause a noticeable slowdown in your program. I haven't looked into the other sprite drawing variants, but they'd probably have their own logical complications.

If it can be done without making them take substantially more time, the ultimate solution would be to go beyond Axe and to write a variant of the grayscale display routine for each palette. This would require no change in how graphics are drawn and little to no cost in rendering speed.
« Last Edit: June 03, 2014, 06:31:32 pm by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Anti-aliasing???/Fade to black
« Reply #9 on: June 04, 2014, 01:46:52 am »
I normally just change the contrast, but that cause issues with HUDs not being as visible.

Also at first from the Fade to Black part of the title I thought this would be a Metallica-themed calculator project. :P

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: Anti-aliasing???/Fade to black
« Reply #10 on: June 04, 2014, 01:55:15 pm »
I normally just change the contrast, but that cause issues with HUDs not being as visible.

Also at first from the Fade to Black part of the title I thought this would be a Metallica-themed calculator project. :P

Yeah, contrast changing would be easier, but it has the drawback of making the HUDS not visible and also i can't do the sphere of the effect-removing spell.

Is there anyone here with some experience making RPG's of this style with some spare time? I have the project hosted on Bitbucket and I'd be more than happy to have anyone who wants to contribute, even just a little, help.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Anti-aliasing???/Fade to black
« Reply #11 on: June 04, 2014, 02:05:52 pm »
You could use appbackupscreen and gradually draw a ring around it. Just OR the gbuf with the corresponding byte in appbackupscreen (i dunno if your grayscale routine uses this as the second buffer, if it does just _InsertMem 768 bytes at the end of your program). It'll maybe cause a bit of slowdown but i don't think it'd be too bad, an extra 7 states for the OR statement (assuming your ORing it with (hl)) and another 15 t-states for the extra add statement (and maybe an extra 8 t-states if you've got to switch to shadow registers) in the main loop, but a lot of that can replace the wasted cycles if there are any in your grayscale code (i've never used grayscale, so i don't know what the fastcopy routine tends to look like).