36 votes
Accepted

Should I develop with mouse in mind if I plan on targetting more than PC?

Yes, when you want your game to run on PC, you should think from an early design stage on how to best utilize the mouse. The same applies to the input features of all other platforms you consider ...
Philipp's user avatar
  • 119k
31 votes

How to make a delayed mouse input?

To simulate a time lag, use a circular buffer to store the last N frames' mouse positions. Store the current mouse position each frame. In your control calculations, use the oldest mouse position from ...
Buster's user avatar
  • 401
27 votes

Ways to draw tracks on 4-connected grid

This is Matt, the creator of Trainyard. @DMGregory summoned me here! :) It sounds like you're working through the same issues I had to deal with. It's a tricky problem where there isn't necessarily a ...
Matt Rix's user avatar
  • 371
10 votes

Simple message box in gdscript / godot

You can use the OS / platform's alert system: OS.alert('This is your message', 'Message Title') You can use ...
hola's user avatar
  • 321
6 votes

Calculate 8 different directional input based on arrow keys combinations

Given 4 variables up left down right with values zero or ...
DMGregory's user avatar
  • 134k
6 votes
Accepted

How to handle complex inputs in 2D platform game?

This is an excellent question because you are experiencing a problem that's quite commonplace with less experienced programmers: attempting to solve your problem with a purely imperative approach. ...
Pharap's user avatar
  • 1,627
6 votes

Should I develop with mouse in mind if I plan on targetting more than PC?

Yes you should. PC users expect that they'll have a mouse to play your game. If you don't use it, your game risks to be labeled as a "poor mobile port", specially if some actions in the game should ...
Vaillancourt's user avatar
  • 16.3k
6 votes
Accepted

Comparing analog stick movements to predefined flick shapes

It looks like all these gestures only care about which points you hit around the outside of the stick's range, and the order you hit them in, so we can take a very simplified approach. Let's label ...
DMGregory's user avatar
  • 134k
6 votes

Ways to draw tracks on 4-connected grid

I think you can solve the two pain points you indicated with a few heuristics. One is a little hysteresis: once the player is drawing in a particular row/column, keep their drawing cursor locked in ...
DMGregory's user avatar
  • 134k
6 votes

How to map gamepad inputs for my platformer?

Most importantly: plan for remappable controls from the start. Different games use different conventions, and different players have different preferences. This is also important for accessibility - ...
DMGregory's user avatar
  • 134k
6 votes
Accepted

Visual Studio not recognizing Unity's new Input system

I found the answer online! I had to go to the editor preferences (Edit -> Preferences) and under External Tools, there's a section with checkboxes under "Generate .csproj files for:." ...
Millard's user avatar
  • 500
5 votes
Accepted

Is it safe to base a combo system in frames instead of time?

Locking at 60 fps is certainly viable. From what I've seen, just as you've said, it appears fighting games typically describe timings in number of frames, even as most fighting games have transitioned ...
Jibb Smart's user avatar
  • 2,460
5 votes
Accepted

How to know when user has stopped dragging

Check if Touch TouchPhase is Stationary, which even says will be set only if: A finger is ...
tomsseisums's user avatar
  • 3,366
5 votes
Accepted

What keys should I use for a four-player game with one keyboard?

Just as a heads up, most keyboards have a finite limit of keys that can be pressed. For example, I have an Asus Transformer Book and you can only press around ~5 keys at a time. Some keyboards also ...
Mr_Rockers's user avatar
5 votes

How does input work when exporting to Android?

With Unity, the mouse input will work like a touch input on android, automatically. Alternatively, you can look at the Input.touches class to handle multiple touches.
jgallant's user avatar
  • 8,414
5 votes

Calculate 8 different directional input based on arrow keys combinations

A common method is to combine the opposite direction keys into a single axis, giving you X and Y movements, then you combine the X and Y into a single 2D movement vector. Here's what that code might ...
congusbongus's user avatar
  • 14.8k
5 votes
Accepted

Entity Component System - Handling Input

Input is usually more abstracted from character behaviour than that. Usually by some kind of "character controller" that translates requested state into movement/actions. Ideally you don't want to ...
Bryan Robertson's user avatar
5 votes

Is it acceptable to use Hash Maps for input, copying one hash map to an another during the game loop?

Hashmaps are okay. If you believe you are going to get a performance bottleneck on input, then you are doing something critically wrong, or you're pre-maturely optimizing. Unlike the other answer, ...
Water's user avatar
  • 343
5 votes

Should I develop with mouse in mind if I plan on targetting more than PC?

It depends, as usual. What genre? How much money/time do you have? Do you develop the application to make money? Users are generally surprisingly forgiving about bad input controls in niche games (e....
Peter's user avatar
  • 9,925
5 votes
Accepted

What verb describes when you hold a joystick to the right or left?

It isn't probably universal, but, as Ferreira said, it is probably Tilt. A good bit of Xbox 360 games refer to the action you are describing as "titling the joystick to the [direction]".
The Mattbat999's user avatar
5 votes
Accepted

SDL2 mouse motion event keeps occurring

You're not checking the return value of SDL_PollEvent to see if there's a new event, which means that regardless of whether there is an event to handle, you're ...
wizzwizz4's user avatar
  • 165
5 votes
Accepted

Inputs in realtime multiplayer game

It sounds like your problem arises from processing players' input eagerly, the moment it comes in. In this situation, it's harder to keep track of the context of the input and its timing/frequency ...
DMGregory's user avatar
  • 134k
4 votes
Accepted

Unity 5 - How to change Input Field 'Content Type' at runtime to toggle between asterisks and letters?

Yes, it's possible. I assume you have a simple scene set up with a Toggle and an InputField like this: Add a new Empty to your scene and name it UIController. ...
qCring's user avatar
  • 620
4 votes
Accepted

How to make a delayed mouse input?

I ended up using a coroutine, because (from what I understand) the delay will be constant regardless of the performance of the device running the game. This is my code: ...
mr-matt's user avatar
  • 2,759
4 votes

How to detect when the mouse is over a particular enemy collider, without falsely selecting bullet colliders?

First, configure your Layers so that you have a layer for bullets and a layer for enemies. Ensure you've set the bullet prefabs to use the bullet layer, and the enemies/enemy prefabs to use the ...
DMGregory's user avatar
  • 134k
4 votes
Accepted

Can less than 30 FPS feel good with 60 FPS input handling?

Yes. But it depends on what you do with that input, the player, and the game design as a whole. How a game "feels" is all about feedback. I beleive this to be a consequence of the user ...
Romen's user avatar
  • 396
4 votes
Accepted

Input reaction is slow in two player snake game

I think i call getKEYS2() but program tries to run getKEYS1() too and that's why reaction is slow. Am i wrong? You are wrong. C++ does not randomly call a completely different function with a similar ...
DMGregory's user avatar
  • 134k

Only top scored, non community-wiki answers of a minimum length are eligible