Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Here is something I have been working on for the most recent few months. Link to video It is just a programming hobby project. Sure, it can run TASes, but it's just a hobby project. And it's only 940 lines of source code. Examples of it running TASes: ― Rockman TAS by Bisqwit (tasvideos movie 726)Metroid TAS by Lord Tom (tasvideos movie 1144)Part 2/2 which demonstrates this particular revision of the emulator. I only showcase a maximum of 15 minutes long TASes because that's what my account is capped to. But it does sync with e.g. Mega Man 2 by Shinryuu (24 minutes)... It does not have savestates yet. And in fact, it does not even have an UI yet. It reads joypad input from a Famtasia movie file; it does not react to any other inputs. But due to its architecture, adding savestates would be trivial. It does not have many features; for example, iNES mapper 4 support is completely missing so far (which means e.g. SMB3 won't run), but those that are implemented are fairly accurate. It scores fewer failures in Blargg's tests than FCEUX does, for those parts that are implemented (mostly CPU & PPU related tests). The RAM & waveform displays shown on these videos are non-realtime add-ons; they are not part of the 940-line source code.
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
A few months? Look to me like you wrote it in 15 minutes! You hacked joe to make Mario run across the top?
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Nach wrote:
A few months? Look to me like you wrote it in 15 minutes!
And The Matrix only took 136 minutes to produce! Right? I did not use Joe. It's an editor I created myself.
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
Bisqwit wrote:
Nach wrote:
A few months? Look to me like you wrote it in 15 minutes!
And The Matrix only took 136 minutes to produce! Right?
But that's output, this is source code.
Bisqwit wrote:
I did not use Joe. It's an editor I created myself.
It's a very nice wheel. The Mario running across anything and everything is a nice touch. Gotta stick Mario on my tires so he can run across the ground too.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
Was that the real speed you type on?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
feos wrote:
Was that the real speed you type on?
Of course! He's Bisqwit after all.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
I THINK slower.
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Emulator Coder
Joined: 3/9/2004
Posts: 4588
Location: In his lab studying psychology to find new ways to torture TASers and forumers
feos wrote:
I THINK slower.
Probably not. You're subconsciously thinking about so much more than you realize.
Warning: Opinions expressed by Nach or others in this post do not necessarily reflect the views, opinions, or position of Nach himself on the matter(s) being discussed therein.
Joined: 6/14/2004
Posts: 646
Clearly he TASed his code input, recording his keystrokes and playing it back without any delays.
I like my "thank you"s in monetary form.
Joined: 10/20/2006
Posts: 1248
The opcode decoding matrix looks like magic to me. I don't really get it at all. Not that I get much of the rest of what's going on in this video. ;p "Suddenly the music changes"
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
Nach wrote:
Bisqwit wrote:
Nach wrote:
A few months? Look to me like you wrote it in 15 minutes!
And The Matrix only took 136 minutes to produce! Right?
But that's output, this is source code.
Oh believe me, there was a lot of source code to this source code.
Kuwaga wrote:
"Suddenly the music changes"
Different video.
Kennyman666 wrote:
Hey Bisqwit where does the music in your coding video come from? Because it's pretty awesome music.
Jinguji detective series. It's a Japanese-only Famicom game series, four installments total. I intentionally chose, from NES/FC games, a soundtrack that is both a favourite of mine and relatively unknown to most of the audience.
NrgSpoon wrote:
Clearly he TASed his code input, recording his keystrokes and playing it back without any delays.
I call these tool-assisted education videos for not without a reason. The clock was not hacked.
<Nach> as Ilari said, it reads Famtasia format, because it's simple <scrimpy> what about .fm2, actually? <Ilari> IIRC, .fmv is much simpler than .fcm or .fm2.
I converted FM2 files into FMV, because of the reason stated by Ilari.
Kuwaga wrote:
The opcode decoding matrix looks like magic to me. I don't really get it at all.
I am pleased that you liked it. I figured out the minimal list of C++ expressions that can be used to implement all NES opcodes. The matrix simply chooses, using the "op" template parameter, which expressions from the list to evaluate. For example, opcode $06, "asl zp" is implemented as follows:
| addr = RB(PC++);
| t &= RB(addr+d);
  P.C = t & 0x80; 
  t = (t << 1) | (sb << 0);
  WB(addr+d, t); 
