Posts for Masterjun


Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
A 64 bit multiplication is harder than that. In my code, reslow and reshigh are initially 48 bit numbers, in the form: reslow --> 0x0000LLLLLLLLLLLL reshigh -> 0xHHHHHHHHHHHH0000 (note that reshigh represents the 64 bit number but itself simply contains a 48 bit value) And that's why I could just do reshigh%0x10000 turning it into: reslow --> 0x0000LLLLLLLLLLLL reshigh -> 0x00000000HHHH0000 So that adding them stays under 53 bits.
If you want 64 bit multiplication, you need to split reslow into 16bit|32bit, and reshigh into 32bit|16bit, then add the formers and the latters (correctly shifted) with carry over, and then return low32 and high32 separately (since Lua 5.1 can't represent 64 bit numbers accurately).
Language: lua

function MUL64(A,B) local reslow = A * (B%0x10000) -- 0x0000LLLLLLLLLLLL local reshigh = A * math.floor(B/0x10000) -- 0xHHHHHHHHHHHH0000 local reslow_lo = reslow%0x100000000 -- 0x00000000LLLLLLLL local reslow_hi = math.floor(reslow/0x100000000) -- 0x0000LLLL00000000 local reshigh_lo = reshigh%0x10000 -- 0x00000000HHHH0000 local reshigh_hi = math.floor(reshigh/0x10000) -- 0xHHHHHHHH00000000 local low32 = reshigh_lo*0x10000 + reslow_lo local high32 = reshigh_hi + reslow_hi high32 = high32 + math.floor(low32/0x100000000) -- add what carries over low32 = low32%0x100000000 -- 32 bit high32 = high32%0x100000000 -- 32 bit return low32,high32 end
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
There are several things wrong here: 1. The "least significant 32 bits" mean the rightmost bits. A theoretical bit.band(result,0xFFFFFFFF00000000) would give you the most significant 32 bits of a 64 bit number, not the least significant bits. 2. Despite that misunderstanding, your code does give you the least significant 32 bits of result. But: 3. In your code, result is created by multiplying two 32 bit numbers, which in BizHawk's Lua (5.1) are doubles, meaning once the result is over 2^53, you will have inaccuracies. Example: 0xFFFFFFFF*0x00200001 equals 0x200000FFDFFFFF. But when using doubles that multiplication gives you 0x200000FFE00000. Since your goal is the least significant 32 bits, it can easily be done using the mod operator (%): number % 0x100000000. The bigger problem is an accurate 32 bit multiplication. The result of that multiplication can reach 64 bits, so the 53 bits of doubles is not enough. Luckily, you can simply split one of the numbers into two 16 bit parts, giving you two 32 bit with 16 bit multiplications, where the result is only 48 bits.
Language: lua

function MUL(A,B) local reslow = A * (B%0x10000) -- A multiplied with lower 16 bits of B local reshigh = A * (math.floor(B/0x10000)%0x10000) -- A multiplied with higher 16 bits of B (shifted down) reshigh = reshigh%0x10000 -- only 16 bits can matter here if result is 32 bits return (reshigh*0x10000 + reslow)%0x100000000 -- recombine and cut off to 32 bits end
(The final recombining step adds a 32 bit and a 48 bit number, so technically requires 49 bits. But we have 53 bits so we're good.)
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
She actually counted $2200 by counting 22 of the (4*$20) bill packs, but then realized she just bought that calculator for $20, so she subtracted another $20, making the calculator say $2180. So she had 22*(4*$20) = $1760 but then bought the $20 calculator and now has $1740.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
I merged the threads. About the problem: If there's supposed to be only a single solution, it requires quite some assumptions (or I just didn't understand the question). Say there are no $20 bills at all, and 218 $10 bills -> the calculator says $2180 and she actually has $2180. Say she has 21 of (4*$20) blocks (plus some correctly counted $80), -> the calculator says $2100+$80 = $2180 and she actually has $1680+$80 = $1760.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Post subject: Re: Streaming encodes directly to Twitch.tv
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Dacicus wrote:
This means that fast-forwarding will generate the same amount of data but over a shorter time period, right, just like dumping an AVI at various emulator speeds?
Yes!
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
brunovalads wrote:
is it ok to post here my findings so everyone can benefit from it?
That would be like having a spelling contest and there is someone revealing half of the correct letters of each word. This is a contest about TASing an unknown game, so researching it is a major part of the contest. Helping with that to "benefit everyone" ruins the point of the contest.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
sshh, we're here for intimidation so everyone tries harder and the final submission turns out optimized!
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Mothrayas wrote:
Memory wrote:
Joining with ThunderAxe31, Masterjun, and Mothrayas.
Confirming.
Confirming.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
If you understood the first post, you should know that the problems run much deeper. The problem isn't the version. The problem is Windows.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
I like it, this run has a lot of elements of an entertaining TAS, so I think it would fit into Moons. I'd like to hear other opinions before judging though.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
dekutony wrote:
If this movie gets published, will it get the new game name?
Yes. [1940] SNES Trials of Mana "2 players" by praetarius3 in 3:24:49.00
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Alyosha wrote:
return 0x55555555 seems just as good as return iter = (iter >> 1) ^ (((iter & 1) - 1) & 0xedb88320); to me. Both are likely equally improbable.
These are images of initial WRAM, a white pixel is a 0, a black pixel is a 1. This movie uses a setting which makes lsnes memory look very much like BizHawk memory.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
That point has nothing to do with what I was talking about, and is off-topic in this submission thread.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Does anyone who understands the dilemma have thoughts on this?
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
As it stands now, this movie has to be rejected due to the rule:
Wiki: MovieRules wrote:
No randomized or unverified custom initial RAM state Emulator settings to initialize RAM a specific way are not allowed unless the entire RAM state as a whole is proven to be a possible starting state for the console being emulated. This also applies to fully random RAM state initialization, which is guaranteed to generate an invalid starting state the vast majority of the time for most consoles.
This rule is kind of silly. While lsnes initializes RAM by alternating 0 and 1 bits (= every byte is 0x55), BizHawk's default initial RAM state uses randomization. So every single SNES BizHawk submission has to be rejected with this rule? Almost. It is fine because it's not a setting. I personally wish this movie would have been done with the lsnes randomization seed of 0 instead of 1, since that would make it equal to BizHawk's initial state, making a good argument for acception instead of rejection. But currently, I would need to reject this because it uses an emulator setting we don't allow. Thoughts on this?
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Post subject: Streaming encodes directly to Twitch.tv
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
BizHawk has an option to use FFmpeg to encode video, and it currently lets you customize options and flags. This can be used to directly stream to Twitch.tv, without using any other software. As usual, configure your encode settings by going to File -> AVI/WAV -> Config and Record AVI/WAV. Choose FFmpeg writer. Now select [Custom], enter the custom options. For initial testing I recommend using these options (replace {STREAM_KEY} with your actual stream key):
-codec:v libx264 -pix_fmt yuv420p -f flv "rtmp://live.twitch.tv/app/{STREAM_KEY}" -f null
A resulting file won't be created, so when the window pops up asking you to save a file, just enter whatever you want (but you might need to change the automatic filetype here*). Quick explanation for the options used:
  • -codec:v libx264 | Use the libx264 codec. (Twitch requirement)
  • -pix_fmt yuv420p | Use the YUV420p pixel format. (Twitch requirement)
  • -f flv | Use the FLV file format. (Streaming recommendation)
  • "rtmp://live.twitch.tv/app/{STREAM_KEY}" | Output to Twitch. It is recommended to change live.twitch.tv to the correct server URL for your location.
  • -f null | Use the null file format for the second output (i.e. don't save a file).
Of course, you can (and should) add other options for optimal streaming. It is important to mention that this will stream the encode output, not the real time emulator: If you fast-forward, the stream will keep playing in regular console framerate. And if you pause the emulator or simply can't reach the console framerate, the stream will catch up and then buffer or drop the connection. Useful Links: Twitch.tv Broadcast Requirements Twitch.tv Broadcast Guidelines Twitch.tv Server Choices FFmpeg Streaming Guide FFmpeg Full Documentation
* We trick the emulator into outputting two things, because we need to change the filename to a URL. We specifiy two formats (two -f options), and it thinks the whole part after the first -f is the file extension. Windows doesn't allow " or / characters in filenames, so you get an error.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Alyosha wrote:
Is this still the case for this submission?:
Masterjun wrote:
An important part to note for this run is the fact that it executes controller registers while they are being updated. This is known to not be emulated in a correct way on emulator. This gives this run a high chance of not working on console at all. However, leading the game code to the controller registers is done perfectly fine, so while these exact input sequences probably won't work on console, it's likely there are indeed some inputs which work. The run wouldn't look very different, so we can safely say that this isn't a problem.
Seems kind of hand-wavy to me.
Yes it's still the case. While it's unlikely to work on console, we can't say it's impossible. We can only discourage it by saying that if there is a submission that doesn't rely on this, we will obsolete this run, even if the new run is longer.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Malleoz wrote:
It seems like I'm just colliding with the wall, but I'm actually triggering the loading zone in doing so.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Probably more important is how making a reasonable separation from this run and the previous game end glitch is impossible. This exploit having anything to do with the DPCM bug was an assumption. There is no way to say which subroutines in the code were made to avoid the hardware bug. It's fine to theorize how "lumping" all these kinds of runs together would create difficult situations, but it should be mentioned that it's simply impossible.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
There is the game page http://tasvideos.org/Game/nes-super-mario-bros-3.html showing information about the game, and also all current publications and more. Alternatively, on any of SMB3 publication pages, click the "History of this entry" tab. There, every line starting with "Added" indicates a separate branch. The level of indentation shows order of obsoletion (in case of one movie obsoleting multiple others).
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
If you look at the obsoletion chain of Morimoto's original SMB3 run you see that it currently has been "reduced" to a certain other incredible movie. Even the publication description talks about it. As a sidenote, 4 of the 5 levels in the obsoleted "game end glitch" run are almost a copy of the "warps" run, and the last level wasn't completed. 20 seconds of "content" or "gameplay" has been lost. As someone who is co-author of a lot of these short game end glitch runs, and also as a judge, I want to mention how much potential there still is in entertaining TASes. As a TASer, I try to cover as many different ideas as I can. From fast-paced superhuman runs to fast-paced micro-optimization runs to completely new ideas to quadrupling gameplay. There are some speed-oriented ideas which aren't entertaining enough, and some entertainment ideas which can't be submitted here. A collection of TASes which pleases everyone is impossible. For runs that aim to spend less and less time inside the game, being disappointed is to be expected. But to call the situation a disgrace might be going too far. There are amazing TASes waiting to be made. There are amazing TASes waiting to be watched. Just find them.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
CrazyTerabyte wrote:
MUGG wrote:
For my love2d project I need a function that checks if a bit is set in a hex number. It needs to be a pure Lua implementation (Lua 5.1). The lua documentation wasn't much help so far. (...)
There is a simple solution, using bitwise arithmetic
For reference, Lua 5.1 doesn't have bitwise operators (they were implemented in Lua 5.3). So the two functions MUGG posted are the workaround for that. At the end it's the same solution.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
I played back the movie but it seems to be missing a final input or something. It beats the final boss and then gets to the final dialogue in the throne room. There it ends input after answering a question, while there is still some dialogue to go through. Unlike the submitted movie file, your encode includes the full credits, so did you maybe upload the wrong file?
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
For reference, dwangoAC confirmed this run works on console. Thanks for testing! :D (Twitch Clip in case the VOD is deleted)
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
Masterjun
He/Him
Experienced Forum User, Published Author, Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
From what I understand in your explanation, setup 1 misses the Hall of Fame screen, setup 2 misses the credits, and setup 3 has everything. We can say for sure that setup 2 is unlikely to be accepted. It simply doesn't finish the end sequence. (From your explanation it also seems like the viewer couldn't tell it was completed.) We can also say that setup 3 is likely to be accepted, since it's the most complete ending. Setup 1 is probably a bit more difficult. You said "the game is technically not beaten", by which I assume you meant it skips the Hallf of Fame and the save. Yet it does play the credits sequence all the way. If it's reasonable and not too difficult, I think your best chance would be to submit setup 1 but have a movie file with setup 3 ready in case the viewer dislike the missing components of the end. If you simply want to be safe, you can choose setup 3. In my personal opinion, having made several game end glitch runs myself: If you already have a lot of control over the end, you might as well spend those few seconds making sure it's as complete as possible.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)