Users browsing this thread: 1 Guest(s)
Day/Night cycles in FF6

#21
Posts: 2,380
Threads: 93
Thanks Received: 358
Thanks Given: 327
Joined: Aug 2009
Reputation: 44
Status
Nattak\'d
Have you had any luck with the NPC issue LK? I just won a fight against a timer-related issue I was having in Zozo making pseudo-random lightning strike flashes w/ thunder sound via entrance event timers, the issue being when the timer was up and if the menu has been opened/map refreshed, the last NPC # on the map would break pose and face up, like your problem here. For me it was that dead girl NPC lying down in the streets... So what I did is simply throw in an action command for the culprit NPC with the same pose to make the NPC stay put right after the lightning strike (timer end).

Have you tried this fix already for your issue? Or is it somehow different and would not work for what you are doing? I know this would still not solve it for NPCs that are moving around, but this should work for all the shop NPCs at least. I'd think there should be a way to fix the walking around ones from turning up also, hopefully.

Lightning looks awesome in Zozo btw:
[Image: TQUcMtA.gif]

Another issue for this particular NPC was when I talked to the NPC after the timer ran out, she broke her pose again due to my edited entrance event code and because her event address was set to 5EB3 (simply return and break pose). So I gave her an event address that does the pose and everything is good now, she stays dead lol.


We are born, live, die and then do the same thing over again.
Quote  

#22
Posts: 826
Threads: 11
Thanks Received: 60
Thanks Given: 29
Joined: Nov 2011
Reputation: 16
Status
Double
Haha, perfect timing. I finally completed my exams for the year a couple days ago, so I finally have an opportunity to work on this now.

I haven't figured anything else out. What you are doing could be implemented for a single map easily enough, but the issue is that I'd prefer a single timer to work for all maps (so that the person implementing the hack can simply start the timer and be good). This would require a lot of timer code that does different things, all implemented by the hacker, which I'm trying to avoid because I want to make this as straightforward as possible. It would be a good fallback if I can't work anything out though. I'll look into this tomorrow.


Confused Moogles FTW
Quote  

#23
Posts: 127
Threads: 8
Thanks Received: 44
Thanks Given: 29
Joined: Jan 2012
Reputation: 13
Status
None
Hey Lockirby2,

I really like what you did with this, so I looked into making a Day/Night routine for the overworld. Here is a routine for mode 7 day/night, it uses the game timer as clock:

Offsets are with header

Code:
; overworld day/night
2E0684:       20 01 AF        JSR $AF01    ; day/night routine

; vehicle day/night
2E03FB:       20 01 AF        JSR $AF01    ; day/night routine

; day/night routine
2EB101:       20 AD AA        JSR $AAAD    ; Animate Water Tiles
2EB104:       E2 20           SEP
2EB106:       AD 1C 02        LDA $021C   ; Get time in minutes
2EB109:       29 0F           AND #$0F
2EB10B:       C9 08           CMP #$08
2EB10D:       10 02           BMI
2EB10F:       49 0F           EOR #$0F
2EB111:       85 22           STA $22     ; Set brightness destination
2EB113:       60              RTS

The JSR calls at 2E0684 and 2E03FB replace a call to JSR $AAAD (20 AD AA). This call is now made at the entry point of our new day/night subroutine. The routine then gets the minutes of gametime and converts them to brightness. The cycles are 16 minutes and each step happens on the minute each minute.

To change the steps from minutes to seconds (fun for testing) change the following line:
Code:
2EB106:       AD 1D 02        LDA $021D   ; Get time in seconds

The new routine is placed to overwrite free space located from Gi Nattaks post. But it should be no problem to locate it anywhere in the 2E bank.

For other mode 7 scenes that might need day/night, like airship liftoff and land scenes. You can replace the call to JSR $AAAD (20 AD AA) "Animate Water Tiles" with a call to JSR $AF01 (20 01 AF) "day/night routine" in other mode 7 scene routines.
  Find
Quote  
[-] The following 2 users say Thank You to m06 for this post:
  • Catone (03-22-2015), Lockirby2 (03-22-2015)

#24
Posts: 826
Threads: 11
Thanks Received: 60
Thanks Given: 29
Joined: Nov 2011
Reputation: 16
Status
Double
Oh man, this is pretty awesome! This ASM code seems a lot cleaner than what I did with my event editing thanks to the issues with the timer causing an NPC to turn straight up for some reason. I also noticed later that I had problems sometimes with stepping over event/exit tiles, which could cause some pretty bad problems as well.

I think that throwing this into hacks would be pretty great on its own.


Confused Moogles FTW
Quote  

#25
Posts: 127
Threads: 8
Thanks Received: 44
Thanks Given: 29
Joined: Jan 2012
Reputation: 13
Status
None
Thanks for the positive feedback, I'm happy you like this. I think your version for locations (note: my version does not work for towns or dungeons) is a lot nicer and more flexible. I would love if you posted some examples of how you made this work.

One thing I noticed is you use a blue-ish tint, while I just change the brightness, would be interesting to look up the command you use and see if we can use a tint routine rather then just brightness.

I'm also interested in how you made the people respond differently depending on time. I think if we could hook up your stuff to follow the game timer rather then a custom timer we might solve some of your bugs.
  Find
Quote  