| tick();
| P.N = t & 0x80;
| P.Z = u8(t) == 0;
and opcode $21, "and zx", is implemented as follows:
| addr = RB(PC++);
  d = X;
  addr=u8(addr+d); d=0; tick();
  addr=RB(c=addr); addr+=256*RB(wrap(c,c+1));
| t &= A;
  c = t; t = 0xFF;
| t &= RB(addr+d);
| t = c & t;
  A = t;
| P.N = t & 0x80;
| P.Z = u8(t) == 0;
Opcode $D8, "cld":
  t &= P.raw|pbits; c = t;
| tick();
  t = 1;
  t <<= 1;
  t <<= 2;
  t = u8(~t);
| t = c & t;
  P.raw = t & ~0x30;
Opcode $A8, "tay":
| t &= A;
| tick();
  Y = t;
| P.N = t & 0x80;  
| P.Z = u8(t) == 0;
You can spot a number of similarities between these four instructions (marked with "|"). The matrix determines which lines to execute for each opcode. The matrix is evaluated at compile-time, so the code ends up being surprisingly efficient. The two latter opcodes, for example, end up as the following assembler code (inlining selectively disabled for brevity):
Ins<0xD8>:
	push rbx
	 movzx ebx, byte CPU_P
	 call CPU_tick
	 or ebx, 0x30
	 and ebx, ~0x38
	 mov byte CPU_P, bl
	pop rbx
	ret
Ins<0xA8>:
	push rbx
	 mov bl, byte CPU_A
	 call CPU_tick
	 mov edi, 0x80
	 and edi, ebx
	 mov byte CPU_Y, bl
	 call some_regbit_function
	 mov al, byte CPU_P
	 xor edx, edx
	 test bl, bl
	pop rbx
	sete dl
	add edx, edx
	and eax, ~2
	or eax, edx
	mov byte CPU_P, al
	ret
