TL;DR
Note: You can read "Mechanical Balance" only, if you only care for a traditional answer.
- Carpal Tunnel Syndrome is a thing. Avoid repetitive smashing buttons.
- Improving accesibility will help everybody (Curb-cut effect).
- Do not think of accesibility options as cheating.
- Allow to change keybindings. If possible, multiple keybindings for a single command. If possible, across multiple input devices.
- Allow melee to do something that ranged attacks cannot do.
- A command is not a verb. Think in terms of verbs, not input commands. Well, actually, both.
- Construct combos instead of botton smashing.
See also:
Other accesibility settings:
- Target snapping while aiming.
- Auto aiming. For peole who do not have mouse, or do not have good aim.
- Slow game. For people with slow reaction timing.
Note: you can change your scoring system or even disable it (and archivements if you have them) when using these settings.
Introduction
As game developer you should be able to put forth the vision you have for the game. And that vision can include making it difficult.
In favor of allowing more people to enjoy the game, I would like to interest you in the idea of assit mode. Not really related to the melee and ranged problem. So have a video: What Makes Celeste's Assist Mode Special | Game Maker's Toolkit.
Sometimes the distinction between a diffulty setting, an accesibility feature, and a cheat, is a matter of presentation and culture. After all, in the lack of proper accesibility features, people may turn to difficulty settings or cheats. Do not be condescending. A player with a disability does not need to be labelled a cheater, or be mocked. By principle of giving the same experience to everybody.
Carpal Tunnel Syndrome
Carpal tunnel syndrome is - in my opinion - the most relevant condition for this case. In modern office work, it is often associated with the use of the mouse. In particular, fast clicking for long periods and improper posture. It will also happen with the keyboard.
While, arguebly, people should be taking measures to prevent the syndrome (which may include using wrist support and not playing your game), it is preferible to make your game accesible even to people who have it. By the (Curb-cut effect), we will be helping others that do not have the condition. I will not elaborate on how, brevity eludes me, and this answer is already long as it is.
We want to:
Spread the work, so people are not pressing the same key all the time.
To do this, it is useful to balance melee and ranged attack. However, that is not the only thing we will do. We will also allow the player to remap the keybindings.
Avoid the need for quick repetitive input.
To do this, we need to stop thinking in terms of input commands. This will not only mean less click-click-click, but will also open to you the posibility of structured combos.
Another thing you can do, is have the option to slow down the game (not as a power up, but as a setting).
Give natural exit points, so people can put down the game.
This, of course, is not directly related to the melee and ranged problem. So, have another video: Exit Points - Putting Down the Game - Extra Credits.
Mechanical balance
I think Jimmy gave a great answer, so go read that.
Evidently, melee weapons are not useful at range. This means they got to outshine ranged attacks at short distance. The issue is that ranged weapons would be effective in close combat.
What we want is to make the melee weapon faster. I want you to think in terms of speed. Not fire rate, mind you, but dead enemies per second.
How do you do that?
Better melee:
- Melee is stronger (more damage = more kills).
- Melee can do combos. No, no click-click-click. Go read about Verbs below.
- Allow a single melee attack to hit multiple enemies (possibly stunning enemies, probably with low damage per enemy and potentially with high damage per attack - adding across all enemies, and may kill multiple at once).
Handicap ranged attacks:
- They have spread and recoil.
- Ranged attacks are slower (low fire rate => less kills)
- Ranged attacks use wind up (like Mega Man, or like a bow, or like
Futurama
Fallout 4 laser guns)
- They require ammo.
But that is thinking insde the box. Numerical differences only go so far. I would like to advocate for diffences in kind, in particular incomparable differences in kind.
Even if melee is perfectly functional, then comes ranged attack that can do all that melee can do, and also works at distance... Melee needs to be able to do something that ranged attacks cannot do.
Of course, combos. However, let us be creative consider some tropes:
Remap keybidings
The gun would be bound to the right mouse button [as a secondary attack] and the melee to the left mouse button [as a primary attack]
No. It is NOT good to hardwire acctions to pre-defined keybinding.
You should allow players to rebind these. At least to the keyboard, to game pad if possible. In fact, I will advice to allow to map commands to two different bindings. That way, I can have a way to do them with either hand.
Futhermore, if you can allow to spread bindings across multiple input devices (something that few games do), this will not only help people with carpal tunnel syndrome. It will also help people with other disabilities, for example, if you can only use one hand or if you need to play with your feet.
Given that you have bound attack to the mouse, and given this is an (action) platforming game. I am guessing, that you have bound input to ASDW or to cursor keys. Those should be configurable too.
I also suspect you aim with the mouse. Thus, some options to consider are aim snapping and auto aiming. Yes, I know that makes ranged attacks better, we will balance it, Ok? Ok.
Verbs
Let me talk you about verbs.
What is a verb?
A "verb" is an abstraction of the physical interaction with the input device. There is an actual physical interaction (pressing a button, for example), and you get a representation of that in your game. We want to disassociate that representation from what the physical interaction actually was (we do not care what button you pressed, just that you did the thing that you configured the game to recognize). That way we abstract the input, and that is how we get to a verb.
We will label the verb according to what it is intended to do (and that is what we tell the user they are configuring). Therefore, we can say that we have a verb to "jump". However, the verb is not the action; in fact, it is not the command.
In some games, you have one to one relationship between verb and command. In addition, when that happens we can treat them as the same thing. However, commands can be composed of multiple verbs.
Furthermore, verbs may not be discrete. For instance, these inputs we can understand these as different verbs:
- Press a button
- Hold it for a given amount of time
- Release the button
Alternatively, they might be the same verb. That is up to the game.
Addendum: While a command can be composed of multiple verbs, it is also true that a single verb could translate to multiple commands. For example, holding a button could translate to repeated commands to fire.
The advantage of verbs is that you can program how verbs are executed disasociated from how you input them.
First, let us consider the action "run" (as in, moving fast: sprinting, running, jogging※). There are a few common solutions:
- You hold a key to run, and the direction you want to run. (Key combination)
- You double tap the direction you want to run. (Double press)
- You hold the direction, and after a short while, the avatar start running. (Hold over time)
Some games will have you tapping a botton, or even alternating tapping two bottons to run. Those are not common.
※: Not claiming these to be the same, but whatever you have in the game.
The linked video above will expand on "jump", but I want to mention that there are two common conventions for jump: using the vertical direction, and using a dedicated key. The correct approach is: no matter. You should be able to map these however you want.
Verbs become more interesting when you can mix them. With these two you already have the running jump, and the double jump, and with enviromental context you have wall jumps. But, let us talk about attacks...
Melee attack verbs
Here is something that ranged attacks cannot do...
Evidently, there will be a key for melee attack. A common command is the rush attacks (a.k.a. consecutive normal punchs), archived by pressing the attack key repreatedly. I need you to think in terms of verbs. This is not attacking fast, this is a different kind of attack, which is often reached by quick presses.
However, the animation does not have to be one hit per press. And
you do not need to require the player to press faster for better damage, instead you can require the player to keep a particlar rhythm, and the higher the damage the closer you match the rhythm. The attack would end if you fall off the rythm too much (or simply stop pressing for a short while).
Other combinations of verbs:
- Jumping attack. It can take a different form, some common versions are a diagonal doward kick and a spin attack. You can have both: Jump + Attack = spin. Run + Jump + Attack = kick.
- Running attack. Usually a dash.
- Holding attack. Could be blocking attacks, could be charging. Could be both, for example, each blocked attack adds to the damage of the attack you do when you release.
- Slam attack. Smash the grown, hits nearby enemies. Usually Jump + Down + Attack. Some games just use Jump + Attack.
Also, consider context sensitive moves. I have already mentioned one: finishing an unalerted enemy.
So, one context to consider is the state and distance of the enemies. In that example, an unalerted enemy can be finished in one hit. However, an alerted enemy gets a regular attack. What if the enemy is attacking? The melee attack could knock down their weapon (parry/unarm/steal weapon).
Another context to consider is what you where doing before the attack. For example, a quick change of direction before (in a small time window) the attack can be a different attack. Being something you would in when surrounded by enemies, this can be a ground spin attack... It could even be different if you were running or not. For example, it can be a ground sping when not running, but a backflip when running, it could even push enemies up to air if they are cough infront of the backflip.
Addendum: Also consider quick time events.
Melee ammo
Some attacks may have a resource. Although, it is often the case that ranged attacks require ammo. Some special melee attacks could have their own resorce. That way, when the player has the resource, will want to use melee (or may want to save it for a difficult battle).
You can put special attacks on a hit counter, so that you do not use them all the time. That is, you load up your hit counter before being able to use the special attack (thus, arguably, the hit count is a resource).
It could be the case that you want to load your melee hit count to have the attack ready before entering an area, encouraging the player to use melee in the previous area.
Combos
There are three common approaches for combos:
- Pressing buttons fast. Please, don't.
- Timing. This is ok for the rush attack. It will not work well for other things because it becomes a waiting game.
- Mixing verbs and timing. This is what we want.
Combo would have some reward (usually better damage, but it could be more loot, or simply more score). I mention this because you can leave the combos be emergent or scripted, however we want to have an incentive to use them.
Addendum: If the combos are emergent, the game needs to be aware of them, or more precisely, of the context of each attack, that is what was the previous
attack, how much time ago, to what enemie (was it the same enemy?) and what is the state of the enemy. And then, it can reward you.
Taking a page from the design of Devil May Cry. You can throw enemies into the air, jump to meet them, smash them down, and land on them with another melee. It can be more interesting if you have a way to pull enemies to you.
Taking another page... your raged attack is a verb you can mix. There are two main blueprints for these combos:
- Using a mele attack, throw enemies into the air, then shoot them.
Mega Man Jump and shoot enemies from the air, and land with melee.
Once you consider these, you will also consider jumping to with them, then pushing them down, and then shooting them from the air, landing with melee, and then repeat.
For ranged attack, it can be useful to be able to (if not have something like bullet time) slow down the fall of a jump. If you lack another input command for something like this, consider the use of holding melee to slow down falling. It will allow you to jump, slow down the fall, aim and shoot. And will also allow a bit more vesatility in platforming.