(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-05-24 02:52 AM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - Zelda3 - Time + Day/Night system (IPS included) New poll | |
Pages: 1 2 3 4Add to favorites | Next newer thread | Next older thread
User Post
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6286 days
Last view: 6286 days
Posted on 08-23-06 03:32 PM Link | Quote
Well I'm still working on this, basically it is done and I'm just trying to figure a way out so that it would work on layers as well; but it seems impossible because the fixed color add/sub only works on main-screen BGs, and Z3 uses a BG1 sub-screen to create its layer effect; it should work on hires mode according to Anomie's doc, but even when setting in pseudo-hires mode, it still doesn't work...
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6285 days
Last view: 6285 days
Posted on 08-23-06 04:20 PM Link | Quote
Try in more than one emulator; a real SNES if possible.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6285 days
Last view: 6285 days
Posted on 08-23-06 04:26 PM Link | Quote
What do you mean by "layer effect"? If you mean the rain or clouds, you can only have one or the other: subscreen add/sub, or fixed color add/sub. you can't get around this.
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6286 days
Last view: 6286 days
Posted on 08-23-06 07:22 PM Link | Quote
Well that was what I had figured out; so if I resume, I can't add the blue tint to areas with layers (rain, clouds, etc.). I wonder how d4s managed to get it to work, if he did.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6285 days
Last view: 6285 days
Posted on 08-23-06 08:24 PM Link | Quote
since the rain covers up the rest of the screen but is only being added or half added, you'll want to modify the palettes of the tiles of each BG you want to change. obviously this would exclude BG2 which is the status screen, etc. To make sure the palette data (CGRAM) is updated in the PPU every frame, make sure to set the variable $7E0015 to 1 every frame. This is one of the graphics flags mentioned in my docs but I didn't really release much info on them yet. The otherf flags do other things like update the screen (edit: by update the screen I meant actually change the graphics, not just palettes)

The data that would be blitted into CGRAM every frame is stored starting at $7EC500 and is $200 bytes long. I'd need to look into a way of knowing which palette entry corresponds to which BG. *update* Pretty much I'd say if you stay away from $7EC500 to $7EC53F you should be fine. Those are the two palettes BG2 uses. Everything else is the remaining BGs and the sprite layer (sprite layer is $7EC600 and beyond, whereas the BGs palettes are before that.) I consulted this for some of that info:

http://qwertie.netfirms.com/attic/snesemu/qsnesdoc.html

Also a very good read but a bit outdated, missing some info. Much easier to read than most docs.


(edited by MathOnNapkins on 08-23-06 07:25 PM)
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6286 days
Last view: 6286 days
Posted on 08-24-06 11:53 AM Link | Quote
Ok, so here's the preliminary code that create the night effect with the fixed color addition ; it should work fine except on areas that have layers (basically all layer areas (forests, mountains...) should have normal colors on them with layers being altered by the fixed color, and the pyramid area is screwed up).
Time to take a look at all this palette stuff, difficulty is getting more and more interesting
Reshaper256

190


 





Since: 11-17-05
From: United States

Last post: 6328 days
Last view: 6285 days
Posted on 08-24-06 03:10 PM Link | Quote
I must say that using the blue tint looks much better, but even the darkest part of night still seems too bright.


(edited by Reshaper256 on 08-24-06 02:11 PM)
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6286 days
Last view: 6286 days
Posted on 08-24-06 04:22 PM Link | Quote
Originally posted by Reshaper256
I must say that using the blue tint looks much better, but even the darkest part of night still seems too bright.

Well, just change the $9C & $9D tables to higher values for night hours and voila!


Well, I've managed to change the palettes, I can add a blue tint to the colors by OR-ing them with the proper value but I can't figure a way out to reduce their brightness since the RGB values are distributed between 2 bytes ; all I could get is brigther with an AND instruction... I guess I'll have to find a way to parse each color from the 2 bytes, reduce their value and then re-combine them.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6285 days
Last view: 6285 days
Posted on 08-24-06 08:41 PM Link | Quote
From just randomly messing around, it seemed to me that color subtraction worked a lot better than color addition for producing that night effect. However, it's all relative to that particular setup, I'm not saying one is better than the other for any given scenario, it depends on the colors you are using in the first place.
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6285 days
Last view: 6285 days
Posted on 08-24-06 08:42 PM Link | Quote
The colour bits should be something like xrrrrrgg gggbbbbb. You might be able to just reduce red and green while not modifying blue.


(edited by HyperHacker on 08-24-06 07:42 PM)
JaSp

Shyguy








Since: 11-18-05
From: Paris, France

Last post: 6286 days
Last view: 6286 days
Posted on 08-24-06 11:35 PM Link | Quote
Well actually the format is xbbbbbgg gggrrrrr, and I need to find a way to add a blue tint to each color + make them darker; and so far I haven't found a way to create such an effect manipulating each palette colors.
Pros: it would work on areas with layer & it applies on all palettes BG+sprites (whereas fixed color add/sub doesn't work on sprites with palette 0-3)
Cons: I doubt it would look as nice as the fixed color add/sub (whatever) which just looks perfect for a night effect...
BeeRad277
Newcomer


 





Since: 08-26-06

Last post: 6454 days
Last view: 6454 days
Posted on 08-26-06 03:39 AM Link | Quote
I've been wanting to make a day/night system for zelda 3 for sometime. Good work. Although my idea was a little different. I have been planning on making it for the hack I'm working on. Since the game has a beginning, first part, and second part, I was going to make the first part day, and the second part night and it would change depending on what time it is. Although this won't work too well with zelda 3 since things won't change after pulling the master sword and going to the dark world if its used for something else, but it would be great for a zelda 3 hack. The reason it's such a good idea in my opinion is because things can be different at night just like oot, mm, and ww. I don't know if it could slowly get darker like in your hack though. It would probably have to work just like it does in BS Zelda 3: Ancient Stone Tablets. In other words it would have to fade in and out and in the process of doing that it changes from day to night. Although it probably could slowly get darker before it fades in and out. I'd love to do this some day but I don't know where to start. Anyway, very impressive man. Atleast now I know a day/night system is possible thanks to you.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6285 days
Last view: 6285 days
Posted on 08-26-06 07:28 AM Link | Quote
JaSp: have you ever wandered around an area of the overworld while it was still raining? I mean through glitching or memory editing .... some sprites on the OW will stick out like a sore thumb. This is because not only will fixed color +/- not work on sprites with palettes 0 through 3, neither will subscreen +/-.
d4s

Shyguy








Since: 12-01-05

Last post: 6407 days
Last view: 6305 days
Posted on 08-26-06 09:19 AM Link | Quote
Originally posted by JaSp
Well I'm still working on this, basically it is done and I'm just trying to figure a way out so that it would work on layers as well; but it seems impossible because the fixed color add/sub only works on main-screen BGs, and Z3 uses a BG1 sub-screen to create its layer effect; it should work on hires mode according to Anomie's doc, but even when setting in pseudo-hires mode, it still doesn't work...



thumbs up for implementing that cgadsub stuff. =)
remember that no matter how youre trying to do a transparency effect on the snes (fixed color add/sub, layer add/sub, doubled horizontal resolution), it always involves using the mainscreen and the subscreen. thats why you cant have more than one layer of transparency.

sorry, i think i didnt remember correctly how z3 does the rain stuff and mixed that up with super mario world, was so long ago already.


Originally posted by JaSp
Well actually the format is xbbbbbgg gggrrrrr, and I need to find a way to add a blue tint to each color + make them darker; and so far I haven't found a way to create such an effect manipulating each palette colors.
Pros: it would work on areas with layer & it applies on all palettes BG+sprites (whereas fixed color add/sub doesn't work on sprites with palette 0-3)
Cons: I doubt it would look as nice as the fixed color add/sub (whatever) which just looks perfect for a night effect...


you mean you havent yet thought of a way to modify each color seperatly in assembler or youre having difficulties getting that to work with z3?

cause an actual routine that seperates the colors and recombines them is really easy to implement.

say you want to just increase the intensity of blue.
get the color word, save it somewhere, AND out everything but blue so youre left with 0bbbbb00 00000000, clear the carry and LSR A it until youre left with 00000000 000bbbbb, increase or decrease the value, ASL A blue back to its correct position in the word, save that, clear the blue values in the previously saved original color word and OR the result with the new blue value.
proceed the same way with the remaining colors.
grudge1981
Newcomer


 





Since: 07-11-06

Last post: 6451 days
Last view: 6451 days
Posted on 08-28-06 03:53 AM Link | Quote
this would come in really handy if you could have the game convert from day to night, with light and dark world,
so you could use light world as daytime and have items events possible until morning then at night it switches to darkworld where everyone is in thier homes and more dangerous monsters roam the land

of course have this hack so there is a night time feel to the darkworld
BeeRad277
Newcomer


 





Since: 08-26-06

Last post: 6454 days
Last view: 6454 days
Posted on 08-28-06 11:55 PM Link | Quote
Thats similar to my idea except yours would probably be much harder to do. Using the darkworld for night would require you to change the entire world around to look like the lightworld at night. Although your idea may not require any code changes if you change the mirror to some sort of device that moves you forward in time. You also wouldn't have to use a background. You could just change the darkworld pallettes to make everything look dark. However, either way you could only use something like that in a hack. Although thats probably what you would plan on using it for.

Anyway, the light world in Zelda 3 is made up of three main sections. The Beginning, After rescuing zelda, and after defeating agahnim. You can make After rescuing zelda day, and after defeating agahnim night. If a clock is created, like the one Jasp made, at about 6:00 it can change to day(After rescuing zelda) and at about 18:00 it can change to night(after defeating agahnim). This can be done because you can change things for each section with hyrule magic already. However, making every frame night for after defeating agahnim would require some hex editing.

I know this can be done because Like I said before, in Ancient Stone tablets they used the different sections to make it start raining. First it would get cloudy and all the regular baddies are replaced with zoras, then it would start raining, and this all ran off of the clock that was used in the game. As the game would change sections, everything except link would fade into black and fade out to a cloudy section and so on.
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6285 days
Last view: 6285 days
Posted on 08-29-06 03:12 AM Link | Quote
Jasp: if you want to avoid some of the bit shifting d4s mentioned, you can simply take the BGR color value and do something like the folowing:

PHP
REP #$20

LDA !color_value ; get the color value from wherever
AND #$7C00
STA !blue_value

BEQ do_green

CMP #$7C00

BEQ do_green

CLC
ADC #$0400 ; adds one to the blue field
AND #$7C00 ; mask out everything except the blue bits

STA !blue_value

do_green:

LDA !color_value
AND #$03E0
STA !green_value

BEQ do_red

CMP #$03E0

BEQ do_red

SEC
SBC #$0020 ; subtract one from the green field
AND #$03E0 ; mask out everything but the green bits
STA !green_value

do_red

LDA !color_value
AND #$001F
STA !red_value

BEQ end

CMP #$1F

BEQ end

SEC
SBC #$0001 ; subtract one from the red field
AND #$001F ; mask out everything but the red bits
STA !red_value

end:

LDA !blue_value
ORA !green_value
ORA !red_value
STA !color_value

This will make whatever color that is inputted more blue and less red and green. You could call this routine, say, 4 to 6 times as night progressively falls. If you used tables you could probably even make this routine reusable for the transition back to daytime.

edit: fixed a logic error. Also now handles overflow within each color field.


(edited by MathOnNapkins on 08-29-06 02:20 AM)
(edited by MathOnNapkins on 08-29-06 03:14 AM)
(edited by MathOnNapkins on 08-29-06 03:14 AM)
d4s

Shyguy








Since: 12-01-05

Last post: 6407 days
Last view: 6305 days
Posted on 08-29-06 04:26 AM Link | Quote
haha, how could i not think of that, mon.
thats of course way easier than my method.

i was somehow under the impression that he wanted to apply more complicated math, which would've required to to get the "true" brightness of each color first.

anyway, using tables instead of adding/substracting a fixed value is probably the way to go, i agree. that way, you can finetune each step individually and tint the screen red in the evening, then from blue to dark in the night.

seiken densetsu 3 has an excellent implementation of a day/night palette changing routine. have a look at it if you have time.


(edited by d4s on 08-29-06 03:27 AM)
(edited by d4s on 08-29-06 03:29 AM)
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6285 days
Last view: 6285 days
Posted on 08-29-06 05:32 AM Link | Quote
Didn't like the old code so rewrote some of it.

; Value of the X register should be determined by the calling routine

PHP
REP #$20

LDA !color_value ; get the color value from wherever
AND #$4210 ; find out the MSB's of each color field.
STA !color_msbs

LDA !color_value
AND #$7C00
STA !blue_value
CLC
ADC !blue_delta, X; adds amount to blue field based on a table
AND #$7C00 ; mask out everything except the blue bits
STA !temp_value
EOR !color_msbs
AND #$4000 ; see if the sign of the blue value switched

BNE blue_sign_change ; keep the old value if overflow occurred

LDA !temp_value ; if not the new value is okay to use

BRA no_blue_sign_change

blue_sign_change:

LDA !blue_value

no_blue_sign_change:

STA !blue_value

; .... etc etc. repeat same logic for green and red color fields. The old code did not properly handle overflow in the general case of applying arbitrary values.


(edited by MathOnNapkins on 08-30-06 09:38 PM)
grudge1981
Newcomer


 





Since: 07-11-06

Last post: 6451 days
Last view: 6451 days
Posted on 08-30-06 01:33 AM Link | Quote
wow i cant wait to see how this will look with mathonnapkins way of implementation, should look awesome and add a whole new way of making alttp hacks, well if you try what i wanted with the nightime switching you to darkworld for a similar world but nighttime, maybe a tide or something to allow entrance to some dungeons only at certain times.......


SOOO many ideas im gonna have to change my hack entirely.......

not to go off topic but can i make the transition from light to darkword use the entrance exzit from dungeon sreen change (you know the loony tunes style circle closing in on link
Pages: 1 2 3 4Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - Zelda3 - Time + Day/Night system (IPS included) |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.023 seconds; used 450.61 kB (max 579.84 kB)