platformer – How to detect taps vs tilts in analog stick input

I’m trying to implement a very simple Smash Bros style game using SDL2 and C++.

I’ve been trying to figure out how to handle analog stick inputs like Super Smash Bros. Melee and Rivals of Aether do. Specifically:

  • Q. How to detect tilts vs taps (i.e. for dashing, etc.)?
  • Q. Do I need to use input buffers / separate input buffers for analog sticks and face buttons?
  • Q. Should I poll for input events or use a function that just returns the current stick position?
  • Q. Polling for stick movement can result in a lot of analog stick change events. Should I consolidate them or just use the last event?

Attempt #1

This is what I did originally:

  • Poll for input events via SDL_PollEvent
  • Update the game controller state with the latest input events
    • The game controller state does not track order of input events
    • The game controller state is designed to reflect the final state of the controller

As the game controller state is updated with new events, it calculates the change in stick position and determines if the player tapped/smashed the stick or not. This seems okay for simple cases, but we don’t know the order of inputs. I feel it can be done better.

Attempt #2

I have also tried introducing an input buffer. Essentially, all of the input events are pushed into a ring buffer (button press events and analog stick events exist in the same buffer). The ring buffer is passed to a state machine that iterates over the events and updates the state. This implementation is what lead to this post.

Other Info

I used the following for learning about SSBM:

Rivals of Aether appears to use an input buffer of 6 frames. So the game will result in a dash if the analog stick exceeds a certain threshold within that number of frames.

dnd 5e – Would Truesight detect a Skulk?

Yes, it would.

Mordenkainen’s Tome of Foes, pag. 227

The skulk is invisible. This invisibility can be circumvented by three things:

  • The skulk appears as a drab, smooth-skinned humanoid if its reflection can beseen in a mirror or on another surface.
  • The skulk appears as a dim, translucent form in the light of a candle made of fat rendered from a corpse whose identity is unknown.
  • Humanoid children, aged 10 and under, can see through this invisibility.

Skulk’s invisibility can be circumvented by those means, which means, they invisibility fails to work in such conditions. Characters with truesight can see invisible targets, so they do not need to circumvent it, as they could already see it normally.

Truesight

A monster with truesight can, out to a specific range, see in normal and magical darkness, see invisible creatures and objects, automatically detect visual illusions and succeed on saving throws against them, and perceive the original form of a shapechanger or a creature that is transformed by magic. Furthermore, the monster can see into the Ethereal Plane within the same range.

Where and when does lingering auras resonate in when using detect magic(or greater)?

I want to know if the effects of magic have lingering magic auras on their targets and in the places they were cast from/into. Where and when does lingering auras resonate in cases of the following types of spells:

  • Instantenous area effect spells (ie.fireball; cone of cold)?
  • multitargetet spells that use an area (ie.Sleep; hold person, mass)?
  • Spells that mask other spells (ie. Mask dweomer; magic aura)?
  • some sort of mixture of answers depending on the actual details of the spell?

spells – What is the mechanic of the check when using detect magic, Greater to identify magical signature?

Detect magic, greater says:

You can recognize this signature if you succeed at a Spellcraft check when later identifying a spell to determine whether or not that spell was cast by the same individual.

I am confused what is the mechanic for the DC and other functions for identifying spells signature features:

  • isn’t it supposed to be a knowledge (arcana) to recognize spells currently in effect?
  • is the DC calculated using spellcraft skill’s “identify spell as it being cast” math or the one presented previously on the spell regarding “identify last spell cast by creature” effect of the spell?

unity – How do I detect if my object is grounded?

As @DMGregory pointed out, there are soo many tutorials on this subject, but since I have just answered a similar question (https://stackoverflow.com/a/66938817/1405906) I will try to address some parts of your code:

I assume that the collider (bc) is connected to your player. If so, bc.gameObject.name, will always be the name of your player object. That is why isGrounded never is set to true.

if(bc.gameObject.name == "Grid") {
        isGrounded = true;
        NumberJumps = 0;
    }

Physics should be done in FixedUpdate(), so that is good, but you should not try to get the input there. You might miss “one-time” events like a jump since it is not guaranteed that FixedUpdate() will be called in every frame. Move the check to Update() and store the jump flag in a boolean.

bool jump = false;
Update()
{
    if( Input.GetButtonDown("Jump") )
        jump = true;
    ...
}

Since you want to support a double jump (or more), the ground check should only be done before the first jump is launched. Once jumping, the player is in the air and there is no ground – but you still want to be able to do the second jump.

FixedUpdate()
{
    if(jump)
    {
        if( isGrounded || (NumberJumps>0 && NumberJumps<MaxJumps)
        {
            rb.AddForce(Vector2.up * jumpHeight);
            NumberJumps += 1;
        }
        jump = false; // Remember to reset the jump flag.
    }
    controller.Move(horizontalMove * Time.fixedDeltaTime, false, false);
}

Now it should work. For more information on how to do the ground-check, see my answer above, or google. Remember to reset the NumberJumps to 0 as soon as you are grounded. Good luck!

Can JavaScript or the browser be used to detect whether or not a third-party application is installed?

Example: If I access a hardware vendor’s website in search of drivers for my a hardware device, the site appears to provide “smart” support that searches for the presence of a third-party tool that can then be used to download the correct drivers.

What I want to know is what type of JavaScript is running so that the web site itself has access to even detect the presence of a third-party executable since the browser itself cannot access the local file system.

Is this something JavaScript can even do or, more likely an function that runs, regardless of the presence of a tool? Would there have to be the presence of an add-in or plug-in installed in the browser that the site is able to query?

Can JavaScript or the browser be used to detect whether or not a third-party application is installed?

Example: If I access a hardware vendor’s website in search of drivers for my a hardware device, the site appears to provide “smart” support that searches for the presence of a third-party tool that can then be used to download the correct drivers.

What I want to know is what type of JavaScript is running so that the web site itself has access to even detect the presence of a third-party executable since the browser itself cannot access the local file system.

Is this something JavaScript can even do or, more likely an function that runs, regardless of the presence of a tool? Would there have to be the presence of an add-in or plug-in installed in the browser that the site is able to query?

How is a “detection tool” such Dell SupportAssist able to detect if it is installed on a system through the web browser?

When I access a site such as Dell.com in order to locate drivers for my device, some sites, such as Dell, provide “smart” support that detect your system, check certain parameters, and then return the matching drivers based, most likely, on the service tag retrieved.

I understand in order to work it needs the matching executable to run; however, the web site itself appears to be able to “detect” whether or not the tool (in this case, Dell SupportAssist) is installed. If a browser doesn’t have access to the file system, how is this accomplished? I assume it is some sort of plug-in for the browser that grants the browser extended access to the system?

enter image description here

How does macOS detect keyboard? How to manually add a new keyboard?

I have new keyboard, Logitech MX Keys, 920-009416 = US ISO.
Logitech MX Keys

The keyboard works well, out of box, on Windows 10 and Linux, Manjaro. On macOS there is issue with it.

After plugin on macOS, app Keyboard Setup Assistant opens and try detect my keyboard. The main problem is with keys: tilde~ on the left side of 1 and backslash near to z. According to the documentation:

If you are a Windows, Linux and Android user, the special characters will be on the right side of the key:

If you are a macOS or iOS user, the special characters and keys will be on the left side of the keys:

but I want to use tilde to the left of key 1, so I want to use windows/linux layout.
After many attempts with the Assistant, I wasn’t able to generate the correct configuration:

$ defaults read /Library/Preferences/com.apple.keyboardtype
{
    keyboardtype =     {
        "10203-5824-0" = 41;
        "45915-1133-0" = 41;
    };
}

I had to help myself Karabiner-Elements and map the keys:
grave_accent_and_tilde(`) with non_us_backslash.

I tried to find out what the code in /Library/Preferences/com.apple.keyboardtype.plist means, but I failed. At first Karabiner could see the keyboard but it was grayed out and I couldn’t map keys for it.

The second problem is with adding a new keyboard, new dongle. After this, when I use Keyboard Setup Assistant, the file /Library/Preferences/com.apple.keyboardtype.plist is changing and I have the problem again. I don’t know why.

Is it possible to use the same layout as under Windows/Linux? How to manually add a keyboard?
What does the keys layout depend on, ยง|` and `| ?

On Linux, xev returns for left-upper tilde:

KeyPress event, serial 34, synthetic NO, window 0x4000001,
    root 0x139, subw 0x0, time 356984, (-111,112), root:(600,476),
    state 0x0, keycode 49 (keysym 0x60, grave), same_screen YES,
    XLookupString gives 1 bytes: (60) "`"
    XmbLookupString gives 1 bytes: (60) "`"
    XFilterEvent returns: False

and

KeyPress event, serial 37, synthetic NO, window 0x4000001,
    root 0x139, subw 0x0, time 360368, (-107,104), root:(604,468),
    state 0x0, keycode 94 (keysym 0x3c, less), same_screen YES,
    XLookupString gives 1 bytes: (3c) "<"
    XmbLookupString gives 1 bytes: (3c) "<"
    XFilterEvent returns: False

for “backslash” but I don’t use this key.