Author Topic: Random encounters on the world map  (Read 5488 times)

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Random encounters on the world map
« on: 2011-12-29 19:29:14 »
Hi there,

I want to know which look-up table is used for the random encounters on the world map. Is it identical to the one used in field encounters (177 202 238 108 …)?

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #1 on: 2012-02-01 22:39:07 »
Hmm, I played around with little success.

I couldn’t find the RNG-table used for field encounters (177 202 238 […] 171 176 012) in the psx emulator memory, so I think it isn’t used for the world map encounters.
I filled another RNG-table (099 006 240 […] 199 106 202) with zeros, but there weren’t any significant differences in enemy encounter times, formations and pre-emptive chances. Additionally there were no differences between a normal loading from memory card after a hard reset and the same procedure only with  the »zeroed« RNG-table .

So it seems that the encounter formation is done differently (or my methods were wrong). So, how can I determine it? I know that Enemy Lure/Away has an impact (not always) on the encounter formation, if that helps.

NFITC1

  • No life
  • *
  • Posts: 2832
  • Karma: 71
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Random encounters on the world map
« Reply #2 on: 2012-02-01 22:47:36 »
That might be something worth looking into especially if it can be manipulated. There are likely multiple RLUTs for enemy encounters. I'd imagine it'd be different for fields and world map, but it might just be a difference in the handling of the encounter mechanic. The one starting with 99 is the battle-related RLUT. Everything in-battle is determined using this including item drops and possibly random requests from animations.

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #3 on: 2012-02-02 12:14:46 »
Yeah, when I filled the 99 RLUT with zeros the ATB gauge was always almost full at the beginning.
However, I have written a (poor) script to check the emulator memory dump for other tables – where 256 numbers are next to each other – and there was exactly one table.
What I’ve forgotten to tell the last time: I’ve tried to find differences between two memory dumps, but even with the same ingame view the differences are huge (I realised just now, that I didn’t synced the sound).

Well, I’m completely out of real ideas (I guess just syncing the sound won’t reduce the huge differences to a sane level). What can I do?

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #4 on: 2012-02-27 12:04:34 »
No success till now, nevertheless here are my findings:

Enemy encounter formation can be influenced by at least three things:

1) Materia
 -Enemy away
 -Enemy lure
 -Pre-emptive equipped on the third character
2) Button pushing
 -up and down (both identical)
 -left and right
 -clockwise and counterclockwise rotating view buttons
3) Amount of time spend in the last battle (at least in the result screens)

The Enemy away/lure materia can change the amount of battle checks and as a result different battles are possible. The pre-emptive materia can change the encounter itself (don’t know about the checks, haven’t found one, but this is still open).
The up and down buttons doesn’t change the amount of battle checks and encounters, which means running with a chocobo up and down won’t change the battle checks and encounter.
The left/right and rotating view buttons are almost identical. The difference is that left/right counts towards the battle check. Pushing both button types while not moving the normal character can give different amounts of battle checks and/or enemy encounter. This means just rotating your view or flying left and right with the Highwind can give different encounters.
Rotating one to the left (or right – doesn’t matter) and then running up/down will give the same result as running up/down and then before the last up/down button push a rotate of one.
The RNG table in the kernel (starting with 099) is not (directly) involved. 


I tried to play with memory values obtained by a diff at different times in the battle result screen, but without luck. Trying to get a reasonable difference on the world map failed even with 1 frame per s advance. Thousands of different lines à 16 is just to much.

What could help is a way to get a instant battle. I’ve found the memory value for the Enemy Lure/away, but not for the encounter value. I tried to find the difference between Cosmo area and a forest, but it seems that die encounter value is not stored as a simple hexadecimal conversion.

All help/ideas are welcome to solve this.

DLPB

  • No life
  • *
  • Posts: 9196
  • Karma: 292
  • For I realized that God's a young man, too.
    • View Profile
Re: Random encounters on the world map
« Reply #5 on: 2012-02-29 21:20:33 »
Not sure if this is related but the data for random encounters seems to be in Enc_w.bin in world_**.lgp?

That right?

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #6 on: 2012-03-02 19:37:44 »
It seems so DLPB, well at least it contains data of encounter values and encounter formations[1].


I found the danger counter (ps1 German pal: 80116249, partially 80116248 and thus enables instant battles) and the place (80116240) which determines the next battle check. It cycles from 00 to 10. After a battle it is set to 74 (followed by FF FF FF) and so it takes 150 »steps« (different from the animation) for the first battle check.
The RNG value changes with each battle check or pushing/rotating left or right. Pushing/rotating once gives nearly the same RNG value as when reaching the second battle check with using only the up and down buttons.

BUT it doesn’t help. According to Terence the RNG look-up table (541 byte) is not static and uses a complicated refreshing routine[2].
I tried finding the table with RNG value for the battle check, but without luck. Even without knowing that table, but knowing it is recalculating, could I assume the RNG as fair?


[1]http://forums.qhimm.com/index.php?topic=3244.msg45536#msg45536
[2]http://www.gamefaqs.com/boards/197341-final-fantasy-vii/51949275?page=7

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #7 on: 2012-03-08 19:33:37 »
I found the world map table. I know now how the game picks a encounter formation (useful for getting the Mystery Ninja or the right Chocobo at the first try without hacking, but just looking in the memory) and thus why pre-emptive materia can give different battles – e. g. normal battle #1 instead of normal battle #4.

