Ranged combat...

What do you think would be the best way for ranged combat to play out in an RPG style game?

The simple way would be for it to be the same as melee; attack with a crossbow and attack with a sword usesthe same mechanics, but perhaps different stats, but I feel there should be more to it.

Text adventures do not track position ithin a room, so how do you determine range? Would it be enough to say combats start "at range", and only ranged weapons are useful, and either can take a turn to advance to "close combat", at which point ranged weapons are either not allowed or have a severe penalty. That would mean that if you find a foe armed with a gun, your best option is to charge in and attack withyour knife, which is not that realistic, but seems to be the case in some RPGs.

What about cover; how is that meaningful? If there is a crate in the room, who gets to use it as cover?

Any other thoughts? Anyone come across cool mechanics in a game?


Hey Pixie love all the work you have done and not near as good at this as you are but was thinking maybe like you stated above with melee but also add a look feature in directions for enemies that would then allow you to make a ranged attack. Example(You are in a room 3 exits each with look direction, If enemy is in room you see "Enemy" making him reachable with ranged attacks. Could also add a little flavor like once shot an enemy he moves to your room, we can go a little further by adding a stealth % if shooting with silent ranged(bow) then only % chance for enemy to move to your room.) Well its a little scattered but hope you get the gist of it plus their probably alot of better ways to do that if possible.

Edit: You could also add a perception stat like DND with greater chances seeing enemies, make it harder at first and as they level the skill add chance to see enemy.

Mike


Could you just change the alias/name of the mob from Goblin Archer: 10m to Goblin Archer: 5m to Goblin Archer: 1m? Then you could add attributes to the monster object (based on that alias) that deliver different results when different weapons are used? Code-wise, I am not certain how to implement it, but if I were you (and I don't wish that on anyone!) that's probably how I would explore it.

As far as cover goes, perhaps a timer runs when entering a room. If you choose 'hide behind crate' within the time range, you claim the cover (or other battle bonus?) and the 'cover' attribute/flag is tacked to your character. If not, it is tacked to the monster NPC. When attacking/defending cover can be checked to influence results. That's a lot of 'Ifs', I know. =)

Sadly, I have not really come across a game with similar mechanics.

Good luck!


I've struggled with ranged/projectile combat too... are there any online/free resourcs/sources which discuss ranged/projectile combat?

as in games which have a range/reach/distance mechanic (aka: for both melee and ranged/projectile):

Grandia 1 (PS1) and Parasite Eve 1 (PS1) are good examples. Well, Grandia 1 is more transparent about the mechanics, anyways (Parasite Eve 1, not so much). And of course, there's the Fallout games (at least Fallout 1 and 2, as I've not played, nor even seen vids of Fallout 3+4 yet, lol), and of course there's the Diablo games as well. See/google 'jarulf's guide' for a look at diablo 1's mechanics, such as ranged/proejctile attacks, or the other combat mechanics too.

Grandia 1 has some really cool combat mechanics, of course a Text Adventure can't use the full coolness of these mechanics (the mechanics work well in/for its 3d movement and running-time/non-static turn-based combat), but the mechanics themselves can be used. See vids of it, to see what I'm trying to describe failingly, lol.

I just can't emphasize Grandia 1 enough, it has arguably the best combat system mechanics of all time. It's really amazing, lots of complexity, but so flawless/seemless !!! TRUE PERFECTION !!!


I think the main mechanics are these:

(these can be applied to all forms of combat: melee, ranged/projectile, spells, and etc)

attributes which are used to determine the distance between actors
attributes which are used to determine actors' movement amount (how far they can move towards or aways from each other)
attributes which are used to determine a weapon's range/reach/length
attributes which are used to determine a weapon's speed/quickness/rate-of-fire/swing-attack-speed ---
attributes for a recovery/recoil/delay/wait time before can attack/swing/shoot again
attributes for a dodge/evasion/parry/block "animation" wait-time if attacked

and many more probably...


I'm more unsure of how to handle/design how the "ammunition" works/aspects with ranged/projectile combat...


P.S.

@ onimike:

nice points, about environmental, cover and darkness, and steath machanics, and a 'perception' stat/attribute.

I forgot about these mechanics in the Fallout games (1 and 2, anyways)


also, with ranged/projectile combat:

piercing/penetration mechanics, as well

damage types: concussive/explosive (grenades, etc), fire (motolov cocktail, flame thrower), piercing/penetrating, etc etc etc


Thanks HK. Something I was wondering myself which would help this situation as well is grid based movement which I have seen a few things on. I would like to if there's a way to make a room 10x10 "squares" and be able to move x amount of squares for speed. Not sure if that's a thing or even possible, but think that would make these situations much easier.

