Player (199)
Joined: 12/3/2006
Posts: 151
AI:
public void AI(int def){

    while(rng.callRN()>42){}
    if(rng.callRN()>192){           		// megaquake (65 ATP) check  (25%)
        int damage = (rng.callRN()/8*65/256+65-maxim[4]/def)/2;
        rng.wasteRN(20);
        maxim[0] = maxim[0] - damage;
    }else if(rng.callRN()>224){     		// flash (81 ATP) check      ( 9%)
        int damage = (rng.callRN()/8*81/256+81-maxim[6]/2)/2;
        rng.wasteRN(20);
        rng.wasteRN(7);             		// Flash' animation
        maxim[0] = maxim[0] - damage;
    }else{                          		// attack (45 ATP)          (66%)
        int damage = (rng.callRN()/4*45/256+45-maxim[4]/def)/2;
        rng.wasteRN(20);
        maxim[0] = maxim[0] - damage;
    }
}
Joined: 10/3/2005
Posts: 1332
Wow. That answers that. I didn't realize you had actually re-engineered part of the game. Thanks a lot, Gunty. :)
Active player (287)
Joined: 3/4/2006
Posts: 341
A few corrections: 1) Maxim's normal attack at this point has a 5% chance (third RNG call < 13) of being a critical hit. Critical hits ignore defense. 2) Dive is actually double ATP, not double damage. 3)
        if(rng.callRN()<64>63 && a<128){          	// secundary item drop check\
I hope this was just a problem in copy/pasting, because this line won't compile. 4) Defending makes the attack deal 5/8 damage rounded up after everything else is factored in. It does not double DFP. 5) If the catfish used Flash the previous round, it will not do the RNG check for Flash this round.
002B: target random opponent
002D: with probability 193/256, go to 0x0040
0031: element 0x0004 physical attack with 65 power
0037: attack name "Mega quake"
0039: attack animation 80
003B: variable 1 := 0x0000
003F: stop
0040: if variable 1 != 0x0000, go to 0x0051
0046: with probability 225/256, go to 0x0051
004A: cast spell "Flash"
004C: variable 1 := 0x0001
0050: stop
0051: elements 0x0004
0054: attack
0055: variable 1 := 0x0000
0059: stop
Other than those, everything looks accurate apart from a few places where the game rounds intermediate values.
Player (199)
Joined: 12/3/2006
Posts: 151
Sorry, I was in a bit of a hurry when I made that post, so that uncompilable line is indeed a copy/paste error, I'll fix it. As for the code, this was more of a test thing, so I purposely ignored the critical and defend mechanism since they would probably not be used in battle anyways. Same goes for the Flash thingy, since in an optimal battle the Catfish would not cast Flash at all. Thanks for the correction on Dive though. I really thought I had double checked that :p. I'm probably going to (try to) make a more generic simulator in the future without all those assumptions. That way I can use it on different bosses with a little tweaking on the AI part. Oh, and the rounding parts you speak of, Java does it automatically after each division, since I'm working with integers.
Skilled player (1652)
Joined: 11/15/2004
Posts: 2202
Location: Killjoy
I believe this will be the ONLY way to TAS Shining Force II. Let me explain. Shining Force II's RNG can ONLY be manipulated based on how long a menu is open. It advances once per frame. In the first fight, we are given 3 characters. If we allow each to only have the menu open for a maximum of 5 seconds (absurd! I know) that is 5*60*3, or 900 options. Additionally, since I have already decompiled the code, only about 10%, or 90 of them result in different actions. Thus, if we test only the relevant and different ones, the dimensionality is far reduced. There is an additional step however, which is character location on the map. Many people have noted that Genetic Algorithms work best for this sort of decision. This will greatly increase the dimensionality of the problem, but since the dimensionality for other decisions is already extremely low, this shouldn't be a large problem. Thus: Step one is to TAS the Battle. This gives us a starting point for character movement. Additionally, we can cut any Battle that is more than 10 seconds longer, before that battle even finishes. (Battles under 10 seconds may have more desireable results, either in leveling or entertainment) Step two is to give the Bot all of the info from the first battle, and let it start making genetic decisions based on that battle. Step three is to examine the results for entertainment and best levels. Granted, writing this Bot is a task well beyond my abilities. However, given the trade-off of frames for RNG manipulation, I really think a bot would beat a human TASer, with very low dimensionality.
Sage advice from a friend of Jim: So put your tinfoil hat back in the closet, open your eyes to the truth, and realize that the government is in fact causing austismal cancer with it's 9/11 fluoride vaccinations of your water supply.
Yrr
Joined: 8/10/2006
Posts: 289
Location: Germany, Bayern
Titus Kwok wrote:
well, for every frame, there's 2^8 input possibilities, or 256. If you take a video that's 10 minutes long, that's 60fps * 600 sec = 36000 frames, giving you a total number of 9,216,000 different movie possibilities. If you can cull the amount of control input, say, no up+down; or if you give it instructions to watch for certain RAM values- no death, don't pick up a certain item; you could reduce that number to something more manageable.
You're wrong: the number of possibilities is about 10^86696 (BigAl ftw!)
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Yrr wrote:
Titus Kwok wrote:
well, for every frame, there's 2^8 input possibilities, or 256. If you take a video that's 10 minutes long, that's 60fps * 600 sec = 36000 frames, giving you a total number of 9,216,000 different movie possibilities.
You're wrong: the number of possibilities is about 10^86696 (BigAl ftw!)
Indeed, Titus Kwok's calculation (256 * 36000) would hold true in the case that you have 36000 possible choices for a single frame where you will hit any of the 256 button combinations, and the rest of the movie is completely blank. But when each frame has 256 choices, the total number of possibilities comes to 256^36000, i.e. approximately 10^86696. In other news, you responded to almost a year old post, which was already responded to by Rusty.
Skilled player (1652)
Joined: 11/15/2004
Posts: 2202
Location: Killjoy
Bisqwit wrote:
Yrr wrote:
Titus Kwok wrote:
well, for every frame, there's 2^8 input possibilities, or 256. If you take a video that's 10 minutes long, that's 60fps * 600 sec = 36000 frames, giving you a total number of 9,216,000 different movie possibilities.
You're wrong: the number of possibilities is about 10^86696 (BigAl ftw!)
Indeed, Titus Kwok's calculation (256 * 36000) would hold true in the case that you have 36000 possible choices for a single frame where you will hit any of the 256 button combinations, and the rest of the movie is completely blank. But when each frame has 256 choices, the total number of possibilities comes to 256^36000, i.e. approximately 10^86696. In other news, you responded to almost a year old post, which was already responded to by Rusty.
Actually, I was the first bumper, so it is my fault. Additionally, neither post was on topic. In the case of chess, if you have a pawn, you can hit Down Left Right, and it won't matter. Only up will. And it will only matter during your turn, not every frame of the game. That was the point of this quickly derailed thread. Strategy games have limited moves, unlike an action game.
Sage advice from a friend of Jim: So put your tinfoil hat back in the closet, open your eyes to the truth, and realize that the government is in fact causing austismal cancer with it's 9/11 fluoride vaccinations of your water supply.
upthorn
He/Him
Emulator Coder, Active player (391)
Joined: 3/24/2006
Posts: 1802
I don't think bisqwit was referring to the bump, so much as the fact that the post he was quoting was nearly a year old, and the information given in response to the quoted post was redundant.
How fleeting are all human passions compared with the massive continuity of ducks.