It is currently Tue Dec 12, 2017 2:58 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Sat Aug 27, 2016 9:35 am 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1511
Kasumi wrote:
I'm not sure we're reading the same things. That's what everyone is saying!


I guess I misunderstood this one:
dougeff wrote:
IF your game logic goes longer than 1 frame, the logic will miss a change in button presses event.
[...]
Have a flag for when the game logic is done, and only check buttons if it is set, or something like that.

The first statement sounded like the following to me:
"The logic might miss a button press if it goes longer than one frame [therefore don't use the controller reading in the game logic but in NMI because then you will never miss controller updates]."

And the second sentence and its talking about a flag sounded like proposing NMI as well. Because when you have controller readings in the game logic anyway, then you don't need any flag specifically for the controller. If you're in the game logic, it's time to update the controller, end.
But the NMI is an interrupt, so controller reading in NMI might require a flag to decide if the controller values should be updated or ignored, based on outside conditions.

That's where I got the idea that this post suggested moving the controller reading to NMI.

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 9:40 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1046
I don't think you misunderstood that post. He was suggesting a way to fix the problem, as you were.

For what it's worth: My reply with the "jump miss" example was only because I wasn't sure you saw that case. Because you did ask. You asked why it could be a problem, and I answered with that.

I wasn't trying to say, "You can't fix this." or "This can't be fixed", just "This is the case people are talking about."

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 9:44 am 
Offline
User avatar

Joined: Sat Sep 07, 2013 2:59 pm
Posts: 1511
Yeah, I guess I understood it incorrectly. But we can summarize:

Controller reading in game logic: No problem.

Controller reading in NMI: No problem and no overhead either.
You need a check to prematurely exit the NMI anyway. So, you just put the controller reading after that check. No need for any flags, other than the general one that you need in NMI to begin with.

_________________
Available now: My game "City Trouble".
Website: https://megacatstudios.com/products/city-trouble
Trailer: https://youtu.be/IYXpP59qSxA
Gameplay: https://youtu.be/Eee0yurkIW4
German Retro Gamer article: http://i67.tinypic.com/345o108.jpg


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 10:03 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19335
Location: NE Indiana, USA (NTSC)
One reason you might want to read the controller in NMI is if you're using even number of cycles since OAM upload as a means of DMC glitch avoidance, as Rahsennor discovered. Perhaps use the "is a new sprite list ready" flag as a signal for whether the main thread is ready to accept a new set of keypresses.


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 10:04 am 
Offline
User avatar

Joined: Wed Apr 02, 2008 2:09 pm
Posts: 1046
thefox: There's this thing: viewtopic.php?f=22&t=14532&hilit=buttons

Edit: I guess you might have meant one that measures times less than a frame.

_________________
https://kasumi.itch.io/indivisible


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 11:20 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10164
Location: Rio de Janeiro - Brazil
If you have to read the controllers in the NMI because of DMC or whatever, you can save the result to a temporary location, and have the main loop read this location instead of using the hardware registers. The main loop would still be responsible for calculating holds, releases, etc., the NMI code would just abstract the hardware part.


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 11:55 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1866
Location: DIGDUG
One game (maybe Silver Surfer) rolls each button into a different address, so it can tell how many frames a button has been pressed, up to 8 frames.
Not pressed = 00000000
First frame = 00000001
Then = 00000011
00000111
00001111
00011111
00111111
01111111
11111111
Stays like that till button released...

11111110
11111100
11111000
Etc, back to zero

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 1:20 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
thefox wrote:
Has anybody done measurements on what is a typical minimum "pulse width" on button presses (or releases) that one can expect? That is, if a player quickly taps the button. Or, holds it down, quickly releases it and then holds it down again.

I guess I might throw together a small test ROM for it.

I seem to recall reading a study on button pressing a while back (can't remember the source, sorry), and I think something like 10 (edit: 16?) times per second was the upper limit for human rapid fire.

As for whether people can generate single frame input, you can if you try. A normal "tap" is going to be a few frames, but it's not hard to do a glancing tap of the button that only connects very briefly.


Last edited by rainwarrior on Sat Aug 27, 2016 1:38 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 1:29 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19335
Location: NE Indiana, USA (NTSC)
I think I can do about 14 on a standard controller. I can make a video if you want.


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 1:35 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5891
Location: Canada
Maybe the number was 16.
http://indie-games-ichiban.wonderhowto. ... r-0127642/


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 2:30 pm 
Offline

Joined: Sun May 03, 2015 8:19 pm
Posts: 92
It depends on how long you sample the input for. I made a hack for Tecmo Super Bowl that displays the number of taps when two (man controlled) players collide.

The game takes 64 frames worth of input (~ one second). The fastest tappers in our community hit about 16 on average. But in any one sample it ranges ~ +/-10%.

So a guy who averages 16 could have a high of 18 and a low of 14.


Top
 Profile  
 
PostPosted: Sat Aug 27, 2016 7:34 pm 
Offline
User avatar

Joined: Sat Jul 12, 2014 3:04 pm
Posts: 950
That's 6.66…% more than a second. How many buttons does Tecmo Super Bowl sample?

Mario Party 4's "Domination" minigame does a ten-second sample of A. It also, apparently, caps out at 160, possibly a subtle nod to Takahashi.

I can(could?) do ~14 as well, one-button.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group