Mike


the coding is basically the same as math/geometry/algebra/trig/calc, using the grid/coordinate system concept, giving your rooms and/or objects in those rooms, 'dimension (x,y or x,y,z) coordinate' Attributes, but you got to work in the coding/math for implementing it, which will take quite a bit of thinking, depending on how good you're with math/grids, and how well you know coding too. Code like it's a math class using grids/coordinates, points, and etc. You basically have to code in your grid, coordiniates/locations, and etc into your rooms and/or their objects, and the actors/characters.

-------

if you just need/want the distance in terms of your character and monster, then I'd just have whatever mechanic/equation/formula/attributes determine your initial distance from each other, and then you can adjust those, as you and the monster move towards or aways from each other.

Involving more stuff, means more locations/coordinates and etc of stuff.

-----

basic/simple graphic coding involves creating a 'Point whatever (x-coordinate, y-coordinate)' Object, which you can then use that for creating a 'Line AB (Point A, Point B)', and then you an use lines to build your other shapes. Circles --- smart people have already created them for you, so you just need to provide a 'radius' and it's center coordinates (x,y), and it'll create/generate the circle (2*pi*r = circumference), at least this is how it's set up with Python, anyways. It was a fun class practicing some simple graphing coding. Our final was to create lines to divide the screen up into grids and then we had to create shapes in the center of those grids, using universal formulas, which just use offsetting from the screen's dimensions (for example to get the points to draw lines into 4 quadrants, you'd just -generally- do: screen x length / 2 and screen y length / 2)

(I've no idea how to code in a circle/curves... myself, unless that curve is really just small angles/lines, which look like a curve, meh...)

-----

and for the rooms, you just give them their dimensions: 'x-coordinate, y-coordinate' Integer Attributes.

-----

just like with math/grid/coordinates, once you got 'coordinate' Integer Attributes , you can do the same math/grid arithmetic for the programming, for example, getting the slope:

// pseudocode:
game.slope = (Object 2's 'y-coordinate' - Object 1's 'y-coordinate') / (Object 2's 'x-coordinate' - Object 1's 'x-coordinate')

-----

it's really just math, but done via coding:

if player is at (0,0) and monster is at (0,10), then the monster is 10 units north/up (using x,y grid) of you. The difference of: 10 - 0 = 10

---------

take for example, (simple) pathfinding:

let's say we want our monster in room 99, to move towards the player in room 1, and the player of course will be moving to different rooms

well, if all of our, rooms and you and monsters and npcs, have an 'x,y' Integer Attributes, then we can use the if comparison:

(really poor code, just giving a quick idea of it)


<turnscript name="simple_grid_coordinate_pathfinding">

  if (not monster.parent = player.parent) { 

    if (player.x_coord > monster.x_coord) {
      monster.x_coord = monster.x_coord + 1
    } else if (player.x_coord < monster.x_coord) {
      monster.x_coord = monster.x_coord - 1
    }

    if (player.y_coord > monster.y_coord) {
      monster.y_coord = monster.y_coord + 1
    } else if (player.y_coord < monster.y_coord) {
      monster.y_coord = monster.y_coord - 1
    }

    foreach (room_object, game.room_list) {
      if (room_object.x_coord = monster.x_coord and room_object.y_coord = monster.y_coord) {
        monster.parent = room_object
      }
    }

  }

</turnscript>

------------------------

if you mean, giving your things/objects a 'hex grid' ("size"), that's a bit more math/code involved... due to dealing with all the mechanics/issues of it (overlapping, and etc) --- like in the diablo games

---------------------

it basically comes down to: how good are you at math/physics/algebra/trig/calculus/geometry/advanced-math (beyond calculus stuff), and your coding ability.

------------------

Jay and Pixie have pathfinding and random map/room creation libraries in the 'libraries and code sample' forum

For the game I was working on, the rule was simply that ranged weapons had the opportunity to go first, upon the encounter beginning. If neither combatant had a ranged weapon, it feel into the normal combat cycle. If one had a ranged weapon, it got to go first before standard combat began. If both had ranged weapons, then it was based off the standard speed calculations (plus whatever factors normally applied to determining which went first).

After that initial "ranged" phase before the first round, ranged weapons didn't matter.

You could almost make it where the only case you care about it where one is ranged and one not. In that case, the one with the ranged weapons gets a preliminary shot. Otherwise, it just falls to normal combat. (That assumes only two in combat. Naturally, if you had more, you'd need to allow all the ranged ones to go first in some sort of order.)

That might not cover what you wish, but it is one way to go that's fairly simple.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums