Posts for Randil

Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
The reason why the mosaics aren't bigger are frankly because matlab can't handle any bigger matrices. Any bigger and matlab simply tells you that it's "out of memory". On the other hand, matlab could be used to find what screenshots that make up the mosaic, and then another program could be used to put them together, but I don't know any good programs for this (I have tried ImageMagick, but it also has some problems with very large mosaics.)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Here's Mega Man 8 again with Tub's idea implemented: http://img40.imageshack.us/img40/4118/mosaic7346258239.png Comparing this to the old version, I think it looks better, but I'm open for debate. And here you go, Brandon. (I think this one turned out really nice - you can even clearly read the digits)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Okay, here's a start (I will probably add more later on, I gotta eat dinner now). Note that these are approximate, and can differ depending on how much text there is at the screen transition, etc.
Action                Frames
Picking up an item    37
Screen transition     110
Page change           28 + 1 per item in list
Throwing away an item 41 + 1 per item in list
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Nice find, this saved 118 frames (1.97 sec). :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Games with difficult to decipher RNG (i.e. when RNG is not stored in a single RAM address but is a function of several RAM addresses).
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Tub wrote:
You will get much better results if you don't just compare the average color of "mosaic window" & tile screenshot, but consider image structure. A mosaic window that looks like
######
#####.
####..
###...
##....
#.....
is better approximated by a screenshot with diagonal features than something that averages to gray. You can simply scale the screenshots to match the resolution of the mosaic window, then compare differences for each pixel. Sum up the errors (or squared errors) of each pixel and pick the best tile. Since this is computationally expensive, it may be wise to use your averaging method as a first step to filter out any screenshots that are way off, then use pixel-perfect matching on the best fits to determine the winner. Further improvements can be made by disallowing repeating screenshots. That's easy to code, but obviously needs a larger library of screenshots to work. (of course there are plenty of pre-made programs that can already do this, but where's the fun in that? ;))
I have a version of my script that (kinda) works like this, that compares pixel by pixel, but it's not perfect. I will have to try this too. I just realized I now have a whole bunch of ideas to test. Thanks for all the help. :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Derakon wrote:
Are you weighting R, G, and B equally? If I recall correctly human vision gives more weight to G than the other two so your distance algorithm should have custom weights for each channel. This page has some more information (scroll down to the "RGB -> XYZ conversion" section). I don't think it makes much difference, but it's interesting to know about.
Very interesting, I didn't know about this. I'll give it a try and see how it works out.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Yeah, you're pretty much spot on. The script starts by calculating the average color value of all the images that will make up the mosaic. Then it loops through all the "mosaic windows" in the image you want to make a mosaic of, and calculate that average color. It then finds the picture in your database with the shortest "distance" to the average color of this window. The distance is measured by: d=abs(c(1)-d(1)) + abs(c(2)-d(2)) + abs(c(3)-d(3)) where c and d are the vectors with the RGB values. You can of course play around with other distance functions, but I found this one to work well. That's pretty much it. Here is the code (I tried to comment it as good as I could) http://pastebin.com/8MCGmzbY
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
:) Here are some more, including N64 and PSX (I tried to choose colorful screenshots): Mischief Makers Super Mario Bros Mega Man 8 Regarding what you said Derakon, I think you are right. It shouldn't be too hard to modify the code to randomly pick, say, 1 of the 3 best matches. I might give that a try.
Post subject: Mosaics of publication screenshots
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I have made a few mosaic images of publication screenshots, using all images of all publication screenshots. I thought you might be interested. Here are a few: (Arcade) The Simpsons Donkey Kong Country 2 Super Mario World Gunstar Heroes These were made by a matlab program I wrote. Any thoughts or ideas?
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Brandon wrote:
Also, Randil, can you provide that script you made? The link is broken in the old topic.
Of course! Here you are:
Language: lua

