Just posting for posterity or something.
USA RAM address: 0x214BFA8
1 step formula (written in C): x_new = ((((4*x_old+2) * (4*x_old+3)) & 0x7fffffff) * 8 / 7) & 0x7fffffff;
AI’s day doesn’t have a frame-based advance like in AWDS, and when loading a save it advances the RNG with 2 “map loading” advances (12 + 12 steps).
Edit: Writing a bit of the RNG sequence:
0 → 6 → 802 → 11779782 → 286633908 → 453818978 → 2054565282 → 783827216 → 593729616
RNG Discussion
- ALAKTORN
- Joined: Tue Jan 29, 2008 1:34 pm
- Location: Italy
RNG Discussion
Last edited by ALAKTORN on Thu Apr 06, 2017 1:03 pm, edited 1 time in total.
-
- Joined: Tue Jan 22, 2008 12:07 am
- Rank: Lord of Children Games
Re: RNG Discussion
So what's the seed?
- ALAKTORN
- Joined: Tue Jan 29, 2008 1:34 pm
- Location: Italy
Re: RNG Discussion
What do you mean? Starting seed is 474809046 but I don’t know what you want to do with that.
Edit: Oh wow the seed seems to be determined by some kinda timing. Got 539828321 just now. If I pause the emulator on the start screen, wait some time, then soft reset, it’s seeded to a number a few dozens bigger. If I soft reset as fast as possible it’s seeded with a +1.
Edit: Oh wow the seed seems to be determined by some kinda timing. Got 539828321 just now. If I pause the emulator on the start screen, wait some time, then soft reset, it’s seeded to a number a few dozens bigger. If I soft reset as fast as possible it’s seeded with a +1.
Last edited by ALAKTORN on Sat Apr 08, 2017 7:49 am, edited 1 time in total.
- ALAKTORN
- Joined: Tue Jan 29, 2008 1:34 pm
- Location: Italy
Re: RNG Discussion
The Luck formula does appear to be simply a modulo 11 at the end of it. So it’s a d11 instead of a d10 like the older games, and that’s why you can get 10% Luck damage.
Edit: What the fudge, it seems to be determined a different way on AI’s turn… freezing the RNG for +10% attacker and +0% defender on my turn gives a different result on AI’s turn… /// This is weird. I’m testing Hourglass. Inf attack on Wood Tank with RN 29 estimates 11% with 51% counter, which is 10/0 Luck. But when the Inf actually attacks, the attack ends as 11% and 58% counter.
Looking further into this, the attacks work as normal. Attacker’s Luck first, defender’s Luck second. Those are fine. It’s the AI estimation that’s for some reason doing something else entirely.
AAAAAAAA I’ve completely forgotten how estimations work, freezing the RNG gives different estimation from actual result in AWDS too so I don’t know what’s going on. ._. /// OK I think it’s just shifted 1 ahead. Because when the AI estimates a battle, it doesn’t just do the 2 Luck advances, but first it does some more basic unit-selecting-related advance. So if RN 0 gives +6/+10 (0 → 6 → 802 (modulo 11 = 10)), for the estimation it will take the +10 for the attacker and will get +3 (802 → 11779782 (mod 11 = 3)) for the defender. Welp, mystery solved… thank god.
So frozen RN 194 makes it attack and the attack ends 7% with 65% counter which is 5/10 Luck.
RN 12 gives +10/+0 Luck. RN 65 gives +0/+10.
http://i.imgur.com/NvUtAuL.png
WOW fudge this game.
Bike decides not to attack 5HP Vet Tank despite dealing 15% and taking 25% counter, that’s 1050F vs. 625F counter, it should work.
Maybe the stupid Bikes have a 2× multiplier…
Edit: Just went through Tatter River’s D2D to put it on the website and noticed on second to last day Lin builds an Infantry 1S of HQ but doesn’t attack your capping Inf, it loads into a TC instead. Wtf.
Edit: What the fudge, it seems to be determined a different way on AI’s turn… freezing the RNG for +10% attacker and +0% defender on my turn gives a different result on AI’s turn… /// This is weird. I’m testing Hourglass. Inf attack on Wood Tank with RN 29 estimates 11% with 51% counter, which is 10/0 Luck. But when the Inf actually attacks, the attack ends as 11% and 58% counter.
Looking further into this, the attacks work as normal. Attacker’s Luck first, defender’s Luck second. Those are fine. It’s the AI estimation that’s for some reason doing something else entirely.
AAAAAAAA I’ve completely forgotten how estimations work, freezing the RNG gives different estimation from actual result in AWDS too so I don’t know what’s going on. ._. /// OK I think it’s just shifted 1 ahead. Because when the AI estimates a battle, it doesn’t just do the 2 Luck advances, but first it does some more basic unit-selecting-related advance. So if RN 0 gives +6/+10 (0 → 6 → 802 (modulo 11 = 10)), for the estimation it will take the +10 for the attacker and will get +3 (802 → 11779782 (mod 11 = 3)) for the defender. Welp, mystery solved… thank god.
So frozen RN 194 makes it attack and the attack ends 7% with 65% counter which is 5/10 Luck.
RN 12 gives +10/+0 Luck. RN 65 gives +0/+10.
http://i.imgur.com/NvUtAuL.png
WOW fudge this game.


