User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Ultra-precise "who pressed first" timing query

  1. #1
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ultra-precise "who pressed first" timing query

    I'm working on a local multiplayer game. One of the mini-games has single button controls and it basically hinges on who has the better reactions.

    Effectively, after random period of a range of 1 to 5 seconds, an object appears and the first to press the button gets the powerup. There's a penalty for pressing 'early' too.

    What I'm doing at present to handle this is:

    1.Upon pressed any key - Activate group "Key Pressed"
    2. Group "Key Pressed"
    2.1. P1 Button Pressed - Activate group "P1 won", Deactivate group, "Key Pressed"
    2.2. P2 Button Pressed - Activate group "P2 won", Deactivate group, "Key Pressed"

    Normally, for most games, people wouldn't worry about a ~17ms (1x 60th second) window being too wide, nor the inherently unfair nature of the above meaning that if P1 and P2 pressed the button at *exactly* the same, in each case, P1 would be declared winner as their 'button checking' event occurs first?

    I suppose I could make a check so that if in the same frame both buttons are pressed, it does a "draw" (which I don't really want), or randomly selects a winner.

    Usually, I'd say people were "splitting hairs" with worrying about these edge cases. As it's only a single button in this game, they'll be watching and waiting for it: IE there's no 'lag' from moving fingers to reach another key. In this context, the whole nature of the game is that players will almost always at 0.2-0.3 seconds after the powerup appears, hit the button.

    Therefore, as a "scale", 100ths of a second start to look like they're lacking in granularity: You could reasonably expect a draw 1 in 10 times.

    Therefore, is it possible to improve on this further (if so, please explain how!), or am I at the limits of what it achievable?


    How do really competitive games that support 'pro gamer tournament play' (say, Streetfighter IV), which have incredibly precise timing requirements deal with the above scenario "under the hood?"

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    You can increase the framerate, but I guess this will be very machine-dependant then
    On my machine I get a minimum lag of about 2~4 ms with maximum framerate

    You can easily test it by setting framerate to 1000
    & add this action:

    repeat while key is pressed
    >>> set Global String A to Global String A + "|" + Str$(timer )

    And then check the difference in the string

    Mine looks this way:

    |290|294|296|301|304|306|309|312|316|321|323|326|3 28|330|333|335|338|341|343|346|349|351|353|356 etc.

  3. #3
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool, that's great Schrodinger; target platform is a specific windows laptop, so machine dependency not a problem. Many thanks, exactly what I was after.

    I'll give it a go tonight.

  4. #4
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That worked same sort of output as schrodinger; real framerate I'm getting is ~400fps and |56|60|63|65|67, etc. so vastly more granularity than before. This more than satisfies my pickiness. Thanks Schrodinger!

  5. #5
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, original problem solved, but two additional queries have now arisen (isn't that the same with every area of learning? ):

    1. Is there any way to make number of fps specific to a frame and not the whole application (possibly using sub-apps?)

    2. Clearly my monitor isn't even capable of actually drawing 400fps (see previous post). Presumably, it is 'dropping' frames. Is there a way to control *which* frames are dropped, or better yet, have 1000 frames per second for the timing purposes drawn in this thread, but have some event that effectively says, "only redraw the frame every 10th frame"?

    Thanks!

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    1. sub apps are the only thing you could test I guess, but not sure if woud work

    2. only way I could think -testing - of is adding a viewport or surface object, and chosing with a value when to "refresh" the screen content
    (but not 100% sure on doability..... and could be buggy)

    (now that I think... viewport could possibly solve the zooming+shader issue you were having on other thread?
    preparing a wide frame, zooming with viewport and then applying shader?)

  7. #7
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Tried sub-apps at lunchtime. Looks promising, but I'll need a couple hours' more poking, will report back with outcome.

    2. Ooh! Now we're talking.
    Viewport could well be the answer. Haven't ever played with that, but from the description it sounds right. I see they're
    currently having some problems with it, though.

    With regards the zooming/shader bit, if it fixed it, it'd be great: It'd allow me to display a zoomed in 336x240 ("blown up" by a factor of 4) and then apply a 'scanlines' effect and crt distorition, etc. at the higher resolution and then overlay an image like an old arcade machine "screen decal" over the top of that.

    In terms of other ways to test what it's actually displaying, theoretically I could borrow an expensive (and reliable/trustworthy!) 400fps camera and film a simple app running that just has a big number counter incrementing each frame and see what sort of proportion wound up on film.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I've used the viewport in D3D and can't recall having problems, so I guess it's fixed..?

    As for -2- I was a little on rush before, now I've checked and I was referring to the "update" command of the Viewport
    though I've never used that command and don't know if can suit your needs

    It's a very cool extension, love it [heart*]
    very handy for zooming and lots of other uses too

    and your project seems to be also very cool btw!


    [* --> forum admins: seems like I can't add the heart emoticon? my message gets truncated at emoticon and emoticon doesn't show]

  9. #9
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, schrodinger. Think a multiplayer Warioware/Point Blank style collection of mini games, styled after old arcade games.

  10. #10
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    679
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CeriJC View Post
    1. Is there any way to make number of fps specific to a frame and not the whole application (possibly using sub-apps?)!
    You can manually change the FPS via events. The option is located in the Storyboard Controls. I assume this is what you meant, at least. You could set the FPS to 60 for all normal frames, but at the start of the minigame frame set it to 400.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. "On menu button pressed" doesn't work
    By DavidT in forum Android Export Module 2.5
    Replies: 2
    Last Post: 21st December 2014, 09:07 PM
  2. Joystick 2 Object and "Repeat while <button> is pressed" (Negated)
    By hellii in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 27th November 2013, 09:12 PM
  3. How to achieve "While Button X" is pressed on OUYA?
    By Matriax in forum Android Export Module Version 2.0
    Replies: 2
    Last Post: 8th July 2013, 04:44 PM
  4. equivalent of "repeat while key is pressed" condition in iOS?
    By 1234cb in forum iOS Export Module Version 2.0
    Replies: 5
    Last Post: 3rd November 2011, 04:34 AM
  5. Fixed - B1: "Repeat while mouse pressed" ignored
    By DavidN in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 14th September 2010, 12:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •