Posts for Randil

Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I did some quite extensive analysis of how the game physics works for this game some months ago. Thanks to this I was able to improve: *The first room by 9 frames. *The second room by 5 frames. When you move diagonally, you accelerate faster than when you go horizontally, up until your X speed is 26. Here's the movie file. I also made comments on how X movement works, hopefully you can get something out of them.
X movement:

[x] means the value of RAM address x.
:= means "is defined as"

Useful RAM addresses:
[0390] = X pixel speed := x1
[0380] = X subpixel speed := x2

X speed = xs:= 256*x1+x2

[0031] = direction.
[0031] = 2 if moving right
[0031] = 1 if moving left

Assuming you're standing still and start holding down right.
When you start accelerating (i.e. The first frame xs>0) depends on 
[0400] = start accelerator := a1

If a1>=192, you start accelerating immediately
In practice, a1 is either 144 or 208.
It is set to 144 if you stop from going left,  i e when [0031] goes from 2 to 0.
It is set to 208 if you've recently moved right,  i e when [0031] goes from 1 to 0.

Another important RAM address is [0036]. It is your X acceleration.
[0038] is an in game timer. [0036] increases only when [0038] is odd.

Assume you have X speed S1 on frame F and you can accelerate. Assume [0036]=A1 and [0038]=T.
Assume that your Y speed on frame F is Sy. We want the X speed S2 on frame F+1.
Let d1 be your direction on frame F, and d2 your direction on frame F+1. direction = [0031]
Let A2 be the value of [0036] on frame F+1. d1 is your direction on frame F, and d2 on frame F+1.
The following pseudo-code will give the answer:

You press right+B on frame F:

Set T1=mod(T,2)

If T1==1 then A2=A1 end
If S1<512 and T1==0 and Sy<A1 and A1<31>A1 and S1>=338 and A1>=1 then A2=A1-1 end

S2=MIN(512,S1+A2)

You press right+down+B on frame F:

Set T1=mod(T,2)

If T1==1 then A2=A1
elseif T1==0 and S1<=361 and d1==d2 then A2=A1+2
else A2=A1+1 end