Something which could be more interesting: At least on the world map pre-emptive chances are doubled if a pre-emptive materia is equipped. This means the maximum chance is not 85/256, but 170/256.

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #8 on: 2012-03-11 18:23:50 »
This thread feels like blog. :D
The seed for the world map rng look-up table is incremented by 2 every 60 or 64 frames in a certain area. So just standing still gives different encounter outcomes. The exact area is probably determined by x and y values, but the following map should be good enough.




Pre-emptive chances on the field map are not doubled if they are bigger than 16/256.

Science Is Bigoted

  • Right Wing Safety Squads
  • Insane poster
  • *
  • Posts: 476
  • Karma: 7
  • I ♥ SCIENCE
    • View Profile
.
« Reply #9 on: 2012-03-11 20:20:46 »
.
« Last Edit: 2015-11-16 10:08:59 by Jenova's Witness »

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #10 on: 2012-03-11 21:31:03 »
http://forums.qhimm.com/index.php?topic=10717.0

Some time ago I was thinking about making a topographic or vegetation map out of it. So if you going to make a huge map, I’m interested.

http://forums.qhimm.com/index.php?topic=10929.msg153969#msg153969

Erzfreund

  • Fast newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
Re: Random encounters on the world map
« Reply #11 on: 2012-03-20 19:40:37 »
I guess I was really the only, who was interested in it.
To conclude it:

A look-up table (8010AE20 German pal ps1) is created every time the party enters the world map. It is possible to have identical numbers next to each other. At least for reloading, the numbers inside the table are depended on the in-game time. The Seed (8010AE1C/8010AE1D) starts with the last value in the table, which happens to be 08 02 (position 520). The 02 counts how many times the first value has overflown. When the Seed advantages further it jumps to 00 00 and a new look-up table is created.
The Seed advantages via three methods. The first method is using the left/right and the view rotating buttons. While  both types of buttons increase the Seed by one – doesn’t matter, which vehicle is used – the left/right buttons also increase the Stepscounter by one if there is place to walk by foot/Buggy. The second way is to get a battle check. The third way is to be in the following area. Every ca. 64 frames the Seed increases by two:

To reset the Seed a reload or a random world map encounter is necessary. 

The Stepcounter (80116240) starts with 74 and it wont increase the danger counter (80116249) till it overflows for the first time (74 FF --> 00 00). It advances by using the movement buttons. After the first overflow it starts cycling from 00 to 10 and after the next overflows a battle check occurs. Every time the party enters the world map the Stepcounter is reset to 74. Entering means after a battle, coming from a field map or reloading. Another way is to get off a vehicle, which resets the counter to E2, hence it is possible to never have an encounter with the buggy.

For the enemy encounter formation I will only state the additional stuff to Terence’s Enemy Mechanic FAQ. At first the Yuffie (in forests) or the Chocobo (everywhere else) battle is checked. After that the pre-emptive check follows. If it is successful, than the next RNG Seed checks for a normal battle instead of a back attack battle.
If a pre-emptive materia is equipped, the chances are doubled (128/256 instead of 64/256). This translates into almost halving the chances for getting a special battle from no pre-emptive materia to master pre-emptive materia. The ambush alert halves the chances even further.
In North Corel the chances doesn’t add up to 64 but 56. The remaining 8 leads to nothing. There will be no battle and the danger counter is reset to zero.

DLPB

  • No life
  • *
  • Posts: 9196
  • Karma: 292
  • For I realized that God's a young man, too.
    • View Profile
Re: Random encounters on the world map
« Reply #12 on: 2012-03-20 19:48:58 »
http://forums.qhimm.com/index.php?topic=10717.0

Some time ago I was thinking about making a topographic or vegetation map out of it. So if you going to make a huge map, I’m interested.

http://forums.qhimm.com/index.php?topic=10929.msg153969#msg153969

Someone needs to make a release of that map for game?  Has it been done and works properly?

Science Is Bigoted

  • Right Wing Safety Squads
  • Insane poster
  • *
  • Posts: 476
  • Karma: 7
  • I ♥ SCIENCE
    • View Profile
.
« Reply #13 on: 2012-03-20 21:34:32 »
.
« Last Edit: 2015-11-16 10:08:22 by Jenova's Witness »

DLPB

  • No life
  • *
  • Posts: 9196
  • Karma: 292
  • For I realized that God's a young man, too.
    • View Profile
Re: Random encounters on the world map
« Reply #14 on: 2012-03-20 21:45:53 »
Felix is still working on it.

Science Is Bigoted

  • Right Wing Safety Squads
  • Insane poster
  • *
  • Posts: 476
  • Karma: 7
  • I ♥ SCIENCE
    • View Profile
.
« Reply #15 on: 2012-03-20 22:29:41 »
.
« Last Edit: 2015-11-16 10:08:09 by Jenova's Witness »

UGerstl

  • Insane poster
  • *
  • Posts: 380
  • Karma: 5
  • Analyst and Backup-Manager
    • View Profile
Re: Random encounters on the world map
« Reply #16 on: 2012-03-20 22:56:32 »
@Jenova's Witness: This should be the requested link:  Felix Leonhart's Enhancements