King's Bounty is a turn-based strategy game. The objective is to recover the Sceptre of Order. Map pieces that reveal the location of the sceptre are gained by defeating villains and finding special artifacts. A normal play session would involve exploring four large continents and battling hundreds of creatures, but in this movie nobody gets killed and everyone is happy. After the game begins (at frame 585) it takes 25 frames to complete it.
  • Plays at hardest level
  • Aims for fastest time
  • Manipulates luck
  • Ignores semi-important goals in the game
If someone wants to improve it, watch these RAM addresses:
  • 00FFE8A8 (sceptre x-coordinate)
  • 00FFE8AA (sceptre y-coordinate)
{11,5} would be the perfect coordinates, but a) I'm not sure if the sceptre can be under the starting location and b) it may take more time to manipulate that than it takes to walk to the location I got, {11,4}.

adelikat: Accepting this run. The response is good and the run shows amazing luck manipulation. This should be the easiest job an encoder will ever get :p Hell, compressing the .png screenshot will probably take longer than the .avi. Come to think of it, there isn't much to choose from in the screen shot considering only 25 frames of gameplay :p

Bisqwit: Submission file replaced. According to the author, it is now 5 frames faster. It is indeed now only 610 frames long.


1 2
5 6 7 8
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
it has to do with the fact that nes is encoded into mono, and 16bit games are encoded to stereo.
It's hard to look this good. My TAS projects
Joined: 6/4/2005
Posts: 130
Location: Ontario, Canada
Player (31)
Joined: 9/23/2006
Posts: 207
Location: Moreno Valley, California
transaspie wrote:
Maza: Nice touch with the "this WAS a tool-assisted recording". :)
I LOL'd.
"The way to move out of judgment is to move into gratitude." — Neale Donald Walsch DannyLilithborne on IRC
Joined: 5/27/2005
Posts: 465
Location: Turku, Finland
Yes, there was a slight error in the encoding. The audio was encoded with mono but it is labeled as stereo, so some players and codecs may not realize this. In my experience BSplayer plus mp3lib decoding works just fine. I have now figured out the cause of this problem and fixed it. So I promise my future encodes won't have this problem any more.
Which run should I encode next? :)
Senior Moderator
Joined: 8/4/2005
Posts: 5777
Location: Away
What was the cause, though?
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Joined: 5/30/2007
Posts: 324
I hate to resurrect the dead, but "King's Bounty" for the PC was the first videogame I seriously played, and to this day, one of my favorite titles of all time.
moozooh wrote:
I believe that with heavy luck manipulation it can be done in under 1.5 hours.
It's far shorter than that. I beat it in about 45 minutes straight up. With severe luck manipulation (get a wandering monster to join you with flying, get maps very early on in the levels), it can likely be completed in ten minutes or less. It also requires relatively little planning, other than a route for picking up the chests in the most efficient manner, for the purpose of buying up an army of dragons. Hell, once finals are over, and if I'm inclined enough to read through the posts on TAS'ing, I might even give it a try myself.
Senior Moderator
Joined: 8/4/2005
Posts: 5777
Location: Away
Wow, if that's true, that'd be one hell of a TAS. Go for it!
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Joined: 5/30/2007
Posts: 324
moozooh wrote:
Wow, if that's true, that'd be one hell of a TAS. Go for it!
A lot of it would simply be the same type of luck manipulation the author of the ten second TAS used, except applied dozens of times to the contents of chests, spells in town, and at least one monster group. The most difficult part would unquestionably be optimizing the battles themselves, and related to that, deciding how to partition chests between leadership and gold (and how many to take) for maximum efficiency in combat. Similarly, one needs to decide if any spells aside from Castle or Town Gate are worth getting, and if so, which ones, how many, and at what interval in the promotions granted to one by the King. I'm also not sure how entertaining it would be for anyone who hasn't played the game, which, judging by the posts in the topic, is nearly everyone. On an unrelated note, it's neat to see how international this community is; your location happens to be my birthplace and hometown.
Senior Moderator
Joined: 8/4/2005
Posts: 5777
Location: Away
Hahaha, the world is quite small. Distributing gold/experience was one of my main concerns regarding the full run as well as the battles, although if you say it could be done in around 10 minutes overall, that's not that bad. There are Dragon Warrior TASes here, after all, and those are quite longer than 10 minutes.
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
I would be interested in seeing a full version. Estimate it to be around 20-30 minutes.
It's hard to look this good. My TAS projects
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Sounds interesting, IronSlayer. Good luck with it! So are you going for 100% items/treasures/kills? Or 100% kills only? In any case, you may want to draw the optimal route on the map, then decide what items you want in what locations, right? Then just manipulate as many of those items there as possible. RAM watch will be useful, but a bot would be the true blessing here.
IronSlayer wrote:
get maps very early on in the levels
What do you need the maps for?
adelikat
He/Him
Emulator Coder, Site Developer, Site Owner, Expert player (3573)
Joined: 11/3/2004
Posts: 4754
Location: Tennessee
I think he means the treasure that allows you to access a new continent
It's hard to look this good. My TAS projects
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Oh, sorry, heh, I forgot that.
Joined: 5/30/2007
Posts: 324
Aqfaq wrote:
Sounds interesting, IronSlayer. Good luck with it! So are you going for 100% items/treasures/kills? Or 100% kills only?
If I were to do it, it would be 100% contract villains killed and all artifacts found, completely clearing up the puzzle.
In any case, you may want to draw the optimal route on the map, then decide what items you want in what locations, right? Then just manipulate as many of those items there as possible. RAM watch will be useful, but a bot would be the true blessing here.
Yeah, essentially. It might also incorporate the locations of towns and castles to visit, so one can use Town or Castle gate to reach them after amassing an army on the fourth continent. There also has to be some consideration for the army one needs to buy from the main castle, since beating the main villain usually takes two tries. One would probably have to manipulate the names of the weeks also; no dragon, demon, or vampire weeks until one buys them out, and then, only such week(s) if one has enough money to buy the monsters.
IronSlayer wrote:
What do you need the maps for?
Yeah, adelikat is right; maps of the next continents. At any rate, it will be an interesting game for me to try, but I don't have any significant expectations about the result, since I've never done a TAS before, have an awful lot to read and learn about it, and the amount of luck manipulation and route optimization in this game seems almost exponential when considered together.
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
LagDotCom asked me to improve this movie, but I am unable to do that, so I'll try to give instructions for others instead. Here are some frame counts from the movie: It takes 9* frames to manipulate the sceptre to the adjacent location. It also takes 9 frames to walk to the adjacent location. So, I wasted 18 frames. Now, there are three possible methods to avoid wasting those 18 frames: Method 1 Manipulate the sceptre location to be the same as the starting location to avoid walking. To improve 1 frame, this manipulation has to succeed within 17 frames of luck-manipulation. The problem is that I have no way to verify that the sceptre can even be on the starting location. It has never happened yet. It is very laborsome to manually start the game with different luck-manipulation patterns and check the sceptre coordinates. A bot could easily test random stuff and check if the game ever begins with these sceptre coordinates:
00FFE8A8 = 11
00FFE8AA = 5
If this set of sceptre coordinates is never detected, then the 9 frames of walking to the adjacent location seem necessary. Method 2 If the first method fails, all we can do is to try manipulating the sceptre to the adjacent location with less than 9 frames of luck-manipulation. However, I tested every combination. I mean, I tested all 1-frame manipulation patterns, then 2-frame manipulation patterns... up to the succesfull 9-frame pattern (right-idle, left-idle, left-idle, idle, left-idle). (It was not too hard to test those combinations manually, because using Left or Right takes 2 frames.) Anyway, one of the things I'm unsure of is this: Does delaying the Start-button on the intro screen affect randomness? If it does, then these delay frames could be used for luck-manipulation too. Method 3 Show that Aqfaq has made a stupid mistake at some point. It is always possible that I have missed something relevant. One assumption I have made is that the luck-manipulation can be performed exclusively with the combinations of left, right and idle in the character selection screen. This assumption may be false, but I don't have the abilities to verify/falsify it. * Well, actually I use 13 frames to manipulate the sceptre, but 4 of the frames are used to change the skill level to hardest, so I don't consider the input of those frames luck-manipulation. It could be argued that any skill level suffices here, but I think choosing the hardest skill level makes the movie funnier for those who pay attention to details.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
Ok... first I will need the code for the emulator that is going to be used. I mean I see the official gens which I bet is not the one. Then we got upthorn's? but there's a version for every letter of the alphabet so I'm not sure which is "the one" used and where is its source code, and that's what I would need because that's what you need. I got this file "gens_movie_9jsrc.zip", if that's the one then cool. The way I have it working is that it uses an "optimal" movie file and tests changes to it until it finds a successful run. If you organize I can make it so you don't run the same combinations. If you explain what you do manually to do the checking of every combination then I can make a bot that does the same as you. But since you left open spots you aren't sure of, first answer them so what you say is correct. For example on my yellow run I had a base movie which was "optimal", and to manipulate I decided I had to test every combination of inserting blank frames before the inputs present on the movie. Anything before frame 3000 did not need to be tackled (3010 was first input), and I did not have to add frames after frame 5390 (5388 was last input). Then at frame 5440 it would check if the movie was successful or not. Define what is the first possible moment on which you can start manipulating, you left that open. Then define the last moment, then what you can do while manipulating, you left that open too. Then get an optimal movie of all inputs before you know the placement of the scepter.
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Sorry, can't help you with the emulator code. I hope someone can show you the correct source. Here is one more memory address: 00FFE8A6 - This tells what continent the sceptre is located at. "0" means it is on the first continent, so that is the desired value. If it is not 0, the movie has failed. ---- Ok, here is the whole input of the current movie described frame by frame: Frame number - INPUT - Result 63 - START - Fade logo. 232 - START - Fade another logo. 283 - START - Fade the title screen. Note: For those first three screens, I still need to verify if adding idle frames to them affects the randomness or not. I'll test it soon. Luck-manipulation begins now: 339 - START - Begin character selection. Timing of this affects the randomness! 340 idle These are the only "pure" luck-manipulation frames: 341 - RIGHT 342 idle 343 - LEFT 344 idle 345 - LEFT 346 idle 347 - IDLE 348 - LEFT 349 idle 350 - START - To pick the character. 351 idle - loading... 352 idle - loading... Choose the hardest difficulty while still affecting the coordinates: 353 - UP 354 idle 355 - UP 356 idle 357 - START - To begin the game. 380 - Sceptre coordinates show up in the corresponding RAM addresses. Note: The rest of the movie is not relevant for the bot. Gameplay begins: 586 - Walk 9 frames down. Then, perform search: 595 - A - Summon action menu. 596 idle 597 - UP - Switch action 598 idle 599 - UP - Switch action 600 idle 601 - UP - Switch action 602 idle 603 - UP - Switch action 604 idle 605 - A - Pick action: "Search" 606 - idle - loading... 607 - idle - loading... 608 - DOWN - Choose "Yes". 609 idle 610 - A - Perform search. Game ends. ---- Oh, would it be possible to make the bot log all different coordinates to a text file, just to see what kind of coordinates are possible? Maybe there exists a small predefined set of them. I'll try to give some more info soon.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
Make a movie file without the luck manipulation frames, it obviously won't have the scepter where you want but that will be the base. Check where the scepter is located on this movie file. Adding idle frames to the starting screens should affect the randomness since you say that the press of START at char selection affects the rng, and in theory you aren't wasting frames up to that point. In other words if you add an idle frame at 00 then start can't be pushed at 339 can it? Now, test this if you haven't: for frame 0 to 338 check if rapid firing another button modifies the scepter's position. let's say start, up, left, whatever, just test one button per try. Then check if holding buttons during the waiting frames modify the location differently (ie. you find that pressing up once is enough to change the data, then try if holding it for 2 frames has a difference). What you have to test is if the game cares where you waste idle frames, in other words at 357 you give the last input. If you add 10 frames before this last input, is the effect exactly the same as if you added those frames before 350 or before 339? If not then it works like pokemon yellow in that sense and complicates things. What I get right now is that it only cares for frame 339 and then onwards. At 340 you have an idle frame but you aren't including it in the manipulation why? Aren't you able to do Start, Left for example? And finally between 357 and 380 are you able to modify by rapid firing buttons? The bot can create text files in excel friendly format (tabbed data) so yeah I use that to tell me which ones desynched, failed or succeeded.
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
gia wrote:
At 340 you have an idle frame but you aren't including it in the manipulation why? Aren't you able to do Start, Left for example?
It is not included in the manipulation, because it is always required. The game needs 1 frame to think between the button presses.
gia wrote:
And finally between 357 and 380 are you able to modify by rapid firing buttons?
Pressing any buttons seem to have no effect after that point (357). That is one of the reasons why I originally made the assumption that only functional input changes the RNG. In any case, I'll do some more tests with redundant input. Meanwhile, here's some new info: 63 - START - Fade logo. Idle frames have no effect here! You can add huge amounts of idle frames in the very beginning of the movie without changing the result. 232 - START - Fade another logo. Idle frames affect randomness! 283 - START - Fade the title screen. Idle frames affect randomness! So, it seems that the bot should start working at frame 232. Also, I had missed the fact that there are more relevant coordinates: {11, 4} - 9 frames of walking required. (This is used currently.) {11, 5} - 0-frame walk (Optimal.) {11, 6} - 9-frame walk {10, 4} - 12-frame walk (Not bad afterall!) {12, 4} - 12-frame walk All other locations are too far away to have any meaning, but any of these five have potential for improving the movie, if achieved with short luck-manipulation. In general, improvement happens, if walk frames + luck-manipulation frames <= 17 Right? As it seems, the luck-manipulation got a bit more complicated, so I see a good chance for an improvement here. So, umm... The hypothetical optimal movie with hardest difficulty is 592 frames. To improve the current record (610 frames), there are 17 frames of variation that can be added to the hypothetical optimal movie. Here is the base input file with optimal input up to the point where the coordinates are directly viewable from the RAM: http://dehacked.2y.net/microstorage.php/info/1459791714/kb-optimal-input.gmv (Do you really need the input for the rest of the movie? It is easy to do manually at any time.) The meaningful variations to that movie seem to be the following: At frame 232 --> idle 0-17 frames. 283 --> idle 0-17 frames. 339 --> idle 0, 4, 8, 12 or 16 frames. Note: The manipulation seems to "accumulate" already up to this point, so that adding the same amount of idle frames to different sides of the relevant frames causes different results. 341 --> add combinations of {right-idle, left-idle, idle} for 0-17 frames Note: If the password screen is entered at this point, the movie has failed. I'll try to find a RAM address for indicating that. Oh, actually, it could be verified by checking that no coordinates were delivered at the given time limit. 343 --> add combinations of {up-idle, down-idle, idle} for 0-17 frames Note: If the bot wants to use any difficulty level, then the maximum amount of variable frames in every point is 21 instead of 17. But if the bot tries every possibility beginning from the shortest patterns, then maybe we don't need to speficy the difficulty setting at all, since it will have meaning only if no solution is found after 17 frames. Did that make sense? As far as I can tell, these variations in these five points should cover everything regarding functional input. Quite a lot of possibilities there already, but I have the feeling that some interesting results might happen rather early. There are possibly many ways to reduce the task after certain frame limit has been reached. Like, after 9 frames have been used for luck-manipulation, then the only working coordinates are {11, 5}. I hope this helps. I'll do some more tests now with different types of redundant, non-functional input. Edit: Updated and highlighted the input variations.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
The how to is in a text file inside. and it is configured so you load King's bounty and start the bot. The bot is just a movie player though. http://rapidshare.com/files/112373150/gens9j-bot.rar.html oh i screwed the readme, the syntax is missing the "-"s, bah just check the config <framestart>tab<frameend>tab-tab<addressstart>tab<addressend>tab-tab<valuestart>tab<valueend>tab<0/1 success>tab<0/1 fail>
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Nice work, gia! This seems promising. It took me a moment to fully understand the approach we have here, but all of it makes sense now. Very good, very good... I don't have time right now, but it should not take long to configure the bot, because you have made it so easy to use and intuitive. Thank you very much. Oh, by the way, I found out that if address 00FFE509 has the value 252, the password screen has been entered. Observing that as a failure will greatly speed up the work. I'll see what else I can add to the bot config file later. I'll post my finished configuration here then, for others to see. I can't tell when... but hopefully soon. See you!
gia
Player (109)
Joined: 5/3/2006
Posts: 223
lol, I'll repeat just in case. That bot only plays movies already created, not so useful except that it automatically checks rules you put on its config. To "complete" the bot it needs the modification to tas-movie-editor so that program creates the movies to play. To do that I need all my doubts solved however, well at least if you want to be sure the answer is optimal (because all combinations were tested). This is a trace of the asm that sets the data. The instructions to search are at the beginning. The continent is set only once but the other addresses are set 14 times for some reason(i only included two loops) I know nothing of genesis architecture and nothing of 68k instructions and little of assembler so that's as far as I can go. I did notice some division, and the modulo becomes one of the coordinates of the scepter. but can't tell what affects the dividend and divisor. http://rapidshare.com/files/112400124/kingbountyasm.rar.html On kb optimal the continent is defined at frame 366. 1. Random input AFTER the last input clearly affects the coordinates and continent. Please note that you wouldn't be losing frames here (unless the game lags?). The hell? I added a lot of random input right after the last start, and it completely changed the data. But then I removed the input I gave the next frame after start (leaving the rest of input there) and the data did not change at all from the "normal" values. 2. Random input before the first input doesn't seem to affect anything.
Active player (287)
Joined: 3/4/2006
Posts: 341
Based on that disassembly, this line seems to be responsible for determining whether the scepter can appear in a given square. The game will keep choosing random coordinates until the scepter appears in a valid square.
00:2960  4A 30  TST.B   $00(A0,D0)
Note: A0 = FFFF9C52, D0 = (continent << 12) + (X << 6) + Y The routine at 01:3A78 is probably the RNG. If that can be deciphered, it would make this manipulation that much easier. Unfortunately, I don't know 68K ASM either.
Editor, Expert player (2479)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
gia wrote:
On kb optimal the continent is defined at frame 366.
In other words, 23 frames after the last input.
gia wrote:
1. Random input AFTER the last input clearly affects the coordinates and continent.
But it has no meaning, because the results are exactly the same as delaying the last input. The game needs one idle frame to register the input. If you press buttons immediately after the last input, the START just gets delayed, so that is why the memory values are changed. For the same reason, there's no need to hold the buttons at earlier points either, because to me it seems that holding always has the same results as some idle frame pattern. Edit: IMPORTANT! One more simplification for the input variations: At frame 339, the game registers the start button only in 4-frame intervals. So, the possible idle frame patterns at frame 339 are these: 0 4 8 12 16 So, there are 5 possibilities at that point instead of any amount of idle frames. This reduces the task a lot. I really think that every meaningful movie variation is considered with the input variations I have listed a few posts ago. Or do you have doubts, gia? I can't think of any other kind of input to test, but if you have ideas, I'll check them. Edit-2: First suggestion for the bot configuration:
// These lines will check the sceptre location and report success, if it is located nearby on the first continent:

