Game complete: Blurred Lines 2048 by Demptronic

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

User avatar
rainwarrior
Posts: 7667
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by rainwarrior » Sun Jul 26, 2015 5:10 pm

In case the poem is unclear, you have to use a different controller reading routine if you're playing DPCM samples, because they cause a conflict with the read (usually showing up as incorrectly pressing right now and then while samples are playing). This is kind of disastrous for 2048 gameplay.

Many emulators don't emulate this conflict. If you need an emulator to test the problem on, I would recommend Nintendulator.

I think puNES also attempts to emulate this conflict, but it doesn't appear to like your ROM at the moment.

User avatar
Dreamwriter
Posts: 35
Joined: Tue Jun 02, 2015 9:17 pm
Location: Florida
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by Dreamwriter » Sun Jul 26, 2015 9:43 pm

Nice job, this is definitely a unique and skilled creation; I woulda rented it as an NES game as a kid, maybe even bought it.

User avatar
raydempsey
Posts: 159
Joined: Sat May 31, 2014 4:12 pm

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by raydempsey » Mon Jul 27, 2015 1:15 am

rainwarrior wrote:In case the poem is unclear, you have to use a different controller reading routine if you're playing DPCM samples, because they cause a conflict with the read (usually showing up as incorrectly pressing right now and then while samples are playing). This is kind of disastrous for 2048 gameplay.

Many emulators don't emulate this conflict. If you need an emulator to test the problem on, I would recommend Nintendulator.

I think puNES also attempts to emulate this conflict, but it doesn't appear to like your ROM at the moment.
Tested on FCEUX during development. How should the controller reading routine be changed?

User avatar
Dreamwriter
Posts: 35
Joined: Tue Jun 02, 2015 9:17 pm
Location: Florida
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by Dreamwriter » Mon Jul 27, 2015 4:40 am

What a lot of games do is read the controller twice in a row, and only act on it if both reads were exactly the same. The sample DMA will only corrupt one read. Or just keep reading it in a loop until it gets two of the same result in a row.

User avatar
rainwarrior
Posts: 7667
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by rainwarrior » Mon Jul 27, 2015 8:02 am

Dreamwriter wrote:...just keep reading it in a loop until it gets two of the same result in a row.
This is the approach I prefer. There have been some lengthy threads on the most optimal/clever thing, etc. but this method is very simple and easy to implement if you already have a regular controller read, and it works quite well.

It's also what Super Mario Bros. 3 and a number of other games do. Here's a quick disassembly of SMB3's method:

Code: Select all

        jsr poll_controller  ; 0F:FEB9:20 0B FF  JSR $FF0B
reread: lda controller       ; 0F:FEBC:A5 00     LDA $0000 = #$00
        pha                  ; 0F:FEBE:48        PHA
        jsr poll_controller  ; 0F:FEBF:20 0B FF  JSR $FF0B
        pla                  ; 0F:FEC2:68        PLA
        cmp controller       ; 0F:FEC3:C5 00     CMP $0000 = #$00
        bne reread           ; 0F:FEC5:D0 F5     BNE $FEBC
FCEUX does not emulate DPCM conflicts, so you'll never catch it if it's your only testing emulator.

User avatar
raydempsey
Posts: 159
Joined: Sat May 31, 2014 4:12 pm

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by raydempsey » Mon Jul 27, 2015 10:34 am

Seems simple enough. I'll make the change today and repost. I would have definitely noticed something was wrong when I attempted my first transfer to cart coming soon. Is there any risk that it could get caught in a loop that ends only at the start of the next Vblank or will it surely be resolved within a few small loops?

User avatar
thefox
Posts: 3141
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by thefox » Mon Jul 27, 2015 11:16 am

Nestopia is another emulator that emulates the glitch.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi

lidnariq
Posts: 8765
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by lidnariq » Mon Jul 27, 2015 11:20 am

It was decided that the highest number of rereads is (practically speaking) five, if a person changes what button they're pressing just after a glitch:
- correct, old
- corrupted, old
- correct, old
- correct, new
- correct, new

