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
6 7 8
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
I made further tests and it seems that I can reproduce the exact same manipulation with holding and idling. Well, I can't test every combination, so there might be some strange cases where left-left-idle produced different result than left-idle-idle. For now, I would say there is no need to ever hold any button longer than 1 frame. But it is not solely about idle frames. We still need those 1-frame lefts and rights. All the required input variations are listed in one of my posts above, but I'll put them here too: 232 --> idle 0-17 frames. 283 --> idle 0-17 frames. 339 --> idle 0, 4, 8, 12 or 16 frames. 341 --> insert combinations of {right-idle, left-idle, idle} for 0-17 frames. 344 --> insert combinations of {up-idle, down-idle, idle} for 0-17 frames.
gia wrote:
Anyway you missed a number as the first thing on the bot config
Oh, yes, I left that blank, because I was thinking if there are many movies to test, we could organize the work, so that alden (if he or someone is still interested) can have the opportunity to run the bot too. Like, I could begin from movie 1 and alden could start from movie 5000. Oh well, I'll test the generator now with 6 frames, so that I can see how it works. Edit: 343 = 344 Edit-2: add = insert
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Ok, I ran some tests and it seems to work great. It is amazing to see many hours of work fly pass in a minute. Awesome. :) As you can see now in the logs, there is the problem that many movies give result 0,0,0, because the start button registers only every 4th frame at frame 339. Many movies fail to start the game.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
I see no problem with having to check extra movies rather than possibly missing one. You say every 4th frame starting 339?, but if I insert 2 idle frames at 281. That 339 gets pushed to 341, would it still be 0-4-8-etc frames inserted at 441 or 2-6-10, or 1-5-9, etc, if you are completely sure it remains 0-4-8 then ok. Instead of add use insert please, that gives me the idea that the presses/idles are added to that frame and the old contents of that frame get pushed forward. Your movie has input on 341 but not on 343 (it is on 344), are your instructions correct? Added a config value for the second line, frame skip, the bigger the number the faster the bot, although really big numbers won't have much difference. Will upload it with the new movie editor after you answer. With 50 it is running 1000 movies in just a couple minutes since they are very short.
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
gia wrote:
if you are completely sure it remains 0-4-8 then ok.
I'm sure. After inserting frames, the behavior stays the same, but gets pushed forward.
gia wrote:
Instead of add use insert please, that gives me the idea that the presses/idles are added to that frame and the old contents of that frame get pushed forward.
Yes, sir. I intended to say "insert", when I said "add".
gia wrote:
Your movie has input on 341 but not on 343 (it is on 344), are your instructions correct?
Sorry, my mistake. 344 is the correct frame.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
Ok this tas-movie-editor is custom for your movie and won't work with anything else, in fact the inputs are hard coded (but still load the optimal movie because it gets the length and header from there, try to use the movie already included in the bot folder). The other one can add idle frames to any other optimal movie for any other game. http://rapidshare.com/files/112573342/gens9j-bot.rar.html The gens bot has the frame skip config added. Im using directions that only take 1 frame and not two, so there will be extra cases but you will also be sure that you dont slip one special case. There should also be desynchs associated to that.
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
I tested some more and it seems that the log is often incomplete:
...
.\bot\226.gmv		ffe8a8	0	ffe8aa	0	ffe8a6	0
.\bot\227.gmv		ffe8a8	26	ffe8aa	1c	ffe8a6	1
.\bot\228.gmv		ffe8a8	2e	ffe8aa	b	ffe8
There were 250 movies, but this time it stopped logging after movie 228 and left an incomplete line. I ran the bot with high frame skip, so it might be causing this? I'm sorry, I can't give a more specific bug report.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
hmm, i haven't tested the new bot, but never had an incomplete log before, let me finish the test (btw you opening with notepad?, try something bulkier like word or notepad++)
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
gia wrote:
hmm, i haven't tested the new bot
It was the old bot. Haven't tested the new one yet. Maybe the log problem is just on my end. Edit: Anyway, it is no big deal. It just leaves a few movies out, so I can rerun from the point where the log ends and it will work fine.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
No, 4K movies and the log is perfect. Wait until the bot is done then close it and open the txt file, I don't flush the stream (erm that's like updating the file) maybe thats it, when I open the log file mid-run it shows as a blank file, same there? Disk space left? min 1 and max 5 frames the best one is movie 3321 0,d,4 movie 3653 is 0,e,4 hmm i forgot to close the file when the bot finishes, and maybe your os acts different to mine: this will close the log file when the bot says it can't open the next file: http://rapidshare.com/files/112582691/gens.rar.html
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Everything seems to be working fine now. Excellent work, gia! The number of iterations is getting high, so to avoid double work, I'll inform that I'm going to run the bot up to 9 frames now. (5 and 6 frames together have more than 12 000 possibilities already.) If someone wants to join using the bot, just tell what you are doing to avoid double work. (It doesn't matter really, using the bot is fun anyway.)
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
King's Bounty improved 4 frames: http://dehacked.2y.net/microstorage.php/info/1436327623/giasbounty.gmv I had min frames: 5 Max frames: 6 Winning movie number: 10636 The coordinate was [12,4], so the movie contains 3 frames more walking, but much less luck-manipulation. I still need to figure out the exact movie properties. It seems something strange is going on in the beginning of the movie... Uses skill level 3/4. (This saved 2 frames, if you count it as improvement and equally entertaining as choosing the hardest skill level.) Gia wins! I believe more is possible, like 5 or 6 frames of improvement, if the sceptre gets manipulated closer. There are still many iterations to test. Well, awesome.
Joined: 5/29/2004
Posts: 757
Shall we start the betting pools on not only how many frames will end up being saved, but final end time as well? I'm going to say 10.09 ^^ Just because I am that crazy. Mr. Kelly R. Flewin
Mr. Kelly R. Flewin Just another random gamer ---- <OmnipotentEntity> How do you people get bored in the span of 10 seconds? Worst ADD ever.
Joined: 3/7/2006
Posts: 720
Location: UK
I guess you used up those rerecords after all, Aqfaq. Not like you did it, though... :)
Voted NO for NO reason
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Hehe, yeah... Oh, gia, there's something going on, but I have not time to figure it out right now. The optimal base input file presses start at frame 63. The winning movie presses start at frame 64, even though "startinsertingblanksatframe" was 100. Even more interesting is the fact that hex-editing the new movie to press start at frame 63 causes desynch at the character selection screen. So, idle frames before the first start button (at frame 63) seem to have some meaning afterall! Well, I'll look into it more carefully later. It is great to have the movie improved already, because now the possibilities have been reduced, so that not so huge iterations need to be tested. :)
gia
Player (109)
Joined: 5/3/2006
Posts: 223
lol? maybe i... hardcoded it wrong? like I said its hardcoded so the config is useless I was adding all inputs myself, I'll give it a glance. lol, I had left the movie creator running with 10 frames just for kicks, and now its 5 minutes the dos window is deleting movies and still nothing ok, tas-movie-editor starts with frame 1 and gets to frame 63, so in index 0 format it would be frame 62, but i hardcoded frame 63, get it? as soon as the dos win clears my movies (hopefully it will finish someday i left the creator running like one hour...), ill check if the first input does change stuff or not, and make the changes. 195,000 more files to go! EDIT: 0,C,4? open the movie with the ___normal___ tas-movie-editor, right click frame 1 and use Remove Frame, that will shift all frames. so you'll have start on 63 and the rest of frames relative to that. And I got those values. If you only hexedited frames 63 and 64 without shifting the rest then that's your desynch. This very small error however has had a huge impact on the search I suggest you stop because it has to be done again (with lower ceiling however given that movie). Mind tell the new maximum frames? I'll run 1 to 7 frames and that will be it, the easy part :P Fixed tas-movie-editor: http://rapidshare.com/files/112618445/tas-movie-editor.rar.html
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Hahah, looks like we are both making little mistakes. I was wrong when I said my hex-edited movie desynched. It synchs fine, so the improvement is now actually 5 frames. Compared to the old record, the new movie has 1 frame more luck-manipulation in the logo screen at frame 232 6 frames less luck-manipulation in the character selection 2 frames less luck-manipulation in the skill level selection 1 frame less black screen before the game starts - this is surprising! 3 frames more walking Total: 5 frames faster input Interestingly, there is one frame of lag in the end, after the final input is delivered. This lag frame was not present in the old record. So even though the input is now 5 frames faster, the AVI would be only 4 frames faster. If the hardest skill level is not required, then the new movie is 16 frames from the hypothetical perfect movie, since we wasted 12 frames in the walking and 4 frames in the luck-manipulation. In other words, the 21-frame max limit for any-skill movies got down to 16 frames. I suppose this rules out the possibility for 16-frame idle at frame 339, but otherwise the possible input variations stay the same. How many iterations does that make then with max 16 frames? Ok, so you run the bot from 1 to 7 frames. I'll run the bot with min/max 8 frames now.
gia
Player (109)
Joined: 5/3/2006
Posts: 223
Dont make me calculate please, calculating itself would take a while. 9 and 10 frames should be already huge enough, so think of millions or billions. It hasn't finished but so far (28 out of 45k) I have gotten several 0,c,4s (and only 04cs which I find weird), the first on movie 1716, which corresponds with I have no idea (last input is on 350, so 6 frames over optimal). I think i will have to make another modification to the movie creator so not only you define the frames to use but also after how many calculations to stop (and save to a file where it stopped so it can start from there next time), because creating a couple billion files at once won't be cool for your pc. EDIT: Finished, 1716 remains best: http://dehacked.2y.net/microstorage.php/info/1526553404/1716.gmv
Active player (287)
Joined: 3/4/2006
Posts: 341
Based on the disassembly and the RAM, it is possible for the scepter to be at (11,5). I have no idea if it's possible to manipulate it quickly though. I looked at the RNG, which is longer than necessary because the programmer has obviously never heard of the ROR instruction. The RNG involves three 2-byte values, which I will call A (FFFF40), B (FFFF42), and C (FFFF44). When the RNG is called, these numbers are changed in the following way (treat these as happening simultaneously): A = A + (B rotated 5 bits right) B = B - (C rotated 7 bits right) C = C xor (A rotated 3 bits right) I'm not sure if the numbers are changed by any other means.
Skilled player (1652)
Joined: 11/15/2004
Posts: 2202
Location: Killjoy
It appears that the RNG is initialized from FFFF3E, which is intialized by the difficulty level!!! First step: 00:1AFA 72 00 MOVEQ #$00,D1 00:1AFC 32 00 MOVE.w D0,D1 00:1AFE 70 00 MOVEQ #$00,D0 00:1B00 10 2D MOVE.b $E4E0(A5),D0 ** [00:1B02] R08 = 01 [FFE7F2] <---------------(DIFFICULTY LEVEL!!!!) 00:1B04 74 0A MOVEQ #$0A,D2 00:1B06 E5 A8 LSL.L D2,D0 00:1B08 74 00 MOVEQ #$00,D2 00:1B0A 34 00 MOVE.w D0,D2 00:1B0C D4 81 ADD.L D1,D2 00:1B0E 70 00 MOVEQ #$00,D0 00:1B10 10 2D MOVE.b $E49A(A5),D0 ** [00:1B12] R08 = 00 [FFE7AC] 00:1B14 72 0C MOVEQ #$0C,D1 00:1B16 E3 A8 LSL.L D1,D0 00:1B18 72 00 MOVEQ #$00,D1 00:1B1A 32 00 MOVE.w D0,D1 00:1B1C D2 82 ADD.L D2,D1 00:1B1E 3B 41 MOVE.w D1,$FC2C(A5) ** [00:1B20] W16 = 0708 [FFFF3E] Second step: 00:2794 70 00 MOVEQ #$00,D0 00:2796 30 2D MOVE.w $FC2C(A5),D0 ** [00:2798] R16 = 0708 [FFFF3E] 00:279A 72 00 MOVEQ #$00,D1 00:279C 32 2D MOVE.w $FC2C(A5),D1 ** [00:279E] R16 = 0708 [FFFF3E] 00:27A0 ED 89 LSL.L #6,D1 00:27A2 B3 80 EOR.L D1,D0 00:27A4 3B 40 MOVE.w D0,$FC2E(A5) ** [00:27A6] W16 = C508 [FFFF40] 00:27A8 70 00 MOVEQ #$00,D0 00:27AA 30 2D MOVE.w $FC2C(A5),D0 ** [00:27AC] R16 = 0708 [FFFF3E] 00:27AE 22 3C MOVE.l #$000053C6,D1 00:27B4 C2 80 AND.L D0,D1 00:27B6 D2 BC ADD.L #$0000C576,D1 00:27BC 3B 41 MOVE.w D1,$FC30(A5) ** [00:27BE] W16 = C876 [FFFF42] 00:27C0 70 00 MOVEQ #$00,D0 00:27C2 30 2D MOVE.w $FC2C(A5),D0 ** [00:27C4] R16 = 0708 [FFFF3E] 00:27C6 22 3C MOVE.l #$0000AC39,D1 00:27CC C2 80 AND.L D0,D1 00:27D4 3B 41 MOVE.w D1,$FC32(A5) ** [00:27D6] W16 = B8C7 [FFFF44] Bunch more alterations to Nitrodon's 3 RNGs, and then you get the continent/scepter values....
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.
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
Another session is over with a result that might be optimal! Min/max frames: 8 Files to playback: 118 832 Bot running time: 5 hours Winning movie number: 40853 Skill level: 1/4 (easiest) Sceptre location: 11,5 (optimal, no walking required) Movie lenght: 596 frames Improvement over the current published movie: 14 frames Download: http://dehacked.2y.net/microstorage.php/info/251714935/40853-finished.gmv Edit: Movie number 95409 achieved same lenght with skill level 3/4, so this is a bit better movie: http://dehacked.2y.net/microstorage.php/info/1382406997/95409-hard.gmv Edit-2:
gia wrote:
Finished, 1716 remains best: http://dehacked.2y.net/microstorage.php/info/1526553404/1716.gmv
That movie completed the game in 605 frames. It was indeed strange how often the coordinates 12,4 were received.
Joined: 3/7/2006
Posts: 720
Location: UK
There's not much else to say to that but 'rofl'.
Voted NO for NO reason
gia
Player (109)
Joined: 5/3/2006
Posts: 223
cool!, since the bot starts with the shortest combination and progresses to the longest ones, that one's optimal unless you later find something new that alters the rng and requires rerunning ;o and the little rng decoding could help a 100% run later Am I right calculating 14 frames takes it below 10 seconds?
Player (121)
Joined: 2/11/2007
Posts: 1522
Wow! Good job guys. Now you need to figure out how to beat the game without even starting it :)
I make a comic with no image files and you should read it. While there is a lower class, I am in it, and while there is a criminal element I am of it, and while there is a soul in prison, I am not free. -Eugene Debs
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
There seems to be variation in the fading time after the character selection screen. I never noticed it before. I tested it briefly and it seems that even with 2 frames of more time wasted in the character selection screen can result in 1 frame faster overall time, so there is sometimes at least 3 frames difference in the fading time! This means that at least all 9-frame and 10-frame iterations need to be tested in order to find/verify the optimal movie. Because of the varying fade time, I can't tell what is the exact maximum amount of luck-manipulation that is allowed. Anyway, here are some figures I get when I think about the game, not considering the 1-3 (?) frame fluctuation caused by the fade screen: The hypothetical optimal movie (which starts the game as fast as possible and searches immediately) takes 588 frames. The hypothetical optimal movie fails, so the real optimal movie is at least 589 frames. It takes 9 frames to walk to the adjacent location, so any movie that has coordinates {11,4} or {11,6} take at least 598 frames. Current record is 596 frames. So, the only possible sceptre location that can save time anymore is the one we have now, {11,5}. The improvement happens, if the same manipulation can be achieved with more input, but less fade time. I don't know exactly what determines the fade time, so the 596 might be the optimal time or not. If we assume that the fade time can have 3 frames of variation, then the movie might get 1 or 2 frames faster after the 9-frame and 10-frame iterations are tested. After that, I see no possibilities for any improvements and even the fade time speculation is strongly hypothetical already. I'm probably not going to use my computer for the bot anymore, but it would be nice if someone could do that. Well, ok, I might contribute a bit more and run another 100 000 movies, but not more. In conclusion, I would bet that the movie is now 0-2 frames from perfect. Oh, but there are some things that are not tested at all, like 3-player input and reset button, so anything is possible.
Editor, Expert player (2480)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
alden wrote:
Now you need to figure out how to beat the game without even starting it :)
This brings up an "interesting" problem... What is your completion time, if you never start the game? Is it infinite frames or 0 frames or what? Like, when the other guys shout "Last guy on the hill is a fag!" and one of the guys never runs to the hill, is he a fag or not? (When I was a child, the guys never understood this problem and told me I was a fag anyway.)
1 2
6 7 8