The compiler generates a distinct function for each of these 256+3 opcodes. Pointers to those functions are placed in the function table within Op(). Surprisingly though, runtime evaluation ended up not being much slower (at least when the matrix was expressed in a simpler, although more verbose format.) Evaluating the matrix at runtime trades code straightforwardness for cache locality, but the real bottleneck in speed is in the synchronous nature of the emulator (tick() calls). As a side-note: I uploaded this video in 4240x2400 resolution. The highest YouTube currently provides is 480p. On "my videos" it says "Published 0%". On the upload form it says "your video will be live in a moment" and "Processing 99% — Finishing processing...". Anyone know whether I can expect the 720p/1080p/Original versions to appear, like ever?
nfq
Player (94)
Joined: 5/10/2005
Posts: 1204
Bisqwit wrote:
Anyone know whether I can expect the 720p/1080p/Original versions to appear, like ever?
It has the original version there already. I don't know anything about programming, but with your skills, wouldn't it be easy to make the PS2 TAS emulator so that it doesn't desync?
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
nfq wrote:
I don't know anything about programming, but with your skills, wouldn't it be easy to make the PS2 TAS emulator so that it doesn't desync?
Yeah, the NES, the PlayStation2... Completely equivalent platforms.
Site Admin, Skilled player (1251)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
nfq wrote:
I don't know anything about programming, but with your skills, wouldn't it be easy to make the PS2 TAS emulator so that it doesn't desync?
If a Higher Voice tells him to, sure. Edit: Or did you ask about the possibility itself, regardless Bisqwit?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
nfq wrote:
I don't know anything about programming, but with your skills, wouldn't it be easy to make the PS2 TAS emulator so that it doesn't desync?
At one point -- three years ago -- I actually began creating a PSX emulator (not PS2) from scratch, but I eventually stopped. Lack of unit tests (or the knowledge how to make them, for the PSX platform) was probably the greatest reason. It began to feel like I have to implement the entire emulator before I can even begin testing it. I think I implemented all of CPU, most of COP2 (GTE), and some of COP0, before giving up. For reference, I used documentation from such sources like psx.rules.org and the PCSX source code. For PS2 I would presume the situation is even worse.
nfq wrote:
It has the original version there already.
So it seems. It did take some time.
Joined: 11/22/2004
Posts: 1468
Location: Rotterdam, The Netherlands
Bisqwit wrote:
As a side-note: I uploaded this video in 4240x2400 resolution. The highest YouTube currently provides is 480p. On "my videos" it says "Published 0%". On the upload form it says "your video will be live in a moment" and "Processing 99% — Finishing processing...". Anyone know whether I can expect the 720p/1080p/Original versions to appear, like ever?
Unfortunately, it's extremely random. In some cases they never show up, although I've only experienced that with videos that were several hours long. You could consider reducing the size a bit, since 4240x2400 is well beyond the native resolution of the vast majority of monitors. edit: I see that I'm late.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
1080p version shows graphical corruption at 02:00 and beyond :/
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
creaothceann wrote:
1080p version shows graphical corruption at 02:00 and beyond :/
The corruption resolves at 02:46. More corruption is seen at 07:31. But yes, it is not the first time I see such failures at YouTube's re-encoding process. Off-topic: I seem to lack a "sad" avatar. Number 3 is "tired" as in "I don't want to partake in this pointless bickery anymore" and 12 is "grief" as in "These events upset me greatly". Then there is 13, "bleh" as in "Whatever, who cares". None of these are good options for a light-weight passing :-( emotion.
Joined: 2/15/2009
Posts: 329
Dada wrote:
Bisqwit wrote:
As a side-note: I uploaded this video in 4240x2400 resolution. The highest YouTube currently provides is 480p. On "my videos" it says "Published 0%". On the upload form it says "your video will be live in a moment" and "Processing 99% — Finishing processing...". Anyone know whether I can expect the 720p/1080p/Original versions to appear, like ever?
Unfortunately, it's extremely random. In some cases they never show up, although I've only experienced that with videos that were several hours long. You could consider reducing the size a bit, since 4240x2400 is well beyond the native resolution of the vast majority of monitors. edit: I see that I'm late.
My 1080p 4 hour Doom3 playthrough is still only at 480p 5 weeks later. Also, it still does not have a thumbnail image.
Working on: Legend of Legaia, Vagrant Story
Joined: 8/29/2005
Posts: 148
Location: Dayton, OH
I think I might be most impressed by how well documented the code is. As a non-systems programmer, I could actually follow what was going on. And for some reason, part of the music reminded me of this: http://www.youtube.com/watch?v=cscedJQ3PFU
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
ledauphinbenoit wrote:
I think I might be most impressed by how well documented the code is. As a non-systems programmer, I could actually follow what was going on.
Thanks! I tried very hard to keep the big picture perceivable at all times without encumbering the actual coding too much with stuff that might increase the program length by a factor of 2.
ledauphinbenoit wrote:
And for some reason, part of the music reminded me of this: http://www.youtube.com/watch?v=cscedJQ3PFU
Wow! I haven't heard that music for a long time.
Joined: 2/15/2009
Posts: 329
At 4096 x 2304 pixels, 4K is over four times the size of 1080p. Source: http://youtube-global.blogspot.com/2010/07/whats-bigger-than-1080p-4k-video-comes.html Bisqwits upload of 4240x2400 appears to be greater than YouTube supports.
Working on: Legend of Legaia, Vagrant Story
Editor, Active player (297)
Joined: 3/8/2004
Posts: 7469
Location: Arzareth
exileut wrote:
At 4096 x 2304 pixels, 4K is over four times the size of 1080p. Source: http://youtube-global.blogspot.com/2010/07/whats-bigger-than-1080p-4k-video-comes.html Bisqwits upload of 4240x2400 appears to be greater than YouTube supports.
I thought YouTube's 4k is 4:3, i.e. 4096 x 3072. Source: http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs In number of pixels, 4240x2400 is not greater than 4096x3072. But of course the X axis is greater. But I also hit YouTube's buggy encoder in this video: http://www.youtube.com/watch?v=N8elxpSu9pw "Creating a raytracer". In that video, all levels except 240p and 480p, including 360p, are broken at 11:56 onwards. I uploaded that video in 3200x2400 or 1600x1200, I'm not sure which. (I had to reupload several times due to A/V sync issues, and I experimented with different containers & codecs). Smaller than 4k in any case.
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Bisqwit wrote:
As a side-note: I uploaded this video in 4240x2400 resolution.
I still don't understand what the point is. Such an arbitrary resolution that goes well beyond what any monitor supports. Why not make it 42400x24000 while you are at it? Bigger is better, so why not make it really big?
Player (206)
Joined: 5/29/2004
Posts: 5712
Just upload whatever the auto-scaler in the video player handles best.
put yourself in my rocketpack if that poochie is one outrageous dude