Jump to content

Changes to Water Combat


Ozzy

Recommended Posts

Although hard to enforce, the way it was on Delta originally was that navy models (PDSS, SEAL) could stay underwater forever, but non navy models could only stay under for 30 seconds or something like that. I think that if automated by dealing damage to anyone underwater for longer than a set amount of time it could help with the problem of "sharking" all war long. +1

  • Agree 1
Link to comment

Option C seems like the worst of these just because it would be a pain to enforce. My favorite would be option B because would everyone would get a knife that could be used to counter the people that hide in the water and would let them have it for other uses outside of water. Option A  would probably be the best solution to this issue making so that you have to show your head at some point if your in the water for a long period of time. Would make combat around the river more interesting and make using the river as a way to flank more of challenging task. So big +1 to option A or B

  • Like 1
Link to comment

Honestly, I think options A and B are the best to go with considering if you are in the water with someone who haves a knife you are still out donated and a knife could be a nice addition to MRP and I don’t see a lot of downsides it would also be another thing to see regiments having training sessions for knife/hand to hand combat or something like that.

Edited by horsegarrysmod
Link to comment

The script you included doesn't have a system to recharge oxygen. All it takes is one second outside of water and your oxygen is reset. It wouldn't take too long to implement, but that means more data manipulation.

If Solution A is what the community would like (and Garnet would like to implement), I can look into writing something more flexible and easier to read that should help speed up it being added.

  • Like 2
  • Friendly 1
Link to comment
  • MilitaryRP Super-Admin
13 minutes ago, Torch said:

I can look into writing something more flexible and easier to read that should help speed up it being added.

That would be great, Fier. Ideally:

- It would have a small hud indicating oxygen level. Either just while submerged or always visible. I can gather community input.

- A DoT effect once you run out of oxygen that occurs say every 0.75 - 1 second.

- A maximum (to get back to full oxygen from zero) recharge rate > 10 seconds at the minimum

- Maybe a server-side sounds that plays locally once a player starts to “drown”

Link to comment
5 hours ago, 0zzy said:

Solution A - An oxygen system. That way, players would have to come up for air and actually allow themselves to be shot/seen. This will also help with the busted safety blanket that is the river. The surface of the river is completely opaque, allowing for someone to traverse it in it’s entirety without being seen. Addon will be linked in Additional Info.

With this, I just worry that it would restrict another fun aspect of the server (being a shark during war) and that's why I'm more for solution B.

5 hours ago, 0zzy said:

Solution B - Put a very basic/ugly combat knife on every class. That way everyone will have a weapon that’s usable underwater. I don’t see this decreasing donator knife sales as those are bought for the aesthetics 99% of the time.

This, in my opinion, would even the playing field in water combat and not require us to consider either solution A or C. +1 for B.

5 hours ago, 0zzy said:

Solution C - Make combat underwater FailRP. Pretty self-explanatory.

I wouldn't make this FailRP, mostly because it's a plausible form of combat, but I'd consider it if we can't get either A or B implemented.

Edited by JimTrash
  • Like 1
Link to comment

+1 I think a oxygen system would be fair, reason being is that people from the surface no one can see them unless their directly above them even still its still hard to even see people in water. And the river is one of the US's main flanking source. Then there's the sharks that roam the water for god knows how long. 

1 minute ago, JimTrash said:

With this, I just worry that it would restrict another fun aspect of the server (being a shark during war) and that's why I'm more for solution B.

and i get where you're coming from. But I don't think personally i have loads of fun swimming around then like a group of 2 come charging at me with a knife. and if everyone has a knife then that leads to more people being sharks and that leads to more people just camping in waters with knives in packs of 2-3 and it does give the RU more of an advantage specially with how much we already get base camped. 

Link to comment
  • MilitaryRP Super-Admin
27 minutes ago, JimTrash said:

With this, I just worry that it would restrict another fun aspect of the server (being a shark during war) and that's why I'm more for solution B.

 

I don’t see the fun in it tbh. Even so, those in the water have such a strong advantage as they can see out but those going into the water have no idea. Solution A would require those who “shark” to come up for air, revealing themselves to those watching the river.