366	384	-	FFE8A8	FFE8A8	-	a	c	1	0
366	384	-	FFE8AA	FFE8AA	-	4	6	1	0
366	384	-	FFE8A6	FFE8A6	-	0	0	1	0


// This line stops the movie, if password screen is entered:

346	364	-	FFE509	FFE509	-	fc	fc	0	1
If this configuration seems ok to you, I'm ready to run the bot when I get the movie files.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
Cool, so if the asm checks for valid positions it must give hint to what those valid positions are and tell if 0,11,5 is valid or not. Aqfaq are you saying that the only way to "modify" the rng is by adding idle frames before valid input? no more left right? I was waiting to know if other buttons had effect, because if one "extra" press of left has the same effects as two idle frames then there's no need for pressing extra lefts. The other way, if an extra left has a different effect then why not another button, and what buttons specifically. If it is only about idle frames then my pkmn yellow edit will suffice. And since there are fewer inputs then the bot won't take that much. And if you want to test different difficulties then you can make different "optimal" movies and test them separately. Anyway you missed a number as the first thing on the bot config, if you miss it it will always start at movie 1.gmv I edited the config so it has your settings, and added the idle frame generator to the bot folder along with its config and quick readme. I believe I edited the optimal movie there so replace it. http://rapidshare.com/files/112520145/gens9j-bot.rar.html After 5 frames the best one is 0,14,4, and 6 frames got 200 combinations so it will start getting heavy with 8 frames. _
1 2
5 6 7 8