Post subject: TearRing Saga
Editor, Skilled player (1337)
Joined: 1/31/2010
Posts: 330
Location: France
TearRing Saga is a RPG which basically is a Fire Emblem game (it was designed by the creator of the Fire Emblem series after he left Intelligent Systems). It was only released in Japan. I wanted to TAS this game for a long time, but for some reasons the game isn't emulated well with both PSXjin and PCSX-rr (it is playable, however from time to time there are weird lag frames which prevent you to do any inputs for several seconds). But I tested the game with Octoshock (PSXHawk) and it looks like the bugs are gone, so I think it's time to create a topic for this game (let's just hope I am not the only one here to know this game). RNG mechanics It's a RPG, so yeah there are some rng involved. I understand some parts of it so I will try to explain. The memory address 0x000CC270 is a pointer which increase by 1 each time 1 random number is used. Its possible values go from 1 to 624 (it resets to 1 when it reachs 625). The 2496 bytes from address 0x000E9848 to 0x000EA206 (so that's 624 groups of 4 bytes) are used to determine the 624 next random numbers (for example, if the pointer is equal to 54, the 54th group will be used). They are changed each time the pointer come back to 1, and I don't know how the game calculate the new values, however it seems that for 624 given groups, the 624 next groups will always be the same, no matter what you do. Only the initial 624 groups can be manipulated, when you press "new game" in the main menu. Then some "strange" (from my point of view) calculations are done on the 4 bytes group to choose the random number from this 8x16 "random number board" :
{01;08;10;12;13;14;15;16}
{17;18;19;20;21;21;22;23}
{24;24;25;25;26;27;28;29}
{30;30;31;32;33;34;35;35}
{36;37;38;39;40;40;41;42}
{43;44;45;45;46;47;48;49}
{50;50;51;52;53;54;55;55}
{56;57;58;59;60;60;61;62}
{63;64;65;65;66;67;68;69}
{70;70;71;72;73;74;75;75}
{76;77;77;78;79;80;80;81}
{82;83;84;85;86;87;88;89}
{91;93;95;98;NA;NA;NA;NA}
{NA;NA;NA;NA;NA;NA;NA;NA}
{NA;NA;NA;NA;NA;NA;NA;NA}
{NA;NA;NA;NA;NA;NA;NA;NA}
So yeah, this board is the summary of all the (100) random numbers you can get in the game. NA means that the game will calculate the next random number (so the pointer increase by 1), and so on until it finds a valid number. As you can see, it is impossible to miss an attack with a displayed hit of 98% or more. On the other hand, there is no difference between a displayed hit (or crit) of 1% or 7% (in the two cases, you only have 1% chance of success). That's all for this post (here is the lua script I use to display the next random numbers if someone want it, however I didn't put any useful description in it) but there are obviously other things to talk about (like the route planning for example...)
Hoandjzj
He/Him
Experienced player (613)
Joined: 4/6/2010
Posts: 240
This game is awesome :D :D :D It's great that you want to TAS this, lapogne36! I wanted to TAS this as well, but there was weird lag frames stopped me from doing that :( some keeps lagging forever! Maybe the game's rom doesn't suit with PSXjin and PCSX-rr...
Editor, Skilled player (1337)
Joined: 1/31/2010
Posts: 330
Location: France
Yeah the lag frames were specific to PCSX-rr/PSXjin, however the game could still be played to the end (the biggest lag I got was like 2 minutes long...), that's why I created this topic when I confirmed that the game is working well on PSXhawk. Right now I can predict any upcoming RN as long as I have the 624 first RNs. Currently I am on the process of finding a good seed (e.g. the 624 first RNs, which are determined by the frame when you press "new game") to get the following : -A good Map 5 RNs (as it is mainly an ennemy phase map, so I am limited on manipulating the outcome) -a RN string that allows me to get two 8% display crits on the same round of fight on map 6, on enemy phase. The true odds are only 2% chance of crit, so it's a 1 of 2500 chance, and "on enemy phase" means that this RN string has high chance of not coming with the right timing (like 1 RN too soon or too late for example) -"Decent RNs" on the previous maps (not burning too much RNs) Obviously I am focusing on finding a seed that match the second point (I know when the RN string must appear with a more or less 500 RN margin), and then check if it works with the other two points
Hoandjzj
He/Him
Experienced player (613)
Joined: 4/6/2010
Posts: 240
Now they support Bizhawk for PSX you should try it for this game :D:D:D I hope there won't be any lag :D:D:D
Post subject: Re: TearRing Saga
Joined: 9/6/2009
Posts: 24
Location: Renton, WA
lapogne36 wrote:
The 2496 bytes from address 0x000E9848 to 0x000EA206 (so that's 624 groups of 4 bytes) are used to determine the 624 next random numbers (for example, if the pointer is equal to 54, the 54th group will be used). They are changed each time the pointer come back to 1, and I don't know how the game calculate the new values, however it seems that for 624 given groups, the 624 next groups will always be the same, no matter what you do. Only the initial 624 groups can be manipulated, when you press "new game" in the main menu.
I don't know if you're still looking at this game, but just in case... Given the state space of 624 4-byte words, I strongly suspect that the game uses the very popular Mersenne Twister PRNG (https://en.wikipedia.org/wiki/Mersenne_Twister).
Editor, Skilled player (1337)
Joined: 1/31/2010
Posts: 330
Location: France
Yeah I assume it must be that, although I am not sure it would have helped me. For this game the double-word (dw) formula is dw#(x+624)=f(dw#(x+1),dw#(x+397)), with f a function that I do not understand but that I "recreated" by trial and error
Editor, Skilled player (1337)
Joined: 1/31/2010
Posts: 330
Location: France
Link to video I worked on it again recently, and I managed to get a good seed for Map 6. The seed was also pretty good for Map 5 (look at this mage at the top dodging 3 hits like a pro), but meh for Map 2 (hard to find good level ups for Raffin. I am not sure if the "lag" before my characters move is due to me being too fastor some small emulator issues By the way, there may be some little changes in the final version, involving Runan not buying the shield in the shop after Map 7
Editor, Skilled player (1337)
Joined: 1/31/2010
Posts: 330
Location: France
Link to video Finally done with the first split (maps 9 to 23). More than half of the remaining maps will be trivialize, so it shouldn't be too long before this TAS is over.