You mentioned it’s a plausible form of combat, which is true. However aesthetically, only the Frogmen Tactical and Medic whitelists are equipped to be underwater for longer than a deep breath. If at the end of the day you want the Seal and Frogmen classes to be coded better oxygen levels, I could accept that and I’m pretty sure it’s feasible. More work for Fier but feasible.

Link to comment
28 minutes ago, 0zzy said:
 

I don’t see the fun in it tbh. Even so, those in the water have such a strong advantage as they can see out but those going into the water have no idea. Solution A would require those who “shark” to come up for air, revealing themselves to those watching the river.

You mentioned it’s a plausible form of combat, which is true. However aesthetically, only the Frogmen Tactical and Medic whitelists are equipped to be underwater for longer than a deep breath. If at the end of the day you want the Seal and Frogmen classes to be coded better oxygen levels, I could accept that and I’m pretty sure it’s feasible. More work for Fier but feasible.

Easily done. Could be model related (so that you could have players be given temporary wetsuits and such through in-game credits or vending machine), or related to their actual team/class.

 

I've gotten most of the server portion completed - still need to do some testing to make sure that it works before I move onto the clientside stuff. The settings are easy to change, but by default they work like this:

- Maximum oxygen: default is 100.

- Drowning tickrate, in ms: default is 1000 (so every second).

- Oxygen loss per tick under water: default is 10.

- Damage per tick under water with zero oxygen: default is 20.

- Oxygen gain per tick above water: default is 3.

 

So it takes 10 seconds to drown (before you take damage) and you have 5 seconds to resurface before you actually drown (take damage), for a total of 14 under water (leaving you at low hp). Takes around 35 seconds to regain all of your oxygen from 0 to 100. 

 

All of the clientside stuff will be toggleable (through the use of convars), as people would prefer some sort of customization.

- HUD (plus whether or not to only draw if in water)

- Post processing (DoF, some color correction)

- Sounds

Edited by Torch
  • Winner 1
Link to comment

Opted for more basic post processing effects (colour, contrast, and slight motion blur) since I couldn't figure out how to do a DoF effect. I did some rebalancing and changed some of the default values as well.

You lose 8 oxygen per second, giving you 12 seconds before you start taking damage. Sounds start after you hit 50 oxygen and stay in the water (about 6 seconds in). You lose 15 health per second when you run out of oxygen. After you resurface, it takes around 25 seconds to fully regenerate your oxygen (you gain 4 per second). Times may need modified to work with a lower tickrate.

 

Note that this was tested on a 60 tick dev server and worked as expected, so it could work differently when implemented. The only issue I had was getting sounds to play locally but from the server - sometimes it wasn't consistent and the sound wouldn't play, but there was no easy way to do it from the clientside. This also makes use of SetNWInt and GetNWInt, which may not be functional on GG.

Here's an uploaded version in case people want to mess around with it in singleplayer or local servers: Google Drive - just place the oxygen_sys folder into your addons folder

 

EDIT: Forgot to add this, but the HUD is located at the bottom of your screen. It looks like this:

unknown.png

EDIT 2: Forgot the convars too, even though you can read them in the script.

gg_oxygen_hud - default is 1; whether or not to show the HUD

gg_oxygen_hud_inwater - default is 0; whether or not to only show the HUD if the player is standing in any bit of water

gg_oxygen_post_processing - default is 1; whether or not to render low oxygen effects (colour, contrast, motion blur)

gg_oxygen_sounds - default is 1; whether or not to play (local) sounds when you're close to drowning

 

And just in case, here's the entire script - both server and client sides (it is almost 200 lines long):

Quote

GGOxyCfg = {
  ["oxygen"] = 100,
  ["drown_rate"] = 1000, -- in ms
  ["drown_by"] = 8, -- ([oxygen] / [drown_by]) * [drown_rate] = how long it takes to drown. in this case, ~13 seconds (12,500 ms)
  ["drowning_damage"] = 15, -- how much damage to take every [drown_rate] if the player has zero oxygen. replace with a table of two numbers to create random damage, ie. {15, 20}
  ["regen_by"] = 4 -- ([oxygen] / [regen_by]) * [drown_rate] = how long it takes to regen. in this case, 25 seconds (25,000 ms)
}

