Author Topic: PC Random Battles  (Read 3920 times)

obesebear

  • *
  • Posts: 1389
    • View Profile
PC Random Battles
« on: 2011-01-14 05:28:39 »
So I've spent the past few hours on speeddemosarchive checking out some speed runs, when I decided to see if there was anything for FF7.  Lo and behold someone has posted a speed run of 7:41.  Pretty impressive.   

I started browsing through the comments when I notice that in segment 63 he states that there are actually no random battles in the PC version... Has anyone else heard of this or able to verify/debunk it?

Covarr

  • Covarr-Let
  • Administrator
  • *
  • Posts: 3940
  • Just Covarr. No "n".
    • View Profile
Re: PC Random Battles
« Reply #1 on: 2011-01-14 06:27:40 »
He says no such thing in segment 63. He does say that in 81 though. Here's what he had to say about segment 34 though:
Quote
However, in the PC Version, the random encounters aren't random. I always got the same battle on the bridge...
And here's the link to that page, for those who don't feel like finding it themselves.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: PC Random Battles
« Reply #2 on: 2011-01-14 19:36:57 »
I think he means, the random generator just iterates over a fixed table. Which it does. Load a section, play it, reload and play again, and you'll spot how you encounter enemies in the same places.

pyrozen

  • *
  • Posts: 791
  • Team Avalanche Member
    • View Profile
Re: PC Random Battles
« Reply #3 on: 2011-01-14 20:18:20 »
a lot of times, they appear in the same order as well. The shinra mansion is one place to easily spot this, as well as the ancient temple.

obesebear

  • *
  • Posts: 1389
    • View Profile
Re: PC Random Battles
« Reply #4 on: 2011-01-18 00:33:04 »
So, because of me severe lacking of technical skills, I have no way of knowing how to make the battles random like the PSX, much less where to begin.  Anyone have any ideas?  Flevel? .exe?

nfitc1

  • *
  • Posts: 3010
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: PC Random Battles
« Reply #5 on: 2011-01-18 02:17:51 »
I can *somewhat* confirm this, but everytime I try to explain mechanics either Akari or TFergusson will show up and say "you're wrong, stupid" (which is fine as long as they have the correct info ;) ). So if nothing else here's my understanding:

There are multiple RNGs on the PC version that are all following the same RNG table found in the KERNEL.BIN file. The one that governs battles is separate from the others and ONLY (or near-exclusively) governs when a battle occurs and which formation out of the potential battles it will be. This is only incremented when a battle takes place so the game knows when to start the next one. It's based on number of steps taken in a battle-able area, though it doesn't seem that cut-scene induced movement matters. Based on that, it's possible to predict when and what battles will occur given different times. The savegame doesn't save RNG position so it will always start back at the beginning. In the normal course of the game a player might not even notice because they're switching back and forth between battle zones a lot, but the number of steps to take to get to the first battle are almost always the same.

Bosola

  • Fire hazard!
  • *
  • Posts: 1749
    • View Profile
    • My YouTube Channel
Re: PC Random Battles
« Reply #6 on: 2011-01-18 02:58:48 »
So, because of me severe lacking of technical skills, I have no way of knowing how to make the battles random like the PSX, much less where to begin.  Anyone have any ideas?  Flevel? .exe?

I've never done anything like it myself. But I would try and find the increment counter that 'steps over' the RND table with a disassembler. When I'd found the assembler, I'd try and do a simple search with a hex editor to find the location of that asm in the .exe (which I assume would be in its 'raw' format). I would then replace the 'add one' instruction with 'add a one byte random number' (probably using a modulo function).

I'd want to double check how that increment counter 'rolls over', though.

At least, that's how I think you'd do it... :-\

Aali

  • *
  • Posts: 1196
    • View Profile
Re: PC Random Battles
« Reply #7 on: 2011-01-18 11:46:58 »
As far as I know (read; 99.9999% sure) its also different between world map and field. As in, the two are not sharing a common "random battle" function, but do their own calculations (which may or may not be identical) in two different places.

:EDIT:

Also, does anyone know *exactly* how it works on the PSX?