Be the first to post for 'Ranged Attack Problem'!



If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.


@Rick_Davidson - did I understand from your video that Diablo’s controller controls basically give you like a mouse pointer? (that I assume you move with the sticks) If so, I kind of like that approach.


Hmm, it doesn’t give you a mouse pointer on the screen during movement / combat, it lets you drive as you would any 3rd person action game - point the stick left, you run left. While pointed left, if you shoot, then it shoots left.


The diablo example you were showing seemed to ‘hit’ the enemy even when it clearly missed - indeed it looked like every shot unerringly damaged the enemy unless you were at least 30 degrees out. Maybe that could be used for ‘funny’ but it certainly looks odd otherwise.

I’m not really sure I see why the controller is a problem for ranged combat anyway. With a mouse you use a click to set your target enemy, with a gamepad you could give options to target nearest enemy, next enemy etc, presumably in the direction you’re facing - you don’t get a pointer but you do get a lot of buttons to play with.


I never really liked the idea of run up to shoot. Shoot from anywhere really does seem like the best option. But I was thinking a mechanic could be a damage boost from shooting “in our bubble”. That shoot range we picked could give a damage boost.

That way you don’t have to balance ranged against aspect of let me just be very far away and snipe super slow enemies. There are other ways to balance this too like Level design. Diablo does tight spaces and corners making it difficult for the player to just shoot from anywhere in varied spaces. Enemies also may have a trick or two to cover the space.


I like the Diablo 3 approach here. You could still prevent players from off-screening or sniping by giving projectiles limited range. I’m not using click to move so didn’t bump into this issue but experienced cutting features in a different way. I had a lock on nearest enemy mode that switched from player controlled camera to focusing the camera and player on the nearest enemy. After implementing it I cut it because the sudden loss of camera control when locked on was a really jarring experience.


As I am designing my game different, Action-Adventure/RPG like, I didnt implement "click to move". But, as a solution to this problem, I would do the same thing I am making for my combat system now: An auto-target button, like Fable and GTA San Andreas had (I know, its not a RPG, but you got the point). This way, you need to be in range if you want to automatically attack an enemy.

Anyway, it was an excellent lecture, and it made me think about also giving the player the liberty to shoot whenever and wherever he wants. :smiley:


The problem, and solution as I see it.

Problem: How do you aim at the enemy when you don’t have a mouse pointer?

Solution: While using the controller, have a button that you can hold down, and while this button is held down, it will show a UI arrow that can be rotated, and if you release the button (or press a shoot button), the character will release a projectile in the direction specified by the UI.

No idea yet how Rick and Ben solved it yet. :slight_smile:

Love the course, lots of love :slight_smile:


For my game, I’ll be implementing an “weapon ready” state that the player must be in before they can fight.
I want to avoid the player accidentally roughing up any NPC they didn’t explicitly want to, so you need to switch between a passive and aggressive state during play. I may make this a mandatory/automatic switch over when NPCs initiate combat, so the player doesn’t have to think too much in the heat of the moment.

Melee will be handled by a simple left-click / attack button.

Ranged is a bit more complicated.
With Mouse:

  1. Hold RMB down to enter range mode. If an enemy is in range it will snap to them, or you can move the mouse for free aim.
  2. Hold LMB to charge attack
  3. Release LMB to launch projectile
  4. Release RMB to exit range mode
  5. There will also be an auto targeting system, where you can cycle through enemies with the scroll wheel.

For controller (if I implement it):

  1. Right-trigger hold to activate range mode - again, will snap to closest enemy in range, or you can free aim with the right thumb-stick
  2. Hold Attack button to charge attack
  3. Release Attack button to launch projectile
  4. Release Right-trigger to exit range mode
  5. Switch to next/previous enemy with right/left bumper, using the auto-targeting system.

Free aim will definitely require some dexterity, but i’m guessing the majority of players would use the auto-targeting system, which is designed to make life as easy as possible for the player.
I’m imagining it to be quite a pain to implement, but the hassle should be worth it. Since combat isn’t a massive part of the game, I want it to be easy for the player to do, even if it requires a bit of extra work in the background.


My idea is similar to @garypettie - when using the controller, click the RT to select nearest target in front of the player, click it again to switch between other visible targets in front of the player (similar to tab-targeting in an MMO), then activate the ranged attack without running up.

No idea if I can make that work or not, but that’s the basic idea anyway :slight_smile:



I don’t have specific problem at this stage of the course because I choose to use Unity NavMesh Components.
Currently cursors works fine, stopping distances are managed depending on the interaction types given on the “interactable” object (enemy, standing object …)


Although I have the “Press G” option activated at the moment, I will not be implementing gamepad/keyboard controls for movement.

As for the design question: for me personally the Diablo 3 approach just seems strange. It also avoids confrontation as you could just shoot from a million miles away, which is kinda OP.
I’m more used to the way Torchlight does it. Some skills that you can fire from anywhere, but in general move closer. As the player improves he may built his build so that the range increases, maybe…