if CLIENT then

  -- Client specific settings
  GGOxyCfg["hud"] = CreateClientConVar("gg_oxygen_hud", "1", true, false, "Draw the oxygen HUD", 0, 1)
  GGOxyCfg["hud_inwater"] = CreateClientConVar("gg_oxygen_hud_inwater", "0", true, false, "Only draw the oxygen HUD when in water", 0, 1)
  GGOxyCfg["post_processing"] = CreateClientConVar("gg_oxygen_post_processing", "1", true, false, "Toggle post processing when drowning", 0, 1)
  GGOxyCfg["sounds"] = CreateClientConVar("gg_oxygen_sounds", "1", true, true, "Play sounds locally when drowning", 0, 1)

end

//
////
//

if SERVER then

  local oxy_cached_sounds = {}

  if timer.Exists("GGOxygenDrownTimer") then
    timer.Remove("GGOxygenDrownTimer")
  end
  timer.Create("GGOxygenDrownTimer", GGOxyCfg["drown_rate"] / 1000, 0, function()

    for _, ply in pairs(player.GetAll()) do
      if ply:IsValid() then

        if not istable(oxy_cached_sounds[ply:SteamID64()]) then
          local ply_filter = RecipientFilter()
          ply_filter:AddPlayer(ply)

          oxy_cached_sounds[ply:SteamID64()] = {
            [1] = CreateSound(ply, "player/pl_drown1.wav", ply_filter),
            [2] = CreateSound(ply, "player/pl_drown2.wav", ply_filter),
            [3] = CreateSound(ply, "player/pl_drown3.wav", ply_filter),
          }
        end

        local waterlevel = ply:WaterLevel()
        if not ply:Alive() then
          if ply:GetNWInt("gg_oxygen", 0) != GGOxyCfg["oxygen"] then
            ply:SetNWInt("gg_oxygen", GGOxyCfg["oxygen"])
          end
          continue
        end

        if ply:HasGodMode() then continue end

        if waterlevel > 2 then
          ply:SetNWInt("gg_oxygen", math.Clamp(ply:GetNWInt("gg_oxygen", GGOxyCfg["oxygen"]) - GGOxyCfg["drown_by"], 0, 100))
        else
          if ply:GetNWInt("gg_oxygen", GGOxyCfg["oxygen"]) < 100 then
            ply:SetNWInt("gg_oxygen", math.Clamp(ply:GetNWInt("gg_oxygen", GGOxyCfg["oxygen"]) + GGOxyCfg["regen_by"], 0, 100))
            continue
          end
        end

        local oxygen = ply:GetNWInt("gg_oxygen", GGOxyCfg["oxygen"])
        local play_sound = tobool(ply:GetInfoNum("gg_oxygen_sounds", 0))

        if oxygen <= 50 and oxygen > 0 and waterlevel > 2 then
          if play_sound then
            oxy_cached_sounds[ply:SteamID64()][math.random(2, 3)]:PlayEx(1, math.random(100, 120))
          end
        end

        if oxygen <= 0 and waterlevel > 2 then
          local damage = GGOxyCfg["drowning_damage"]
          if type(damage) == "table" then
            damage = math.random(damage[1], damage[2])
          end
          ply:SetHealth(ply:Health() - damage)
          if play_sound then
            oxy_cached_sounds[ply:SteamID64()][math.random(1, 2)]:PlayEx(1, math.random(90, 100))
          end

          if ply:Health() <= 0 then
            ply:Kill()
            if play_sound then
              oxy_cached_sounds[ply:SteamID64()][3]:Play()
            end
          end
        end
      end
    end

  end)

end

if CLIENT then

  local setcolor = surface.SetDrawColor
  local drawrect = surface.DrawRect

  local oxy = 0

  local function OxygenHudPaint()

    local LP = LocalPlayer()
    if not LP:IsValid() then return end

    local should_draw = tobool(GGOxyCfg["hud"]:GetInt())
    local requires_water = tobool(GGOxyCfg["hud_inwater"]:GetInt())

    local oxygen = LP:GetNWInt("gg_oxygen", GGOxyCfg["oxygen"])

    if should_draw then

      if requires_water and LP:WaterLevel() < 1 then
        return
      end

      if oxygen >= 100 then
        return
      end

      local w, h = ScrW() / 3, 16
      local x, y = ScrW() / 2 - w / 2, ScrH() - h - 8

      setcolor(25, 25, 25, 150)
      drawrect(x, y, w, h)

      oxy = Lerp(8 * FrameTime(), oxy, oxygen)

      setcolor(240, 240, 255, 200)
      drawrect(x, y, (oxy / GGOxyCfg["oxygen"]) * w, h)

    end

  end
  hook.Add("HUDPaint", "OxygenHudPaint", OxygenHudPaint)

  local color_mod = {
    ["$pp_colour_addr"] = 0,
    ["$pp_colour_addg"] = 0,
    ["$pp_colour_addb"] = 0,
    ["$pp_colour_brightness"] = 0,
    ["$pp_colour_contrast"] = 1,
    ["$pp_colour_colour"] = 1,
    ["$pp_colour_mulr"] = 0,
    ["$pp_colour_mulg"] = 0,
    ["$pp_colour_mulb"] = 0
  }

  hook.Add("RenderScreenspaceEffects", "OxygenScreenspaceEffects", function()
    local LP = LocalPlayer()
    if not LP:IsValid() then return end

    local oxygen = LP:GetNWInt("gg_oxygen", 100)
    local draw_effects = tobool(GGOxyCfg["post_processing"]:GetInt())

    if draw_effects then

      if oxygen < 33 then
        color_mod["$pp_colour_colour"] = math.Clamp(oxygen / GGOxyCfg["oxygen"] * 3, 0.5, 0.99)
        color_mod["$pp_colour_colour"] = math.Clamp(oxygen / GGOxyCfg["oxygen"] * 3, 0.5, 0.99)
        DrawColorModify(color_mod)
        DrawMotionBlur(math.Clamp(oxygen / GGOxyCfg["oxygen"] * 3, 0.1, 0.5), 0.5, 0.05)
      end

    end
  end)

end

 

 

Edited by Torch
  • Like 2
  • 300 IQ 2
Link to comment

+1

I Would make a short reply about why i agree with this, but I will make a more detailed one for each of the options.

Option A: This option makes some sense in theory for some classes. For example DEVGRU's members killing players underwater would simply turn into submarines, having to go up every now and then, and the same goes for PDSS. while the drowning system would apply greatly with 2GA, Army, GB and the other non-Amphibious factions it also kinda defeats the purpose of DEVGRU and PDSS as both are underwater combat units. However including this system would bring some level of fairness as those who are forced to surface would be visible to all on the ground.

Option B: Including a knife for all classes may pose a problem; While a ugly knife might encourage players to get a donator knife, the knife itself would have to be nerfed. More specifically the damage would need to be decreased since the knife will be free and everyone would get one. Without the knife damage being decreased I feel players would not really find a big need to buy a donator knife since they would already have a knife that does the same amount of damage as the donator; It would just feel like they are buying a reskinned and or different version of the same, free knife they already have. It would kinda have to be the same as Army's M60 and the donator M60; one is bad, and the other is amazing.

Option C : Making Underwater combat failRP make literally no sense; I kinda said this for option A but it would defeat the purpose on DEVGRU and PDSS for underwater combat. Making underwater combat FailRP for non-amphibious player models and faction makes more sense then making it FRP for all including the factions that IRL, specialize in underwater combat. While it wouldn't be impossible to enforce, it also makes no sense to make it FailRP role play wise. Anti-frogmen techniques does exist IRL, the Italians even had a frogmen unit in WW2.

 

In conclusion: I am leaning more towards A and somewhat B; for A, It makes sense to not have people camping in the water the whole time. And B, New players have a way to defend themselves if they were to get in contact with a Seal or frogman and it would provide them a melee weapon, though as I have mentioned, that knife would have to be nerfed so people would buy a donator knife for the server. This suggestion is pretty good my man, I will defiantly be rooting for option A!

Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use | Guidelines