Edit: Just went through Tatter River’s D2D to put it on the website and noticed on second to last day Lin builds an Infantry 1S of HQ but doesn’t attack your capping Inf, it loads into a TC instead. Wtf.
- ALAKTORN
- Joined: Tue Jan 29, 2008 1:34 pm
- Location: Italy
Re: RNG Discussion
What in the fudge. O_o I think you can RNG manipulate with cursor position. Maybe it has to do with the AI having to scroll the map, which changes the RNG. Edit: Nvm I have no fudge idea how it works. You can reload a save and get 2 different outcomes on C5 New Allies… /// Frozen RNG gives different positions for attacks on Fragment Isle, lol. Wtf is going on.
Also, you can draw a path with AI units too, even though the arrow doesn’t appear, it’ll still calculate the path and advance the RNG.
Edit: This RNG is so bad that it can get stuck looping the same ≈ 140 values… wow.
Edit2: I think this game might have different AI behavior based on CO… on Fragment Isles, I’ve never seen Brenner’s 5HP Plain Inf attack your Factory Inf, but Lin’s even 4HP Plain Inf can attack your COZ (Penny) Factory Inf.
Also, you can draw a path with AI units too, even though the arrow doesn’t appear, it’ll still calculate the path and advance the RNG.
Edit: This RNG is so bad that it can get stuck looping the same ≈ 140 values… wow.
Edit2: I think this game might have different AI behavior based on CO… on Fragment Isles, I’ve never seen Brenner’s 5HP Plain Inf attack your Factory Inf, but Lin’s even 4HP Plain Inf can attack your COZ (Penny) Factory Inf.
- DxDyDzD
- Joined: Sun Nov 22, 2009 2:47 pm
- Rank: Blue Bomber
- Location: War Room
Re: RNG Discussion
Got caught in a death spiral while attempting Hourglass 5/450. Returned to the same RN after 380 advances.
I was using an Inf to advance RNs by wobbling the cursor between 2S1E and 1S2E every frame. This advances the RN by 1 or 2. It took 250 frames to return to the starting RN.
Full sequence below. Wall of text warning
I was using an Inf to advance RNs by wobbling the cursor between 2S1E and 1S2E every frame. This advances the RN by 1 or 2. It took 250 frames to return to the starting RN.
Full sequence below. Wall of text warning
Hidden Text
- ALAKTORN
- Joined: Tue Jan 29, 2008 1:34 pm
- Location: Italy
Re: RNG Discussion
Yes, I’ve mentioned that before. And whether you get stuck in a small loop or not all depends on the starting seed, so you have to reset the game to get out of it.
- ALAKTORN
- Joined: Tue Jan 29, 2008 1:34 pm
- Location: Italy
Re: RNG Discussion
I figured out how Penny’s COP works so might as well post it.
call RNG once, value modulo 3
0 = Rain
1 = Snow
2 = Sandstorm
call RNG once, value modulo 3
0 = Rain
1 = Snow
2 = Sandstorm
- Xenesis
- Tri-Star CO
- Joined: Thu Aug 25, 2005 1:54 am
- Rank: Wars World Instructor
- Location: 0x020232DD
- Contact:
Re: RNG Discussion
Alright, so the RNG subroutine looks like a fairly simple piece of kit.
Code is here (From US AW4):
Now I know most of you don't speak ARM, so I'm pretty sure the maths is as follows if I've interpreted it correctly, although I'm sure someone could write it better than I did:
x is the previous RNG value, z is the final RNG value.
The value of y is bit cleared for 0x80000000, which is essentially a ceiling y of 2147483647 The value of z is bit cleared for 0x80000000, which is essentially a ceiling z of 2147483647
z here is your final RNG value.
Edit: ALAK reckons there's something wrong with the formula, need to give it a better look.
Code is here (From US AW4):
Code: Select all
.org 0x0207C2F0
Main_RNG:
stmfd r13!,{r4,r14}
ldr r0,=0x0214BFA8 ;RNG RAM
mov r1,0x7
ldr r0,[r0]
mov r0,r0,lsl 0x2
add r2,r0,0x2
add r0,r2,0x1
mul r4,r2,r0
bic r0,r4,0x80000000 ;Clear Bit 31 (set Division Controller to 32-bit mode)
bl Function_Divide;0x0207C8EC
add r0,r4,r0
ldr r1,=0x0214BFA8
bic r0,r0,0x800000000 ;Clear Bit 31
str r0,[r1]
ldmfd r13!,{r4,r15}
.pool
.org 0x0207C8EC
Function_Divide:
ldr r2,=0x4000280 ;Division Controller
mov r0,0x0
strh r3,[r2]
str r0,[r2,0x10]
str r1,[r2,0x18]
mov r0,r3
str r0,[r2,0x1C]
@@Loop_Start:
ldrh r0,[r2] ;Check controller wait state (bit set = controller busy)
tst r0,0x8000
bne @@Loop_Start
ldr r0,=0x040002A0 ;Load division result
ldr r0,[r0]
bx r14
.pool
x is the previous RNG value, z is the final RNG value.
The value of y is bit cleared for 0x80000000, which is essentially a ceiling y of 2147483647 The value of z is bit cleared for 0x80000000, which is essentially a ceiling z of 2147483647
z here is your final RNG value.
Edit: ALAK reckons there's something wrong with the formula, need to give it a better look.
You do not have the required permissions to view the files attached to this post.
Nell wrote:Luck IS a skill!