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.
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.
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
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.
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.
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
I'm sure. After inserting frames, the behavior stays the same, but gets pushed forward.
Yes, sir. I intended to say "insert", when I said "add".
Sorry, my mistake. 344 is the correct frame.
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.
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.
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++)
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
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.
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
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.)
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.
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: 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. :)
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
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.
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
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.
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.
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:
That movie completed the game in 605 frames. It was indeed strange how often the coordinates 12,4 were received.
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?
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.
Joined: 4/8/2005
Posts: 1573
Location: Gone for a year, just for varietyyyyyyyyy!!
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.)