tepples
Posts: 21746
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by tepples » Mon Jul 27, 2015 12:15 pm

In practice, two reads should be enough because

And while you're at it, are you making sure to read both D0 and D1 of $4016? Famicom owners would appreciate it, as D0 is for hardwired controllers and D1 is for plug-in controllers on that system.

User avatar
tokumaru
Posts: 11465
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by tokumaru » Mon Jul 27, 2015 1:43 pm

tepples wrote:In practice, two reads should be enough because
Because...? Come on tepples, the suspense is killing me! :mrgreen:

tepples
Posts: 21746
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by tepples » Mon Jul 27, 2015 2:17 pm

...because a Threes clone isn't as twitchy as, say, Street Fighter series. Read twice and if they disagree, use the previous frame's presses.

Sorry, I got distracted by real life while composing that post.

User avatar
rainwarrior
Posts: 7667
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by rainwarrior » Mon Jul 27, 2015 5:48 pm

lidnariq wrote:It was decided that the highest number of rereads is (practically speaking) five, if a person changes what button they're pressing just after a glitch:
- correct, old
- corrupted, old
- correct, old
- correct, new
- correct, new
The worst case is very slightly worse than that. For most controller read loops, the DPCM at is fastest will be dormant for at least 2 passes through the poll routine, but it might be able to corrupt a 3rd consecutive one. So the worst case is really six:
- correct, old
- corrupted, old
- correct, old
- correct, new
- corrupt, new
- correct, new
- correct, new

Of course, you have to be lucky/unlucky to even get a conflict in the first place. It won't corrupt EVERY third loop, just ones where the $4016 read aligns with the DPCM read. I think it's normally like once per hundreds of frames. For it to happen twice consecutively would be exceedingly rare, and then on top of that you'd have to manage to press a button during, so... rare * rare * rare = has it ever happened ever?
raydempsey wrote:Is there any risk that it could get caught in a loop that ends only at the start of the next Vblank or will it surely be resolved within a few small loops?
Not really. It's quite robust in any use I've seen. SMB3 seems pretty stable to me, I doubt the controller read loop ever caused a problem.

Like, if you hooked a machine up to the controller port that changed the input on every strobe, it would hang the game in the controller loop, but this is kind of pathological. I don't think anyone would do that except if they were trying to build a turbo-button controller and didn't know that many games will read in a loop like this.

User avatar
raydempsey
Posts: 159
Joined: Sat May 31, 2014 4:12 pm

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by raydempsey » Mon Jul 27, 2015 10:57 pm

I used Nintendulator to observe the problem you were describing about the DPCM creating false right button presses. I fixed it the way rainwarrior suggested and it works better now. Here is the new uploaded version. Thanks for finding the bug. I didn't even know that was a thing. I'll let you know how uploading to cart is coming as I attempt it.
Attachments
BlurredLines2048.nes
(384.02 KiB) Downloaded 320 times

User avatar
raydempsey
Posts: 159
Joined: Sat May 31, 2014 4:12 pm

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by raydempsey » Mon Jul 27, 2015 11:49 pm

My first attempt to upload BlurredLines2048 to a cartridge has failed. I have a TKROM 512 PRG 256 CHR flash cart WRAM w/ battery pack and I am attempting to use INL retro-prog v1.1 beta. Before I uploaded it, I trimmed a copy of my .nes file down so that the first 16 bytes went away causing the file to be 16 bytes shorter. Do I have to upload the PRG and CHR separately? I don't know if the file extension makes a difference but I tried uploading it when it was saved as both .nes and .bin but still no luck. No matter what I try to do, the program instantly crashes the moment I attempt to write to the cart. I never did this before.

I bought it from here: http://www.infiniteneslives.com/kazzo.php

lidnariq
Posts: 8765
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Game complete: Blurred Lines 2048 by Demptronic

Post by lidnariq » Mon Jul 27, 2015 11:57 pm

raydempsey wrote:Do I have to upload the PRG and CHR separately?
Yes.
No matter what I try to do, the program instantly crashes the moment I attempt to write to the cart.
That's weird, but I'd assume it's because the resulting file isn't a power of two.

Post Reply