xnew=0 ynew=0 lost=0 while true do mover=memory.readbyte(0x512) xpos1=memory.readbyte(0x501)+256*memory.readbyte(0x502) ypos1=memory.readbyte(0x503) if xpos1==xnew and ypos1==ynew and mover==0 then lost=lost+1 end xnew=xpos1 ynew=ypos1 gui.text(10,10,"Lost frames: " .. lost) FCEU.frameadvance() end
(I don't know why I didn't post the script like this in the first place) The script simply checks if you are constantly on the move. If you for any frame stand still (both in terms of X and Y position), the "lost frames" counter will increase. Good luck!
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
There is already thread for this game here: http://tasvideos.org/forum/viewtopic.php?t=9604 Mysterypea made some good progress, and has finished up to level 33, though he says he has put it on hold for now. Maybe you want to get in touch with him. I messed around with this game a bit too some time ago, so I would be interested in seeing this game TASed.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
All actions always take 1 charge. You die when you charge hits 0. If both your torches are lit, both of them will drain a charge when you perform an action. As for rooms that drain no charge, I wrote a lua script that looped through all the rooms in the game, testing which rooms drained no charges. There are a total of 5 such rooms in the game, namely:
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Cybermercs!!! Yes, that's it! Thank you, now it has finally been resolved. :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Okay, now I have some results: I have TASed your new route now, and it turned out to be slightly slower than the published TAS, but it was really close. The route in the published TAS is roughly 0.6 seconds faster than your route. I have uploaded the input file here (I stopped at the ferry-mean, since the two runs will look almost identical after that part). I can upload the run to youtube if you would prefer that. Please take a look at the run and tell me if I understood your route correctly. EDIT: Hold on, I missed that at this point I have used the orb in your route but not in the published TAS. I better go through to the end to get a good comparison... EDIT2: Okay, it turns out that your route is slightly faster (by 17 frames = 0.28s), and this includes me getting awful luck on the lightnings. Taking into accound the bad luck I had on your route compared to the published TAS, I would say that your route is roughly 0.5 seconds faster than the published run. New input file: http://dehacked.2y.net/microstorage.php/info/1504859591/shadowgate_new_route.fm2
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
It is also worth noting that removing the light source(s) from such a room (for example, taking all the torches) will not remove this property. I was aware of this when I made the last TAS, but couldn't find any use for it: you only visit these rooms briefly, and you don't save that many charges in the long run. It might be possible to save time by doing things like equipping items in these rooms, but I doubt it can save time over equipping them when the cursor and inventory list is in a good position. I fear this is just a strange quirk in the game, but I hope someone proves me wrong! :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
ZenicReverie wrote:
I don't usually use emulators, and I'm not familiar with any of the TASing tools. I really appreciate your help in investigating this. theseawolf1 mentioned in the SDA thread that torches have a 60 action timer (lighting a torch will drain 1 action from the torch you just lit though), but only certain things you do use up an action. That should help you in testing.
Yeah, that's basically how torches work. I have RAM addresses for how many torch charges are left, and I keep an eye on them while testing things. To make matters more confusing, there are rooms where torch charges aren't drained, no matter what you do in the room - for example the book room with the special torch. I haven't mapped out exactly what rooms don't drain torch charges (there aren't many, but I seem to remember that there are a few more), maybe that could be useful.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I'm working on analyzing your new route, but it takes longer than I thought it would. I'm also writing a program that compares different inventory orders without me having to manually compare them. I'll probably have some results by the end of this week. On another note, do you need any RAM addresses? I don't know how much testing you are doing on an emulator and how much you are doing on console.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I strongly support this idea.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I did some researching a while back on the probability for the sphinx to ask for the different items. Here are the percentages:
Broom	  15,45138889
Skull	  13,88888889
Map	    18,75
Mirror	 15,79861111
Bellow	 15,625
Horseshoe 20,48611111
I don't know if this helps much. The most likely question is the horseshoe, but all of them are quite probable. Another thing that is random (I don't know if you know this) is the number of lightnings the warlock summons. This accounts for several seconds, so it's quite a lot of time that depends on this. This random event works just like the sphinx - it's all frame based, so for a real time speedrun it all depends on how lucky you are.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Very interesting, I'll definitely take a look at this when I get home from work. I'm always glad someone else is showing interest in these games. :) I know of some small improvements to the published TAS (at least theoretical, a lot depends on good luck when talking to the sphinx).
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Awesome, I'm glad someone tackled this game. I look forward to the submission.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Guess what city I'm in (probably not very hard)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Just bumping in to say that there is a discussion thread for NES Castlequest here: http://tasvideos.org/forum/viewtopic.php?t=3052
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
That integral can be split into which we can split further into (I forgot to add dv in the integrals, so assume that they are there) All these three integrals are now easily solvable, and the solution is (plus a constant c if you like). This can be expressed in x by backtracking (using v=(coth u)^(2/3) and x = (sinh u)^2/3) but the expression would look so tangled up I will leave it expressed in v if that's ok.