S2=MIN(362,S1+A2)
I want to improve the published run sometime in the future, but I have a lot of other projects going on right now so this will have to wait. I welcome anyone else who wants to try this!
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
ZenicReverie wrote:
Quick thought though... using a stone on the sling just before we page flip to the scepter. This would put the orb on the second page after we use the blade. Not sure if it would save any significant time.
After having used the blade, we will still need to switch pages the same number of times until we reach the staff, so it won't save many frames (it will probably save a few due to shorter menu movement, but not a lot), and the extra dialogue will, as you said, negate this. My guess is that it will be slightly under a second slower, so it might be worth it in the speedrun if it's more convenient and less prone to mistakes.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Hello again! I'm glad to hear you're getting such good times with this route.
ZenicReverie wrote:
I've been opening the door in the Sphere room from the mini-map when I first enter instead of waiting until after I take the Sphere. Does this help any?
This won't save any time since you would still move the cursor to the very same position on the photo when entering the dragon room. Of course, since opening the door on the minimap isn't out of the way, doing it this way should be exactly as fast.
ZenicReverie wrote:
Key 4 is on page 3, does it make sense to use this key until after getting the talisman? I've been doing it to save a charge on the torch since it's such a tight point, and any actions I could potentially push off until later seem to be worth it.
I did a detailed comparison, and doing it this way is 11 frames (0.18 sec) slower than the way it's done in the TAS, so it's a very close call.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
My desktop. The background is a sobel-filtered image of a photo I took. A lot of bonus point if you can identify the city!
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Nice improvement, I like the new boss strategies. Yes vote!
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I'll give number 1 a shot. Call the three nodes of the triangle P1, P2 and P3. Let D(x,y) be the distance (using our distance function in this ultra metric) between points x and y. Consider two paths from P1 to P2: path 1, the straight line P1-P2, and path 2, the path that goes through P3, i.e. P1-P3-P2. Path 2 passes through the middle node P3, which corresponds to the point y in your expression D(x,z)<=Max{D(x,y), D(y,z)}. Now, define d1=D(P1,P2) d2=D(P1,P3) d3=D(P2,P3) These are the sides of the triangle. Since we are in an ultra metric, we now get d2>=d1 OR d3>=d1 (1) which represents that one of the straight lines in path 2 must be bigger than the straight line in path 1. We can apply the same strategy for the other two combinations, ending up with d1>=d2 OR d3>=d2 (2) and d1>=d3 OR d2>=d3 (3) This means that we can't have a side of the triangle that is strictly bigger than the other two, because if we have, one of (1), (2), or (3) won't be satisfied: for example, if d3 is strictly biggest, condition (3) breaks. Thus at least two sides of the triangle must be equal, making it isosceles. Is this solution correct? EDIT: Argh, p4wn3r solved it while I was writing this post. Oh well...
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
ZenicReverie wrote:
You mentioned before that taking the water after the flute and ring would help, but be bad for the RNG for the lightnings. Is this still the case? Will it always be the case?
Taking the water after the flute is faster since it saves a page scroll in the hell hound room, it. The reason it causes the bad RNG is that during this page scroll, the RNG stands still, and taking the water after the flute takes a few more "playing time", i.e. time that the RNG timer ticks - basically, although taking the water after the flute takes less frames, it takes more "RNG frames" so to say, so once I reach the warlock those frames where there are only 3 lightnings have already passed. EDIT: If an improvement is found earlier in the run, it might be the case that taking the water after the flute will be faster, but as the RNG is in the TAS right now, it is not.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I thought it safe to submit the run by now. Go vote! :) http://tasvideos.org/forum/viewtopic.php?p=276183#276183
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I added *NES Indiana Jones Last Crusade: http://speeddemosarchive.com/IndianaJonesLastCrusade.html to the Wiki. I hope it's okay. I'll look around if I can find any more games to add to the list.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
ZenicReverie wrote:
when hitting the stone, go down twice and on to the screen instead of going up three times and on to the screen ... after taking the last stone, going down to the menu and back on to the screen.
Thanks, these two combined saved 11 frames.
ZenicReverie wrote:
starting in the Epor room use cloak on self, use torch=1, use Epor, take torch=1, take broom, use hammer, use key 3... this puts the torch on page 2 for use right before the broom or arrow depending on how far using the torch early can carry you.
Very good idea, looking back at this section makes me think that my way of doing it was quite bad. I combined this with learning epor later, after having manually switched to the spells page, saving me some page scrolling. I got to use the torch right before the broom, which was very convenient. All this saved 79 frames! Amazing!
ZenicReverie wrote:
why do you go right twice when you use the torch=2? is this to burn the RNG?
This is no longer included due to the above improvement, but this was just a simple mistake from my part. All in all 90 frames saved (1892 frames, 31.53 sec, faster than published run): http://dehacked.2y.net/microstorage.php/info/658488392/shadowgate_glasses_run_v2c.fm2
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Yep, I intend to revisit this game too. So far I only know of a 1 frame improvement, but hopefully there are more frames hiding. But first I'll finish Shadowgate, and then Deja Vu before jumping to this game. :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I have a (short) WIP of this game here. Maybe I'll continue this someday, it was pretty fun to TAS.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Sonikkustar wrote:
I also found a long jump trick, altough this was probably not what Randil was expecting. http://dehacked.2y.net/microstorage.php/info/1555887363/st2-long%20jump2.fm2 I have yet to figure out how this one works, so it may not be useful for a while.
I think it has to do with that you get hit by the enemy just before you are to go down into the water. It also seems to have to do with the angle at which you hit the enemy (there might be suxpixels involved too). You can also start moving around on the water tile after you get hit by that enemy. Interesting.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Since the Shadowgate TAS is drawing close to an end (at least it seems so right now), I've started looking a bit at Deja Vu again. I have improved the published run by 25 frames, 20 frames faster than the movie in the previous post. I know 25 frames isn't a whole lot, but it shows that the published run can at least be improved. Those 25 frames come from many minor improvements. Input file: http://dehacked.2y.net/microstorage.php/info/1924068171/deja_vu_tas_2011_randil.fm2 I have looked at the possibility of a "Glasses trick" in this game, similiar to Shadowgate (i.e. the existence of an item that you can pick up over and over again), and wrote a lua script that tested all items in the game, but to no luck (I did this for Uninvited too, but no luck there either). If you have any ideas, throw them out here!
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
BoursinBurger wrote:
Nice job taking advantage of the last room not using torch charges. It makes the TAS even more hilarious when the secret is revealed. Ooh, big nasty behemoth. Wait, aren't I missing something? *rifles through inventory* Hold on, I know I've got something in here. *warlock sits there with his arms up in the air* Ha-ha! I have cobbled together a mystic Staff of Ages from 56 pairs of glasses! Take, that behemoth! *behemoth screams in disbelief* Congratulations on breaking Shadowgate.
Thanks, that summary made me smile. :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I'm not sure, but if you upload your movie (you can send it to me in a PM if you want) I can take a look.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Brandon wrote:
That said, I'm not sure how the long jump glitch works. Could you explain Randil? I want to use that whenever possible as to improve your run. I'll try to continue this tomorrow. Goodnight.
The way the trick works is that if you press against on of the corners of a block, the game will give you a slight boost (a few pixels), as to move around the corner. In the movie I provided, by pressing up against that block, the game pushes me slightly to the right, as to easier move around that corner. As soon as you have received this boost, start moving in your original direction to finish the jump. This means that this trick is only possible when there is a block with a corner close by that you can press against. I hope that made sense.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
First of all, here are my RAM addresses:
0032 X|pixel
7093 X|subpixel
0033 X|big
154 Room
0034 Y|pixel
7093 Y|subpixel
0035 Y|big
003B Height
c5 en|x
cd en|y
333 force|field|hp
331 Boss|HP
23 Frame|rule
x1F Input|RNG
c3 En1|X
cf En1|Y
42 Throw1
43 Throw2
00C5 Boss|X
00CB Boss|Y
33D After|shot|move
x3B7 Boss|stop|80
47d extra|shot
It turned out I have several lua scripts for this game. Here's one that displays your X and Y position with all decimals:
Language: lua

