Joined: 4/25/2004
Posts: 615
Location: The Netherlands
lol, yeah well, a perfect run is nice "for the record" (both literally and as a figure of speech). but the time lost adding score will get to you rather fast (perhaps the video can skip these? With a note of course) I'm gonna have to think about it some more as well. Right now I'm thinking to try the max and the optimized (like, shoot whenever 6+ speed). If there's too small a difference between the two methods I'll just go for speed. Before that I want to code some logging options into my bot though.
qfox.nl
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
I think shooting in between with power of 1 will hardly cause any delay (unless you do it three times per level ;). If you time it between the powerfluctuations... Doing it once per level should lower the bonus-delays.
qfox.nl
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
qFox wrote:
I think shooting in between with power of 1 will hardly cause any delay (unless you do it three times per level ;). If you time it between the powerfluctuations... Doing it once per level should lower the bonus-delays.
Yeah, that should help. I'll see about trying it some day.
Skilled player (1402)
Joined: 5/31/2004
Posts: 1821
If the movie is done, it might be a good idea to make an avi where the score adding is skipped. It will make the entertainment rating go up by like 3 points :)
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
News on the movie. Just quoting from IRC. 0041#nesvideos.Bisqwit Step 1 done: Lunar Ball bot converted to multitasking, increasing its performance. Then to do the second step, adding support for idle shots 0204#nesvideos.Bisqwit Initial version of idle-shot-utilizing Lunar Ball bot written. Runtime probably increased by a large factor... 0212#nesvideos.Bisqwit Dehacked: In Lunar Ball, if all your shots pocket something, you'll eventually end up having score tallies taking significantly more time than the actual shots. However, doing shots that don't pocket anything once in a while, the bonus counter can be reseted, so that score tallying returns into tolerable range again. 0213#nesvideos.Bisqwit And that however is what I just implemented. 0215#nesvideos.Bisqwit At https://files.tasvideos.org/bisqwit/bisqwit2-lunarball-incomplete.avi you can see how the score tallying takes a lot of time at around table 20 ­-- And it gets progressively worse. 0245#nesvideos.Bisqwit Yeah, it's a bit of pity the bonus works like that. But the idle shots don't take away chances for cool shots. 1344#nesvideos.Bisqwit Allright, theory re: Lunar Ball confirmed, my bot has already figured out how to clear the two last balls in stage 1 faster with two shots than with one shot, considering the effects on score tallying. 1345#nesvideos.Bisqwit Xkeeper: The thing is, at stage 20 or so, the bonus effects start consuming more than 15 seconds of time per each shot, it gets annoying to watch, because you have to skip-forward in the video, a lot, to see something happening other than numbers rolling 2002* #nesvideos/Bisqwit is trying to figure out how to do 256*256*256*256 shots without doing 4294967296 shots 2002#nesvideos.Bisqwit i.e. 256 different angles, 256 different velocities, and two shots in a row 2003#nesvideos.Bisqwit Testing 65536 (256*256) shots takes a couple of minutes, it is manageable, but at that rate, 4294967296 would take more than half a year 2005#nesvideos.Bisqwit So I'm trying to approximate now by doing 256*256 * 32*8, which is only as little as 16777216, taking only 22 hours 2006#nesvideos.Bisqwit Therefore it would clear a stage by average in three days 2007#nesvideos.Bisqwit Therefore it would take a half a year to complete the entire game -- assuming it consumes 100% of the server's CPU at all time [Edit: Fixed URL]
Chamale
He/Him
Player (178)
Joined: 10/20/2006
Posts: 1352
Location: Canada
I get an "error - file not found" when I click on that download link.
Senior Moderator
Joined: 8/4/2005
Posts: 5770
Location: Away
Bisqwit wrote:
Therefore it would take a half a year to complete the entire game -- assuming it consumes 100% of the server's CPU at all time
Am I correct in the assumption that the reason for the site's near-constant slowdown is BisqBot TASing Lunar Ball?
Warp wrote:
Edit: I think I understand now: It's my avatar, isn't it? It makes me look angry.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
No, the Lunar Ball bot, although it saturates the CPU, is very easy on RAM use and does not cause a resource congestion of any noticeable kind. The slowness has been caused by another program that eats 250% of the available RAM, causing constant swapping that grinds down performance to its minimum even though the swap is striped across three HDDs. That another program is mkcromfs which is currently processing a 96 gigabyte filesystem, in hopes of bringing it down to around 9 gigabytes after it's done in hopefully another week.
Chamale
He/Him
Player (178)
Joined: 10/20/2006
Posts: 1352
Location: Canada
I'm still getting a "file doesn't exist" error on that .avi. Could you upload the .fcm to Microstorage please?
Joined: 4/25/2004
Posts: 615
Location: The Netherlands
Is that like double space for dos? That brings back nightmares...
qfox.nl
Dwedit
He/Him
Joined: 3/24/2006
Posts: 692
Location: Chicago
WOW, that is quite some number tallying there. It just sits there and adds 10 for hours on end.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
qFox wrote:
Is that like double space for dos? That brings back nightmares...
The principle is the same, albeit much more restricted: Once the filesystem is created, it is not modified anymore. This allows to use an order of magnitude heavier compression than on a live-update filesystem, bringing 2500 MB of data down to 200 MB instead of 1000 MB. (When the data is suitable.)
Skilled player (1885)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
That was pretty entertaining, but the score tallying took way too much time in my opinion. I would personally prefer to watch an .avi of this run with the score tallying edited out, if that's possible.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Randil wrote:
That was pretty entertaining, but the score tallying took way too much time in my opinion. I would personally prefer to watch an .avi of this run with the score tallying edited out, if that's possible.
As already indicated I'm* now in process of making a TAS that eliminates the excess score tallying by utilizing shots that don't deposit any balls into pockets. Such shots reset the bonus multiplier. They also have an opportunity to relayout the board such that the next shot can be more effective. *)Or rather, a computer of mine is.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
I've got the improved version of the Lunar Ball bot such optimized that it can now calculate a pair of shots in approximately two days, completing a board in less than a week. Tomorrow, it should begin board 3. It has a few shortcomings#, but it does minimize the score tallying times and clear the board in two non-dummy shots by average. As a side effect, the old-style bot was such improved that it can produce a complete movie (that ignores score-tallying delays) in about a single day. If someone has a Linux box satisfying certain* requirements and wants to run the bot to produce a complete version of the FCM linked to earlier, here, grab this package. http://bisqwit.iki.fi/kala/lunarballbot-singleminded-bisqwit.zip A running script is included in the package. The ROM you need to supply yourself. #) Shortcomings: -- To save running time, it does not attempt all possible pairs of shots -- It does not care where it leaves the cursor pointing (it can be bad for the timing of the next shot). *) Requirements: -- An Intel Core2-compatible CPU (four cores recommended) -- ICC 10 libraries (libguide.so, libirc.so) -- SDL 1.2 libraries, and its dependent libraries -- X11 I would have made the binary static, but it barfed when I tried that, so I gave up trying that.
Post subject: 50% WIP (partially broken, but watchable)
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Okay, here is the WIP of my current TAS of Lunar Ball. FCM: https://files.tasvideos.org/bisqwit/bisqwit3-lunarball-incomplete.fcm *** See EDIT below *** Flash video: http://bisqwit.iki.fi/avstream/v/lunarball50pbroken It plays the 30 first boards at default friction in single player mode. 30 remain, so it is 50% complete. Movie length 11:30. Goals: 1. Least time spent completing levels 2. Exception: If a cooler solution (more balls pocketed at once) is only a few frames slower (when calculating frames/ball average) than the fastest solution, choose the cooler one. 3. Exception 2: If the location of the ball / orientation of the cursor after the shot does not allow for the next shot to be anywhere near optimal, a less optimal choice may be chosen for the current shot. (This exception is always issued manually.) There is one board in which it clears the whole board in single shot. Bummer it only gets a regular "PERFECT" there. PERFECT indicates that all shots pocketed something. Incidentally, that is the only PERFECT in this run so far. Obviously, PERFECTs are a bad thing in general because they cost about 5 seconds per occurrence, and getting them means that the RATE cannot decrease, creating the (huge) bonus delay escalation problem discussed earlier. ****EDIT**** Turns out I botched it in board 23. I had the recording temporarily in PAL mode. I will have to redo boards 23-30! To view this movie, see the Flash video linked above. If you want to check the FCM, follow these instructions: -- Play the movie normally, UNTIL board 23 loads. -- Before board 23 begins, create a savestate. -- Switch FCEU into PAL mode, and load savestate. -- Play movie, UNTIL board 24 loads. -- Before board 24 begins, create a savestate. -- Switch FCEU back into NTSC mode, and load savestate. -- Watch the rest of the movie normally. Needless to say, the final movie won't have this cumbersomeness. And yes, I checked out. The solution for board 23 that worked in PAL mode does not work in NTSC mode. Why, no idea. The same angle and velocity gives a different outcome. ______________________________ The musical score above is of Lunar Ball, of course. Automatically generated, of course...
JXQ
Experienced player (750)
Joined: 5/6/2005
Posts: 3132
I imagine it is neat to see a program that you've built, build a TAS for you :) I find this TAS pretty interesting. And thanks for the flash video, too. It's surprising how much the extra low-power shots really reduce the bonus countdown (I remember on earlier versions, it was just so loonnnnnnng..)
<Swordless> Go hug a tree, you vegetarian (I bet you really are one)
Joined: 7/2/2007
Posts: 3960
Nice! Lots of really impressive shots that just come in from out of left field. Now all you have to do is teach the bot to write the submission commentary. :)
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Derakon wrote:
Now all you have to do is teach the bot to write the submission commentary. :)
I have enough to write on my own :) It's not like the run is created completely alone by the bot from start to end, anyway. (It could do that, but for efficiency reasons it is often better that I change things. Also, after the run is complete, I intend to retouch it for art. (The cursor zooming can be controlled without affecting the shots' effect, and the bot does not do that at all.)
Banned User, Former player
Joined: 12/23/2004
Posts: 1850
The video doesn't play. (Just sits at the stupid spinner forever...) Also, not sure if it's been suggested before, but have you considered simply adding a few hacks to remove the delays? It might be better to watch that way, since high point bonuses can still be achieved. Eh.
Perma-banned
Active player (277)
Joined: 5/29/2004
Posts: 5712
Are you sure the game can be altered to compute the bonuses instantaneously?
put yourself in my rocketpack if that poochie is one outrageous dude
Banned User, Former player
Joined: 12/23/2004
Posts: 1850
Bag of Magic Food wrote:
Are you sure the game can be altered to compute the bonuses instantaneously?
Considering that this game most likely stores the bonus in a memory address, then adds it in x points at a time, yes, it would be possible to do it in (most likely) one frame. I will do more research later.
Perma-banned
Post subject: Posting my WIP here. Also explaining the technical bits.
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
I have a WIP of this game, last updated in July 2008. (There should in fact be a newer WIP too, but I don't remember which server I ran it on, and I cannot therefore acquire the file...) However, due to bit-rot, I have been unable to continue the TAS. The program which I used to calculate the solutions, simply does not work anymore. I don't know why, and I don't have time or energy to fix it. It uses multiple instances of FCEU in parallel (multicore), and it is not written in LUA. Now it just crashes right after starting, due to problems with communication with the (virtual) X server or something. I am therefore releasing my current WIP. My hope is that someone finishes it (continuing the same awesome quality of course) and credits me as a co-author. It is a .fcm file. Apologies for that, too. I don't know whether it converts nicely to fm2. This TAS aims for fastest absolute time. I.e. it also counts score tallying as a slow-down factor and attempts to minimize that. Hence it gets the "perfect!" congratulation only once so far. 33 stages have been completed, out of the 60. The movie length is 12:45.42 according to Microstorage. It ends after the first shot in stage 34. http://dehacked.2y.net/microstorage.php/info/1597220526/lunarball-wip-34up-bisqwit.fcm Note: This WIP does not have the PAL mistake I mentioned earlier. It is proper all the way. [img_left]http://bisqwit.iki.fi/kala/snap/lunarball.png[/img_left] The playing algorithm can be explained with the following list of definitions: * Each round starts at the first possible frame when the cursor can be moved, and ends right before the next round. This ensures that the score tallying times are counted. * Whether the cursor can be moved, is determined by pressing nothing, undoing it, pressing the R button, undoing it, pressing the L button, undoing it, and checking whether the cursor had reacted in expected ways (R and L must produce a different change and 'nothing' must produce no change). * Changing the cursor distance (up and down buttons) has no effect to the game. * To repeat a shot in deterministic manner, you only need to know the angle and the power meter value to make a shot. The bot can tell you these; you can manipulate the cursor distance manually in whatever artistic way you prefer. Indeed, the bot produces a list of angle and power meter pairs for the player to perform. It does record movie autonomously, but a frame-advance and RAM watch equipped player can redo the movie entirely by simply following that list which can be transmitted in a text file or written on paper. It contains simply two numbers for each shot. * RAM addresses of significance (all numbers hex): 3C0=angle (0..FF); 3A0=velocity (12..FF at steps of 3); 187=stage; 18E=shot number; 300+n=ball status (n=0..10; 1,2=live; 0,3,83=not ball); 370+n=ball x, 330+n=ball y, 600+y*1A+x=board map * Algorithm always calculates the result of two shots in a row. For the second shot, all combinations are tested (256 angles, 80 velocities); for the first shot, just 256*15; sometimes less. I often varied these numbers manually between rounds. If the first shot pockets any balls, the second shot is omitted. (The purpose of the first shot, "pre-shot", is to position the cue ball in a better position and to reset the rating that makes score tallying go haywire.) If neither shot manages to pocket any balls, or it takes too many frames until either the cursor is controllable again or the stage ends, the aim is considered a failure. * The first shot is chosen that results in the best state after the second shot. * State wellness is calculated with the following approximate formula: ((number of balls pocketed) + (prospects)) / (the length of the round in frames). Prospects is a numeric value 0..1 that is inversely proportional to the average distance of the remaining balls to the pockets nearest to them. * A genetic algorithm is used to refine the set of remaining choices. * The search space is limited by using a frame count limit. Pocketing the cue ball also counts as a blunder. * Given a pair of angle and velocity, aiming and shooting is a matter of aiming first, then waiting until the velocity counter is at exactly the right value, and then shooting (B button for 1 frame). * Aiming is accomplished by first determining whether the R button or the L button results in faster aiming. (Simple subtractive mathematics.) After that, determining whether mashing the button results in faster aiming than just holding the button. By mashing, a change of N units requires 2*N-1 frames. By holding, a change of N units requires 15+N frames. EDIT: Surprise and terror ― the bot runs properly on my server again. Looks like the TAS is going to be continued after all. After a pause of 1,5 years! Here we go... bisqwit@chii:~/nes$ egrep 'Beginning|Pocketed' lunarball.log Beginning new shot. Table=34, remaining balls=7 Record: Pocketed 1 (time 548, angle 0, velo 255, preangle 0, prevelo 42) (ball at 6D,AD) Record: Pocketed 1 (time 532, angle 7, velo 255, preangle 7, prevelo 210) (ball at 39,74) Record: Pocketed 1 (time 487, angle 7, velo 255, preangle 7, prevelo 252) (ball at 7A,AE) Record: Pocketed 2 (time 600, angle 8, velo 255, preangle 8, prevelo 75) (ball at B2,B9) Record: Pocketed 2 (time 595, angle 8, velo 255, preangle 8, prevelo 84) (ball at B4,B9) Record: Pocketed 2 (time 579, angle 11, velo 255, preangle 11, prevelo 99) (ball at 2E,A6) Ignoring: Pocketed 1 (time 479, angle 17, velo 255, preangle 17, prevelo 150) (ball at 78,A5) Ignoring: Pocketed 1 (time 462, angle 17, velo 255, preangle 17, prevelo 153) (ball at 91,A5) Ignoring: Pocketed 1 (time 387, angle 17, velo 255, preangle 17, prevelo 210) (ball at 47,7B) Record: Pocketed 2 (time 572, angle 18, velo 255, preangle 18, prevelo 147) (ball at 7A,C8) Ignoring: Pocketed 1 (time 364, angle 13, velo 255, preangle 13, prevelo 213) (ball at 8E,5C) Record: Pocketed 2 (time 570, angle 18, velo 255, preangle 18, prevelo 159) (ball at 7A,C8) Record: Pocketed 2 (time 506, angle 14, velo 255, preangle 14, prevelo 24) (ball at A6,80) Record: Pocketed 2 (time 487, angle 30, velo 255, preangle 30, prevelo 87) (ball at 9B,B5) Record: Pocketed 2 (time 487, angle 24, velo 255, preangle 24, prevelo 54) (ball at 8A,A1) Ignoring: Pocketed 1 (time 320, angle 29, velo 255, preangle 29, prevelo 177) (ball at A6,93) Record: Pocketed 2 (time 408, angle 24, velo 255, preangle 24, prevelo 237) (ball at 8C,A2) Ignoring: Pocketed 1 (time 320, angle 36, velo 255, preangle 36, prevelo 141) (ball at A4,81) Ignoring: Pocketed 1 (time 226, angle 39, velo 255, preangle 39, prevelo 111) (ball at AD,9C) Ignoring: Pocketed 1 (time 226, angle 39, velo 255, preangle 39, prevelo 114) (ball at AD,9C) Record: Pocketed 3 (time 466, angle 43, velo 255, preangle 43, prevelo 210) (ball at C5,57) Ignoring: Pocketed 2 (time 367, angle 50, velo 255, preangle 50, prevelo 207) (ball at 6B,A2) Ignoring: Pocketed 2 (time 346, angle 50, velo 255, preangle 50, prevelo 210) (ball at 6B,A3) Ignoring: Pocketed 2 (time 346, angle 50, velo 255, preangle 50, prevelo 213) (ball at 6B,A3) Record: Pocketed 3 (time 461, angle 43, velo 255, preangle 43, prevelo 255) (ball at C5,5D) bisqwit@chii:~/nes$ ps w PID TTY STAT TIME COMMAND 13730 pts/5 Ss 0:00 -bash 14022 pts/5 S+ 0:02 fceu/fce -readwrite 1 -bisqbot 1 -state 4 -play tmp2.fcm lunarball.nes 14023 pts/5 S+ 0:00 tee lunarball.log 14304 pts/5 R+ 0:43 fceu/fce -readwrite 1 -bisqbot 1 -state 4 -play tmp2.fcm lunarball.nes 14305 pts/5 R+ 0:30 fceu/fce -readwrite 1 -bisqbot 1 -state 4 -play tmp2.fcm lunarball.nes 14308 pts/5 R+ 0:21 fceu/fce -readwrite 1 -bisqbot 1 -state 4 -play tmp2.fcm lunarball.nes 14311 pts/5 R+ 0:19 fceu/fce -readwrite 1 -bisqbot 1 -state 4 -play tmp2.fcm lunarball.nes 14322 pts/6 R+ 0:00 ps w bisqwit@chii:~/nes$ uptime 21:59:09 up 3:11, 9 users, load average: 4.12, 3.73, 2.23 bisqwit@chii:~/nes$ sensors|egrep 'temp[12]|Core' temp1: +50.0C (high = -43.0C, hyst = -3.0C) ALARM sensor = thermistor temp2: +55.0C (high = +80.0C, hyst = +75.0C) sensor = diode Core 0: +66.0C (high = +82.0C, crit = +100.0C) Core 1: +67.0C (high = +82.0C, crit = +100.0C) Core 2: +62.0C (high = +82.0C, crit = +100.0C) Core 3: +62.0C (high = +82.0C, crit = +100.0C) bisqwit@chii:~/nes$ tail -f lunarball.log k[7518]ang[ 93]vel[255]preang[ 93]prevel[252]: p=1, f=292(ef=0), 577.5488, k[7517]ang[ 93]vel[255]preang[ 93]prevel[249]: p=1, f=293(ef=0), 573.0179, k[7515]ang[ 93]vel[255]preang[ 93]prevel[243]: p=1, f=221(ef=0), 761.1994, Ignoring: Pocketed 1 (time 221, angle 93, velo 255, preangle 93, prevelo 243) (ball at 4D,B7) k[7513]ang[ 93]vel[255]preang[ 93]prevel[237]: p=1, f=222(ef=0), 757.7706, k[7511]ang[ 93]vel[255]preang[ 93]prevel[231]: p=1, f=224(ef=0), 751.0048, k[7510]ang[ 93]vel[255]preang[ 93]prevel[228]: p=1, f=225(ef=0), 747.6669, k[7507]ang[ 93]vel[255]preang[ 93]prevel[219]: p=1, f=228(ef=0), 737.8292, k[7506]ang[ 93]vel[255]preang[ 93]prevel[216]: p=1, f=229(ef=0), 734.6072, k[7287]ang[ 91]vel[255]preang[ 91]prevel[ 39]: p=0, f=665(ef=0), 74.6126, k[7281]ang[ 91]vel[255]preang[ 91]prevel[ 21]: p=1, f=642(ef=0), 0.0000, pessimistic I'm recalculating the first shot of stage 34 just in case the one produced in the fcm was not yet a final decision.
Post subject: Update and source code
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Hpmf, hardware failures seem to be conspiring against my continuing this TAS, but it seems that the bot managed to reaffirm the first shot of board 34. It took about 48 hours to do it. Now going for shot 2. Five balls remaining. I switched to Xvfb, hopefully the bot can now run without intervention -- no dependency on ssh link to another computer's X server. That is, unless more hardware blows up. Also, I just found out that the technical description in the previous post was slightly inaccurate. The method that candidates are chosen is slightly different for each "generation" they are tested. This is a genetic algorithm after all. For the first generation, all 1-shot attempts are tried (256 angles, 80 velocities (18..255)). For the second generation, many plausible 2-shot attempts are tried, excluding those where the first shot was already found to pocket something. The first shot includes all 256 angles and 16 velocities (18..63), and the second shot includes 20 velocities (191..255) for a set of different angles such that the more the angle differs from the first shot's angle, the sparser are the actual angle values tested. This helps limit the search space into manageable numbers, while still yielding rather good results. The second generation of the first round of board 34 had about 5.4 million candidates. The actual number varies because sometimes just 1 shot pockets something (even the cue ball). In those cases, the 2-shot attempts beginning with that 1st shot can be omitted. For the second round, the 2nd generation candidate count seems to be around 8 million. Which I estimate takes about three days to go through. Luckily this bot is not written in LUA. For the rest of the generations, the best candidates are chosen from the previous generation, and about 20000 new candidates are chosen by randomly mutating those slightly. If there has been no improvement in the last 80 generations, the best so far is considered the winner and is recorded into the movie. Then begins the next round. Here is the source code of the bot, current revision. (Slightly adjusted so it can be shown as a stand-alone C++ file that compiles without errors, though it does not link.) Two alternatives are provided: http://bisqwit.iki.fi/kala/lunarballbot1.cc : With coroutines. Use this if your FCEUI_FrameAdvance() does not actually run a frame, just sets some flag. http://bisqwit.iki.fi/kala/lunarballbot2.cc : Without coroutines. Use this if your FCEUI_FrameAdvance() actually runs a frame. This can be used as basis for porting to LUA. (These URLs may work or not work, at any given time. I said I'm having hardware problems. If it doesn't work, try later again...)
Editor, Active player (296)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Status: Board 40 is about to be completed within a day or three. Apparently, turns out that the bot figured out a way to create stable black holes. I'll post a WIP after this board is completed.