Closed ghost closed 9 years ago
This is a mayor issue and should be high up in your priority list, even before making non us keyboards work.
If it's that major, you can fix it.
The thing is, you don't constantly have grenades going off, so it's really not that major an issue, UNLESS you are talking about the sheer amount of VBO spam, in which case that's a known optimisation issue.
I would fix it, but I am not really worth anything at C. Unless it's in the lua part of the game, which I am learning right now.
It's in the Lua part.
great. Now I only have to learn the language, read the entire source, figure out where the part that spawns the particles is, how right clicked spade and grenade code is different, how to grab a additional value from the config, and commit it. Fun times ahead!
Have you heard of this wonderful thing called grep? It's great!
$ grep -Rni nade pkg/ pkg/base/network.lua:122: "NADE_THROW", pkg/base/network.lua:128: "NADE_PIN", pkg/base/network.lua:331:network.sys_handle_s2c(PKT_NADE_THROW, "BhhhhhhH", function (neth, cli, plr, sec_current, pid,x,y,z,vx,vy,vz,fuse, pkt) pkg/base/network.lua:334: local n = new_nade({ pkg/base/network.lua:345: nade_add(n) pkg/base/network.lua:378:network.sys_handle_s2c(PKT_NADE_PIN, "B", function (neth, cli, plr, sec_current, pid, pkt) pkg/base/network.lua:639:network.sys_handle_c2s(PKT_NADE_THROW, "hhhhhhH", nwdec_plrset(function (neth, cli, plr, sec_current, x, y, z, vx, vy, vz, fuse, pkt) pkg/base/network.lua:641: local n = new_nade({ pkg/base/network.lua:651: nade_add(n) pkg/base/network.lua:653: PKT_NADE_THROW,cli.plrid,x,y,z,vx,vy,vz,fuse)) pkg/base/network.lua:666:network.sys_handle_c2s(PKT_NADE_PIN, "", nwdec_plrset(function (neth, cli, plr, sec_current, pkt) pkg/base/network.lua:667: net_broadcast(neth, common.net_pack("BB", PKT_NADE_PIN, cli.plrid)) pkg/base/obj_nade.lua:19: mdl_nade, mdl_nade_bone = skin_load("pmf", "nade.pmf", DIR_PKG_PMF), 0 pkg/base/obj_nade.lua:22:function nade_add(nade) pkg/base/obj_nade.lua:23: nades.tail = nades.tail + 1 pkg/base/obj_nade.lua:24: nades[nades.tail] = nade pkg/base/obj_nade.lua:27:function nade_prune(sec_current) pkg/base/obj_nade.lua:29: for i=nades.head,nades.tail do pkg/base/obj_nade.lua:30: if nades[i] and nades[i].dead then pkg/base/obj_nade.lua:31: nades[i] = nil pkg/base/obj_nade.lua:32: if i == nades.head then pkg/base/obj_nade.lua:33: nades.head = nades.head + 1 pkg/base/obj_nade.lua:37: if nades.head > nades.tail then pkg/base/obj_nade.lua:38: nades.head = 1 pkg/base/obj_nade.lua:39: nades.tail = 0 pkg/base/obj_nade.lua:43:function new_nade(settings) pkg/base/obj_nade.lua:90: if x1 ~= x2 then this.vx = -this.vx_MODE_NADE_BDAMP end pkg/base/obj_nade.lua:91: if y1 ~= y2 then this.vy = -this.vy_MODE_NADE_BDAMP end pkg/base/obj_nade.lua:92: if z1 ~= z2 then this.vz = -this.vz_MODE_NADE_BDAMP end pkg/base/obj_nade.lua:93: this.vx = this.vx * MODE_NADE_ADAMP pkg/base/obj_nade.lua:94: this.vy = this.vy * MODE_NADE_ADAMP pkg/base/obj_nade.lua:95: this.vz = this.vz * MODE_NADE_ADAMP pkg/base/obj_nade.lua:98: this.vy = this.vy + 5_9.81_MODE_NADE_STEP_MODE_NADE_STEP pkg/base/obj_nade.lua:115: if MODE_NADE_VPL_ENABLE then pkg/base/obj_nade.lua:117: MODE_NADE_VPL_MAX_COUNT, MODE_NADE_VPL_MAX_RANGE, MODE_NADE_VPL_MAX_TRIES) pkg/base/obj_nade.lua:124: if MODE_NADE_VPL_ENABLE then pkg/base/obj_nade.lua:128: s = MODE_NADE_VPL_DIRECT_STRENGTH, d = 0.0, special = true} pkg/base/obj_nade.lua:146: if dd + v.d < MODE_NADE_VPL_MAX_RANGE then pkg/base/obj_nade.lua:158: local dmg = MODE_NADE_VPL_DAMAGE_1_v.s/(dd_dd) pkg/base/obj_nade.lua:175: if dd < MODE_NADE_RANGE_MODE_NADE_RANGE then pkg/base/obj_nade.lua:183: local dmg = (-(math.pow(dd / MODE_NADE_RANGE, 4)) + 1) * MODE_NADE_DAMAGE pkg/base/obj_nade.lua:211: if MODE_NADE_VPL_ENABLE then pkg/base/obj_nade.lua:223: dmg_blks[blk] = dmg_blks[blk] + MODE_NADE_VPL_BLK_DAMAGE pkg/base/obj_nade.lua:243: this.trem = this.trem + MODE_NADE_STEP pkg/base/obj_nade.lua:248: local lerp = 1-this.trem/MODE_NADE_STEP pkg/base/obj_nade.lua:256: client.wav_play_global(wav_nade_boom, this.x, this.y, this.z) pkg/base/obj_nade.lua:262: local nade_particlecount = math.random() * 10 + 20 pkg/base/obj_nade.lua:264: for i=1,nade_particlecount do pkg/base/obj_nade.lua:289: client.model_render_bone_global(mdl_nade, mdl_nade_bone, pkg/base/ent/expl_grenade.lua:22: this.mdl = mdl_nade pkg/base/ent/expl_grenade.lua:23: this.mdl_bone = mdl_nade_bone pkg/base/ent/expl_grenade.lua:28: this.t_nadeboom = nil pkg/base/ent/expl_grenade.lua:29: this.t_newnade = nil pkg/base/ent/expl_grenade.lua:46: function this.throw_nade(sec_current) pkg/base/ent/expl_grenade.lua:54: local n = new_nade({ pkg/base/ent/expl_grenade.lua:58: vx = fwx_MODE_NADE_SPEED_MODE_NADE_STEP+plr.vx_MODE_NADE_STEP, pkg/base/ent/expl_grenade.lua:59: vy = fwy_MODE_NADE_SPEED_MODE_NADE_STEP+plr.vy_MODE_NADE_STEP, pkg/base/ent/expl_grenade.lua:60: vz = fwz_MODE_NADE_SPEED_MODE_NADE_STEP+plr.vz_MODE_NADE_STEP, pkg/base/ent/expl_grenade.lua:61: fuse = math.max(0, this.t_nadeboom - sec_current), pkg/base/ent/expl_grenade.lua:64: nade_add(n) pkg/base/ent/expl_grenade.lua:66: PKT_NADE_THROW, pkg/base/ent/expl_grenade.lua:77: if this.t_newnade and sec_current >= this.t_newnade then pkg/base/ent/expl_grenade.lua:78: this.t_newnade = nil pkg/base/ent/expl_grenade.lua:81: if this.t_nadeboom then pkg/base/ent/expl_grenade.lua:82: if (not this.ev_lmb) or sec_current >= this.t_nadeboom then pkg/base/ent/expl_grenade.lua:83: this.throw_nade(sec_current) pkg/base/ent/expl_grenade.lua:84: this.t_newnade = sec_current + MODE_DELAY_NADE_THROW pkg/base/ent/expl_grenade.lua:85: this.t_nadeboom = nil pkg/base/ent/expl_grenade.lua:93: if (not this.t_newnade) and this.ammo > 0 then pkg/base/ent/expl_grenade.lua:94: if (not this.t_nadeboom) then pkg/base/ent/expl_grenade.lua:98: this.t_nadeboom = sec_current + MODE_NADE_FUSE pkg/base/ent/expl_grenade.lua:100: net_send(nil, common.net_pack("BhhhhhhH", PKT_NADE_PIN)) pkg/base/ent/expl_grenade.lua:144: return mdl_nade pkg/base/client_start.lua:453: for i=nades.head,nades.tail do pkg/base/client_start.lua:454: if nades[i] then nades[i].tick(moment, tickrate) end pkg/base/client_start.lua:462: nade_prune(sec_current) pkg/base/client_start.lua:882: for i=nades.head,nades.tail do pkg/base/client_start.lua:883: if nades[i] then nades[i].render() end pkg/base/common.lua:39: DIR_PKG_LIB.."/obj_nade.lua", pkg/base/common.lua:92:MODE_NADE_SPEED = 30.0 pkg/base/common.lua:93:MODE_NADE_STEP = 0.1 pkg/base/common.lua:94:MODE_NADE_FUSE = 3.0 pkg/base/common.lua:95:MODE_NADE_ADAMP = 0.5 pkg/base/common.lua:96:MODE_NADE_BDAMP = 1.0 pkg/base/common.lua:97:MODE_NADE_RANGE = 8.0 pkg/base/common.lua:98:MODE_NADE_DAMAGE = 110.0 pkg/base/common.lua:101:MODE_NADE_VPL_ENABLE = true pkg/base/common.lua:102:MODE_NADE_VPL_MAX_COUNT = 300 -- O(n_m) stuff, n == number of players, m == THIS pkg/base/common.lua:103:MODE_NADE_VPL_MAX_TRIES = 1000 pkg/base/common.lua:104:MODE_NADE_VPL_MAX_RANGE = 30.0 pkg/base/common.lua:105:MODE_NADE_VPL_DIRECT_STRENGTH = 1.0 pkg/base/common.lua:106:MODE_NADE_VPL_DAMAGE_1 = 2000.0 pkg/base/common.lua:107:MODE_NADE_VPL_BLK_DAMAGE = 30 pkg/base/common.lua:126:MODE_DELAY_NADE_THROW = 0.5 pkg/base/common.lua:169: wav_nade_boom = skin_load("wav", "nade-boom.wav", DIR_PKG_WAV) pkg/base/common.lua:209:EXPL_GRENADE = 1 pkg/base/common.lua:214: [EXPL_GRENADE] = loadfile(DIR_PKG_ROOT.."/ent/expl_grenade.lua")(), pkg/base/common.lua:218:explosives_enabled[EXPL_GRENADE] = true pkg/base/common.lua:292:nades = {head = 1, tail = 0} pkg/base/obj_player.lua:36: this.explosive = settings.explosive or EXPL_GRENADE pkg/base/obj_player.lua:2152: local vpls = vpl_gen_from_sphere(x, y, z, MODE_NADE_VPL_MAX_COUNT, MODE_NADE_VPL_MAX_RANGE, MODE_NADE_VPL_MAX_TRIES) pkg/base/obj_player.lua:2157: local rad = MODE_NADE_VPL_MAX_RANGE - v.d pkg/base/obj_player.lua:2160: r=math.min(255, math.max(1, rad_255/MODE_NADE_VPL_MAX_RANGE)), g =16, b = 16, pkg/base/main_server.lua:323: for i=nades.head,nades.tail do pkg/base/main_server.lua:324: if nades[i] then nades[i].tick(moment, tickrate) end pkg/base/main_server.lua:326: nade_prune(sec_current) pkg/iceball/halp/texts.lua:118:$pGrenade = throw
But yeah, you're looking to add a variable to common.lua and to wrap something in an "if" block in ent/expl_grenade.lua and/or obj_nade.lua.
Closing because of an issue purge. I stand by what I said, and if someone really wants this to be implemented they can do it themselves.
Plus the performance rot is solved already.
I was playing around with my newly aquired iceball-gl and noticed how incredibly laggy grenades are. Not because of the calculations and effects, but because of the particles generated by the block breaking.
to recreate:
I think it is possible to disable particles for a certain source, as the spade right click does not cause any particles