while true do local function displayer() xbig=memory.readbyte(0x033) xpix=memory.readbyte(0x032) ybig=memory.readbyte(0x035) ypix=memory.readbyte(0x034) xpos=256*xbig+xpix ypos=256*ybig+ypix x1=(xpos-8)/16 y1=(ypos-8)/16 gui.text(10,10,"X pos: " .. x1) gui.text(10,18,"Y pos: " .. y1) end gui.register(displayer) FCEU.frameadvance() end
This handy script will tell you on what frame you reach a new room (very convenient as you won't have to check it yourself when comparing strategies):
Language: lua

room1=memory.readbyte(0x154) while true do room=memory.readbyte(0x154) mf=movie.framecount() if room~=room1 then gui.text(10,10,mf) end room1=room FCEU.frameadvance() end
Here's a text bot that presses A during text sequences. I seem to remember it worked perfectly, but you might want to double check. Just run the script during a text sequence and it will take care of the rest.
Language: lua

while true do key1={} text=memory.readbyte(0x531) textx=memory.readbyte(0x506) c=7 if textx>36 then key1.A=1 end joypad.set(1,key1) FCEU.frameadvance() end
In this game, randomness (in particular enemy movement and behaviour) is affected by your input. I also have a script that brute forces a random event until you get a desirable outcome, but that code looks a bit messy. Let me know if you come across a situation where you think you need this. Phew, I think that's it. I sure have a lot of lua scripts.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I'm not sure which thread to respond in, so I hope it's okay that I post here. I worked on an improvement to this some time ago. After about 19 minutes in I was about 20 seconds ahead. I'm not sure if I will continue it, it won't be for some time anyway, so I say go ahead if anyone else wants to take a shot at this. My old WIP, made before I found the jump trick explained below, so this WIP is improvable: http://dehacked.2y.net/microstorage.php/info/1358420029/Startropics%202%20-%20Zoda%27s%20Revenge%20%28U%29-0.fm2 Two interesting tricks: Jumping across two tiles wide holes by pushing against a wall: http://dehacked.2y.net/microstorage.php/info/878572012/startropics2_jump_trick.fm2 Turning into a pig: http://dehacked.2y.net/microstorage.php/info/1126976668/startropics2_turn_into_pig.fm2
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Good idea. I might take a day or two next week to sort through all my unfinished WIPs. Expect a lot of movies, I have a reputation to consider. :)
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Aqfaq wrote:
Randil wrote:
Many items make the game crash when you interact with them.
Maybe some of those items cause a room-specific effect, which crashes the game because you are not in the correct room?
Hmm, yeah, you might have a point. I'll check that out. EDIT: I'm kinda in a hurry, but I can inform you that I managed to improve the current run by 19.2 seconds with this new route: http://dehacked.2y.net/microstorage.php/info/1744840148/shadowgate_glasses_run_v2.fm2 That means that this run is 27.6 seconds faster than the published run. The movie file above ends after using the staff on the behemoth, but the rest of the input is identical to all other versions. There are probably more potential improvements hiding in this run, since it is only the first optimized version of this new route, so expect an even bigger improvement before I submit anything. :) Note: There is no luck involved in this new route (except for the lightnings at the end of the game), so it's also a very safe route for the console speedrun. EDIT: 2.42 seconds saved by taking glasses to scroll to the end of the item list at the end of the run. This is now 1802 frames, 30.03 seconds, faster than the published run. Nice! http://dehacked.2y.net/microstorage.php/info/1743735795/shadowgate_glasses_run_v2b.fm2 I also tried to edit in taking water after flute and ring, since this would save some time in the horn room, but this caused me to have really bad luck on the lightning scene for some reason...
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Sorry for double posting, but I have quite big news: I managed to beat the game in an entirely different way, using the glasses trick to get the staff. This is why I pick up more stones, since this sets RAM address 04DD to the Staff value, giving me access to it. This means that I did no backtracking, allowing me to skip Humana, Sword, Bottle2, Wand, and more. The downside is of course that it takes some time to perform the glasses trick. Still, I think it will save time. I played this in real time, just to check if it works, which it luckily did. Here's the movie file: http://dehacked.2y.net/microstorage.php/info/1002746702/shadowgate_glasses_run.fm2 Suggestions and ideas are as always welcome! EDIT: Slightly faster version here, where I figured out that it's faster to reach the staff at the end of the run by taking glasses again: http://dehacked.2y.net/microstorage.php/info/1962722347/shadowgate_glasses_run_v1b.fm2 I will work on an optimized version of this route. It will be very interesting to see if it saves any time.
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Wow, and this guy has made a lot of other TASes as well. I have to check this out...
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
Yeah, I've looked into this, so I have a good idea on what can happen and what items you can get. You can also get bottle 5, flute, cloak, and bag 3 (including all the coins). And as you said, your inventory list will eventually start filling up with game state addresses (that determine what doors are open and such), and this means that you can also overwrite these values by picking up more and more glasses. I have also encountered that all sprites suddenly disappear from screen. I don't know exactly how this is triggered though. The game also crashes once you start overwriting the RNG addresses. I have not actually been able to use this trick for something that can save time... EDIT: I am making a list of all 256 possible item values, and what happens when you interact with them. So far I've found some interesting things, such as items acting as the oil (you can discard items into this item), items teleporting you just like the sphinx, and other random effects. Many items make the game crash when you interact with them. So far no effect is anything that could be useful in the TAS or speedrun. The best I've come is to get the orb this way, which is nice, but it's still faster to get it normally. Anyway, I'm still looking into this, maybe I will eventually find something useful... EDIT2: Oooh, I found out how to get the staff this way! Maybe that can save time...
Experienced Forum User, Published Author, Skilled player (1890)
Joined: 4/20/2005
Posts: 2160
Location: Norrköping, Sweden
I have tried displacing the waiting frames to earlier parts of the run, but with no success of waiting shorter. It seems that no matter where I choose to wait, it won't make the RNG go faster. I have a few things I want to check about the glasses trick, but other than that, I feel satisfied with the current product. ZenicReverie, do you have any more improvement ideas?