#26
Posts: 826
Threads: 11
Thanks Received: 60
Thanks Given: 29
Joined: Nov 2011
Reputation: 16
Status
Double
Well, the issue for me using the game timer is that my own code is entirely made using event hacking (and therefore the commands already in the game) rather than ASM code. I don't think that I'm able to access the game timer directly using the cutscene commands like this.

Basically, the way mine is set up, I have six (I think, it's been a while) event bits that are set depending on how light/dark it is. I also have one event bit that determines whether it is getting lighter/darker. So for NPCs to react differently depending on what time of day it is, I need to judge what the darkness level is, and also possibly use the bit that determines whether it gets lighter/darker, to determine morning vs. evening.

If ASM code can interact with the same event bits that I use in a similar way, it could easily be just as flexible, but the ASM code could handle the lightening/darkening the screen without the bugs I have, hopefully.

I'll also throw my documentation at you if that summary isn't enough. I can't remember all of what's in there, but it might be helpful:
https://www.mediafire.com/?tdwfs3jrmucgsxz

I want to get into SNES ASM hacking some day (I already know some assembly), but I can never find the time.


Confused Moogles FTW
Quote  

#27
Posts: 127
Threads: 8
Thanks Received: 44
Thanks Given: 29
Joined: Jan 2012
Reputation: 13
Status
None
Thx for the docs Lockirby2, good stuff

I've been trying to rethink how to get the tint routine to run in sync with the game timer, but I still need to give it some time.

I tried the brightness on locations but I think it looks really shitty compared to tinting and was lagging (I guess I hooked it up in a shitty place).

However, I made a new event command to use the game timer. There are a number of unused event commands so I assigned 66 to branch during a period of time.

Event Command 66 (branch if time of day):

66 AB CC CC CC

A: Start time
B: End time
CC CC CC: Address to branch to for duration.

The time of day is measured in minutes as a 12 minute cycle (0-B).

Code:
; Time of day event command $66
@ 009B26:       13 D6           # (gen. act. 66 pointer)

; Free space used at: $00D813
@ 00D813:
                E2 20           # SEP #$20      (8 bit accum./memory)

                AD 1D 02        # LDA $021C   (Get time in minutes)
                C9 0C           # CMP #$0C    (compare with 12)
                30 04           # BMI +4      (If 0-12 skip to set time of day)
                E9 0C           # SBC #$0C    (A - 12)
                80 FB           # BRA -5      (loop)
                85 1A           # STA $1A     (set time of day at $1A)

                A5 EB           # LDA $EB     (parameter 1)
                4A              # LSR A
                4A              # LSR A
                4A              # LSR A
                4A              # LSR A       (A >> 4, get upper half)
                3A              # DEC A       (A-1, lower boundary)
                C5 1A           # CMP $1A     (compare with time of day)
                10 16           # BCC +16     (lower boundary > time of day then exit)
                A5 EB           # LDA $EB     (parameter 1)
                29 0F           # AND #$0F    (mask out upper 4 bits, get lower half)
                C5 1A           # CMP $1A     (compare with time of day)
                30 0E           # BCS +0E     (upper boundary < time of day then exit)

                A6 EC           # LDX $EC     (parameter 2-3)
                86 E5           # STX $E5     (set event address)
                A5 EE           # LDA $EE     (parameter 4)
                18              # CLC
                69 CA           # ADC #$CA    (+ CA)
                85 E7           # STA $E7     (set event address bank)
                4C 6D 9A        # JMP $9A6D   (exit)

                A9 05           # LDA #$05      (advance the script 5 places)
                4C 5C 9B        # JMP $9B5C     (standard exit)

This command allows you to do the same you where doing before but without any event bits used and in sync with the game clock (always running).

You still need a timer to run the tinting while at a location though.
  Find
Quote  

#28
Posts: 826
Threads: 11
Thanks Received: 60
Thanks Given: 29
Joined: Nov 2011
Reputation: 16
Status
Double
Cool stuff! Smile The event command makes this system much easier to deal with than it was before.

I'm still trying to think of some way to deal with the screen tinting issue. My ASM knowledge is limited though, so it's difficult to do any decent problem solving here.


Confused Moogles FTW
Quote  

#29
Posts: 110
Threads: 4
Thanks Received: 17
Thanks Given: 1
Joined: Jan 2012
Reputation: 4
Status
None
Does it set a variable for day and night? I could imagine some things I could do with it if so.
  Find
Quote  

#30
Posts: 274
Threads: 18
Thanks Received: 133
Thanks Given: 53
Joined: Mar 2014
Reputation: 8
Status
None
m06, this is pretty cool!

Can it be made to sync up with Lockirby2's event editing, so that the timer is set correctly when entering a location map? So that the brightness/tint on the location map matches what it was on the world map. I guess the other way around is kind of tricky though, the game timer being what it is.

By the way, a limitation of this implementation is that the day/night cycling stops when the game timer reaches 99:59. Is there a workaround for this short of resetting the game timer when it reaches the maximum?

Leviathan Mist wrote a patch to let the game timer reach 255 hours 59 minutes, which could help. And some FF games simply reset the timer when it caps out but change its color, so it would cycle through I think 5 different colors and stop at the fifth.

Edit: Where do I start looking if I want the timer to affect encounter rate and/or which formations can be encountered?
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite