Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Discussion Mobile alternative for target aiming with mouse

Discussion in 'Game Design' started by xDayhawk, Jun 12, 2022.

  1. xDayhawk


    Jun 24, 2020

    I developed a Top down space shooter for PC where you aim with you mouse for where you want to fire.
    the game is a survival game (of sorts) as more waves come in and you have to survive the longest.

    The main mechanic is shooting the enemies and dashing, and while dashing is very direction oriented, the shooting is done strictly based on moving your mouse with a fire cursor which works great for PC.
    It looks something like this (the triangle is the cursor):

    I've started working on support for Mobile and i've encountered an issue regarding the mouse aiming - whats the best alternative for Mobile?

    The way i see i have a few options:
    1. Make the fire mechanism work on the direction just like the Dashing, but its problems as there are waves of enemies coming in, sometimes you need to run away and shoot from a far
    2. Have a second joystick on the right for Aiming and shooting at the same time - when you press on it you are able to move the target cursor and it auto fires as well. it requires good coordination i guess, as you have to keep your left hand on moving as well with the left joystick

    And that's all i got really, would love to hear any more ideas of whats the best design approach for games like this, if its even viable for Mobile gameplay.

    Many Thanks in Advance!
  2. karliss_coldwild


    Oct 1, 2020
    Not only two joystick controls are viable there is whole category of games called "twin stick shooters". Some people prefer playing such games using two sticks on a gampad even when the same game also supports keyboard+mouse style controls like in your video. Two sticks on touchscreen aren't as good as gamepad with two sticks, but you can still learn a lot from it.

    Overall design of game and implementation details will affect how good the twin stick controls feel compared to mouse+keyboard.

    There are various aspects to make good twin stick controls
    • Major difference from mouse controls and how I understood your description is that with twin stick controls typically the aiming stick controls aiming direction and cursor is drawn at fixed radius instead of controlling absolute position of target cursor which can be positioned anywhere on screen. Targeting cursor can also be drawn as laser or in the position of raycast hit (last works better in small enclosed levels and might be bad for open spaced) if you want to focus more on long range combat.
    • Precise aiming at long distance with stick is more difficult than with mouse. You may consider to have slight aim assist when using touch controls (even games targeted at PC + gamepad like "Enter the gungeon" have it). How much of problem this is will depend on your level design and how far you can see. Aim assist can be done by either snapping targeting cursor in enemy direction when it's close enough or having the bullets slight homing effect. Which one works best can vary between the game. Depending on speed of bullets and their visual style homing may look a bit silly, but in some games like towerfall where arrow trajectory is curved anyway it works quite well.
    • Problem of worse long range aiming can be slightly mitigated by appropriate player skills. When trying to hit distant enemy sometimes it's easier to: do rough aiming with aiming stick, make fine adjustment based on where the bullets fly by moving the character with movement stick and keeping shooting direction fixed. This strategy works better with weapons that quickly shoot a lot of bullets or if you have laser aim.
    • Allowing to move finger as far as you want from center of joystick. Once the touch has started until it's released allow moving finger anywhere on screen, outside the drawn borders of joystick. This reduces need to have perfect joystick radius and it becoming unresponsive if you accidentally move the finger too far.
    • Some games don't have fixed joystick position. There is rough are of where the player can touch (~left half of screen for movement, right half for aiming). Once you touch the screen in supported area the position you touch is set as center of joystick and joystick direction is calculated relative to this position. You can reposition your fingers at any point of game. This can reduce the need for user configurable joystick placement and also any detected touch position offset due to big fingers.
    • User configurable touch control size (maybe even position). There are all kind of mobile devices with varying screen sizes. Comfortable grip position and movement range will depend on individual players and screen size.
    • How much the shooting precision is a problem will depend on game design. If player can quickly shoot large amount of bullets, with that has some spread and unlimited ammo at hoards of enemies even very rough aiming can be good enough. Unlike game where you need to carefully snipe enemies one at a time at the other side of screen. Having player busy with dodging enemy bullets can also reduce importance of aiming. In bullet hell like games when fighting a boss that doesn't have a weak spot I often ignore the aiming aspect completely. In later stages of games like vampire survivor where screen is filled with enemies precise aiming also doesn't matter, you can shoot anywhere and it will still hit something
    I am more worried about how you are going to activate the dash once both thumbs are busy with moving and aiming. Especially if dash serves as attack. It could work but need to choose it carefully to minimize disruption.

    Rewired has quite good touch screen joysticks. You might want to take a look at docs for potential features even if you are not using Rewired and are implementing your own on screen joystick.

    Try out some of existing twin stick shooters, on mobile if you want to see how touch screen joystick aiming works. Or on PC with gamepad if you want to compare what changes games make when switching between mouse+keyboard and twin stick control modes.
    angrypenguin likes this.
  3. xDayhawk


    Jun 24, 2020
    Thank you for your very detailed answer, that helps a lot!!

    I like the idea of having a raycast line and maybe it will be a little easier to hit like expanding hitboxes or just finding the closest enemy from a bullet within a given range, that could definitely help the aiming part.
    I'm thinking something like while you're aiming its auto-firing, if you want to dash or use a shield its a button u need to press, u cant aim and shoot + use an ability but dash and the shield are on a CD, so u can only use them from time to time.

    I'll give it a shot and see how it feels!
    will also take a deeper look into Rewired, from what i can see they seem crazy good.

    Thanks again, this is incredible!