nesdev.com
https://forums.nesdev.com/

Randomness before the first button press
https://forums.nesdev.com/viewtopic.php?f=2&t=9796
Page 1 of 4

Author:  tepples [ Sun Feb 10, 2013 9:15 pm ]
Post subject:  Randomness before the first button press

In this post, tokumaru wrote:
Other aspects of the NES that might be random (such as register and memory contents) are probably not random enough for seeding a pseudo-random number generator.

Something glitchy this way comes.

┬┐Pretendo? ┬┐Innuendo? No entiendo.

Wintendo? Nesticle? Nintendon't.

Kevtris clued me in on how to get randomness before the player presses anything, without using a battery circuit. I'll have something to show you later this week.

Author:  Bregalad [ Mon Feb 11, 2013 2:02 am ]
Post subject:  Re: Updating a 'random' nametable / pattern tile

No offence, but are you getting senile or something ?

I was on the point to report this as spam, when I suddenly saw : oh, this post was made by tepples ?

If you bump a 4 year old thread, at least write something sensible in it.

Author:  tokumaru [ Mon Feb 11, 2013 6:53 am ]
Post subject:  Re: Updating a 'random' nametable / pattern tile

Bregalad wrote:
If you bump a 4 year old thread, at least write something sensible in it.

The nonsensical links are expected from tepples, but I'd expect more than a "teaser" to justify the necrobump.

Author:  tepples [ Mon Feb 11, 2013 7:50 am ]
Post subject:  Re: Re:

tepples wrote:
Kevtris clued me in on how to get randomness before the player presses anything, without using a battery circuit.

What was unclear about this post?

Let me explain further: Last night I was in #nesdev with kevtris, and I asked about potential sources of randomness to choose one of six opening cut scenes before the player has a chance to press Start. He told me about a way to read values resulting from analog effects in the PPU.

Author:  tokumaru [ Mon Feb 11, 2013 10:10 am ]
Post subject:  Re: Re:

tepples wrote:
What was unclear about this post?

Nothing was unclear, it's just that it had no actual content, it's a teaser for content you intend to post in the future.

Not that it bothers me or anything, I just found it weird.

Author:  Bregalad [ Mon Feb 11, 2013 10:15 am ]
Post subject:  Re: Updating a 'random' nametable / pattern tile

Quote:
Let me explain further: Last night I was in #nesdev with kevtris, and I asked about potential sources of randomness to choose one of six opening cut scenes before the player has a chance to press Start. He told me about a way to read values resulting from analog effects in the PPU.

Oh, and we were supposed to guess this by looking at your jargon post ?

I guess the time between reset and the first VBlank could be random... on real hardware but most (if not all) emus will not simulate this.

Author:  tepples [ Mon Feb 11, 2013 10:36 am ]
Post subject:  Re: Updating a 'random' nametable / pattern tile

Think back to that topic about Young Indiana Jones. Reading from $2007 during rendering causes the PPU to skip a line and possibly a byte. Young Indy and the title screen of Zelda II use this to skip some scanlines, and I had made a demo called Boing 2007 that uses this same effect to stretch a background.

As for the value itself, Kev tells me a whole bunch of things get enabled at once inside the PPU, which causes not-very-predictable "analog" effects. So I used a CRC16 routine to take a hash of 256 reads from $2007 in order to establish a random seed. I'll post a demo with source later, and I'll need people's help to test it on an NES without the PowerPak menu getting in the way.

Oh, and by now, I'm starting to agree that the necro-bump might not have been the best choice here.

Author:  Bregalad [ Mon Feb 11, 2013 11:02 am ]
Post subject:  Re: Randomness before the first button press

I completely forgot about this, but I guess this was because you can't really do things that writes to $2005/6 can't do with this effect, so I quickly forgot about it.

Author:  blargg [ Mon Feb 11, 2013 11:44 am ]
Post subject:  Re: Randomness before the first button press

* Initial RAM contents
* Initial timing of things (how many cycles until first event)
* Indeterminate hardware behavior (double write to $2007)

If you have battery RAM, keep RNG's state in it or even just a reset counter, then no need for HW randomness

Author:  infiniteneslives [ Mon Feb 11, 2013 12:15 pm ]
Post subject:  Re: Randomness before the first button press

blargg wrote:
If you have battery RAM, keep RNG's state in it or even just a reset counter, then no need for HW randomness


Or flash that's writable via the NES. Flash is the only reasonable memory choice if something is going to be produced in sizable quantity. Admittedly though, a solution that would allow writing to it would need to be devised.


Tepples wrote:
I'll post a demo with source later, and I'll need people's help to test it on an NES without the PowerPak menu getting in the way.


I can help you out.

Author:  Denine [ Mon Feb 11, 2013 2:16 pm ]
Post subject:  Re: Randomness before the first button press

blargg wrote:
* Initial RAM contents

When I start reading this topic, I had same idea. But it is not emulated, is it?

Author:  tepples [ Mon Feb 11, 2013 2:22 pm ]
Post subject:  Re: Randomness before the first button press

http://pics.pineight.com/nes/pretendo-0.01.zip

Does it have the same 4-digit number every time?

Author:  Bregalad [ Mon Feb 11, 2013 3:31 pm ]
Post subject:  Re: Randomness before the first button press

The initial RAM content will vary from NES to NES, but will be likely the same at power up on the same console.

Author:  Denine [ Mon Feb 11, 2013 3:34 pm ]
Post subject:  Re: Randomness before the first button press

Denine:Tepples
0:1

So, RAM viewer in FCEUX just shows 00's and FF's?

At any rate, this may be very useful information, thanks!

EDIT:
Bregalad wrote:
The initial RAM content will vary from NES to NES, but will be likely the same at power up on the same console.


yeahh... So player need to reset the game to have different initial value.

Author:  Bregalad [ Mon Feb 11, 2013 3:44 pm ]
Post subject:  Re: Randomness before the first button press

Yes but then I think a soft reset is assimilable to a "button press".

Page 1 of 4 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/