GMod - What are you working on? October 2017 (#74)
289 replies, posted
I got carried away with the jackpot... (You should have sound on)
[video=youtube;N3uiOL6LboI]https://www.youtube.com/watch?v=N3uiOL6LboI[/video]
[QUOTE=0V3RR1D3;52794971]I got carried away with the jackpot[/QUOTE]
Then dispenses $0
[QUOTE=MPan1;52787714]Minor update:
I made the bullet holes move with entities rather than being static on the map:
[video]https://youtu.be/cEpU9TZqnQI[/video]
As you can see, lag is still a problem though.[/QUOTE]
With entities, you can use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/ENTITY/RenderOverride]ENT:RenderOverride[/url] to not draw the holes in the first place, thereby not having to RenderView to draw the other side of holes (it would just be drawn as usual), and shaving off a huge part of the performance loss.
It can be tricky, especially if you want to see the same entity through the hole (like the dumpster in your video), but with clever use of clip planes it's 100% doable.
[video=youtube;4PM0i4HHEpY]https://www.youtube.com/watch?v=4PM0i4HHEpY[/video]
Finally got around to fixing up this gamemode and making it legitimately playable. Built ten levels very quickly with a buddy - it's a lot of fun! Controls exceptionally well up to about 100-120ms ping, but past that, precision navigation is a chore.
Dunno why the camera is a lot more fussy when rolling around on props as opposed to world geometry - it jitters a bit, but nothing that impacts gameplay to any extent.
Building levels is easy peasy - you create them out of props. If there's interest I may release the level saver I've made, so people can have a go at making their own. I'm going to be adding support for moving / animated pieces soon.
If you'd like to try out the prototype you see in this video, the server address is [b]bites.hopto.org:27016[/b]
[QUOTE=code_gs;52793615]Could you PM me the structure of generatedCells table? Your loop looks very slow.[/QUOTE]
Sent, thanks
[QUOTE=TNT3530;52798397]Sent, thanks[/QUOTE]
by the way, instead of
[CODE]
for _,e in pairs(table.GetKeys(tab)) do
[/CODE]
you should really just
[CODE]
for e,_ in pairs(tab) do
[/CODE]
table.GetKeys is a slow piece of shit that internally calls pairs for you anyway and creates yet another table iirc. Whenever you're using any gmod defined `table` library function, you really need to stop and think about what you're doing because 99% of the time it's not worth the performance drop or sphagetti code.
[editline]20th October 2017[/editline]
Yup:
[URL]https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/includes/extensions/table.lua#L706[/URL]
[CODE]
function table.GetKeys( tab )
local keys = {}
local id = 1
for k, v in pairs( tab ) do
keys[ id ] = k
id = id + 1
end
return keys
end
[/CODE]
don't ever use this
[editline]20th October 2017[/editline]
That entire loop could be rewritten from
[CODE]
for _,e in pairs(table.GetKeys(tab)) do
if (x .. "," .. y .. "," .. z) == e then
if tab[e]["Ground"] == ent:EntIndex() then
return true
end
if tab[e]["Random Spawn 1"] == ent:EntIndex() then
return true
end
if tab[e]["Random Spawn 2"] == ent:EntIndex() then
return true
end
end
end
[/CODE]
to
[CODE]
for e,v in pairs(tab) do
if (x .. "," .. y .. "," .. z) == e then
local ok = (
(v.Ground == e:EntIndex()) or
(v["Random Spawn 1"] == e:EntIndex()) or
(v["Random Spawn 2"] == e:EntIndex())
)
if ok then return ok end
end
end
[/CODE]
Have a nice addition to your string library: toLen():
[code]--------------------------------------------------------------------------------
-- Returns lengthened or shortened string given a string and length
-- @param str The string to lengthen or shorten
-- @param newLen The new length of the string
-- @param useEllipse Whether to truncate the string with an ellipse ('...')
-- if string has to be cut down to fit the desired length
-- @param fillChar The repeating character appended to str to fit the
-- desired length
-- @returns The lengthened or shortened string
--------------------------------------------------------------------------------
function string.ToLen(str, newLen, useEllipse, fillChar)
local len = string.len(str)
if (len == newLen) then return str end
if (len < newLen) then
fillChar = fillChar or ' '
for i = 1, newLen - len do
str = str..fillChar
end
return str
end
if (len > newLen) then
if (useEllipse) then
str = string.sub(str, 1, newLen - 3) .. '...'
else
str = string.sub(str, 1, newLen)
end
return str
end
end[/code]
I can't live without being able to print pretty tables like I would in C++ with setw() and setfill(), so I made a quick function that does both in a simple way.
Demonstration:
[code]> print(string.ToLen('wauterboi needs to take a shower', 16))...
wauterboi needs
> print(string.ToLen('wauterboi needs to take a shower', 16, true))...
wauterboi nee...
> print(string.ToLen('wauterboi needs to take a shower', 48, nil, 'x'))...
wauterboi needs to take a showerxxxxxxxxxxxxxxxx
[/code]
And how I'll be using it, really:
[code]Name: Date:
Action Jackson 05 Dec 1938
[/code]
Time for that shower!
[QUOTE=swadicalrag;52799175]
[CODE]
for e,v in pairs(tab) do
if (x .. "," .. y .. "," .. z) == e then
local ok = (
(v.Ground == e:EntIndex()) or
(v["Random Spawn 1"] == e:EntIndex()) or
(v["Random Spawn 2"] == e:EntIndex())
)
if ok then return ok end
end
end
[/CODE][/QUOTE]
Ok, Ill make sure to replace it everywhere else too. But it still shudders, even with just the [CODE]checkValidCellData(ent)
checkValidCellData(ent2)
if ent.CurX != ent2.CurX or ent.CurY != ent2.CurY or ent.CurZ != ent2.CurZ then
return false
else
return true
end[/CODE] running, no loops at all. Should I just change from shouldCollide?
[QUOTE=TNT3530;52799998]:snip:[/QUOTE]
is your ShouldCollide hook shared or serverside only? ideally it should be shared (it seems like the shuddering occurs because of prediction errors since the client doesn't have your new collision logic)
[QUOTE=swadicalrag;52800076]is your ShouldCollide hook shared or serverside only? ideally it should be shared (it seems like the shuddering occurs because of prediction errors since the client doesn't have your new collision logic)[/QUOTE]
That was it, thank you! I forgot I moved it to server only when I couldnt get it to work initially.
A while back I added the ability to load mdl files externally to PAC3.
This works by adding the model you want along with its assets to a zip file without compression, upload the zip file somewhere and put the url in the editor. Then there's some lua that reads the zip and creates a gma archive with the content.
The difficult part is that I have to "hex" the models to make them not collide with other models. So if you have an archive like this:
[code]materials/models/aw/body.vmt
materials/models/aw/body.vtf
models/aw/Asura.dx80.vtx
models/aw/Asura.dx90.vtx
models/aw/asura.mdl
models/aw/asura_animations.mdl
models/aw/Asura.phy
models/aw/Asura.sw.vtx
models/aw/asura.vvd[/code]
it gets turned into this
[code]materials/pac3/123456789/body.vmt
materials/pac3/123456789/body.vtf
models/pac3/123456789/model.dx80.vtx
models/pac3/123456789/model.dx90.vtx
models/pac3/123456789/model.mdl
models/pac3/123456789/model_inc_1.mdl
models/pac3/123456789/model.phy
models/pac3/123456789/model.sw.vtx
models/pac3/123456789/model.vvd[/code]
To do this I have to edit the mdl and vmt files in lua and change where it should look up its resources. This can also be loaded on the server so hitboxes and everything is correct.
Some examples of a player model and a non player model:
[img]https://i.imgur.com/NrDFh22.jpg[/img][img]https://i.imgur.com/W8uVyGQ.png[/img]
A long with this I've added some material parts to PAC3 that are closer to source engine.
[img]https://i.imgur.com/298kuR5.png[/img]
[img]https://i.imgur.com/5g75v8m.png[/img]
It should cover everything source engine can do, although I've manually renamed some properties to make them group together. I'll probably remove some properties that don't make sense or don't work in source engine at all, etc. I've done a lot already based on feedback from people experimenting.
This is the list of material parameters I've built [url]https://github.com/CapsAdmin/pac3/blob/master/lua/pac3/libraries/shader_params.lua[/url]
It was first semi automatically built based on source engine headers and then later on hand edited based on valve wiki. Maybe it's useful for the wiki?
I'm really happy that this has given some people the motivation to make models and animations in blender and whatnot. It's more of a useful skill in the real world than pac3.
[QUOTE=wauterboi;52799297]Have a nice addition to your string library: toLen() ..[/QUOTE]
Not trying to be a dick, but feels like you have overengineered that a bit. Also, for repeating strings, lua has the builtin function string.rep, I recommend using that instead of manual concatenation.
I have been using this little snippet for a while for the same purphose:
[lua]
function string.fit(str, size, char)
local len = str:len()
local char = char or " "
if (len <= size) then
return str .. string.rep(char, size - len)
else
return str:sub(0, size -3) .. " .."
end
end
[/lua]
[QUOTE=wauterboi;52799297]:snip:[/QUOTE]
You might also consider [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/string/format]string.format[/url], which allows for padding.
Remaking some gamemodes that GMT had
[video=youtube;mvY8qyUJgRU]https://www.youtube.com/watch?v=mvY8qyUJgRU[/video]
It's obviously not that good atm, I plan on fixing a lot, too
[QUOTE=lvivtotoroyt;52801989]some gamemodes that GMT had[/QUOTE]
So Super Monkey Ball then? Also if you plan on going all out on this, you better replace the bumper, as well as any assets pxeiltail made, or they'll throw a fit.
Also just gonna slide this in here.
[video=youtube;oM4vBT12Y5k]https://www.youtube.com/watch?v=oM4vBT12Y5k[/video]
Just some old bullshit that was canceled.
[QUOTE=MDave;52800829]Not trying to be a dick, but feels like you have overengineered that a bit. Also, for repeating strings, lua has the builtin function string.rep, I recommend using that instead of manual concatenation.
I have been using this little snippet for a while for the same purphose:
[lua]
function string.fit(str, size, char)
local len = str:len()
local char = char or " "
if (len <= size) then
return str .. string.rep(char, size - len)
else
return str:sub(0, size -3) .. " .."
end
end
[/lua][/QUOTE]
Both of you should be using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/utf8/len]utf8.len[/url] :)
[QUOTE=BlueSkilly;52802054]So Super Monkey Ball then? Also if you plan on going all out on this, you better replace the bumper, as well as any assets pxeiltail made, or they'll throw a fit.
Also just gonna slide this in here.
[video=youtube;oM4vBT12Y5k]https://www.youtube.com/watch?v=oM4vBT12Y5k[/video]
Just some old bullshit that was canceled.[/QUOTE]
Not just Super Monkey Ball.
And not to worry, I downloaded some free-to-use textures and made some of my own.
+ The bumper was remade by me as well, if you compare mine to theirs, you'll see mine is a lot shittier.
[QUOTE=lvivtotoroyt;52802084]Not just Super Monkey Ball.
And not to worry, I downloaded some free-to-use textures and made some of my own.
+ The bumper was remade by me as well, if you compare mine to theirs, you'll see mine is a lot shittier.[/QUOTE]
Yeah I'm pretty sure it's Super Monkey Ball, what else could it be?
Also, if they find out about this they'll bitch about how copyright is a tricky thing. So it's best to just make your bumper as different as possible. Seriously, remaking an asset 1:1 isn't avoiding anything. You're still using their design, so switch that shit up.
[QUOTE=BlueSkilly;52802101]Yeah I'm pretty sure it's Super Monkey Ball, what else could it be?
Also, if they find out about this they'll bitch about how copyright is a tricky thing. So it's best to just make your bumper as different as possible. Seriously, remaking an asset 1:1 isn't avoiding anything. You're still using their design, so switch that shit up.[/QUOTE]
No, I mean't that I'm remaking [B]most [/B]gamemodes from GMT, not [B]just[/B] Super Monkey Ball.
But, aight. I'll try switching the model to something else
[QUOTE=CapsAdmin;52800660]A while back I added the ability to load mdl files externally to PAC3. [/QUOTE]
Is this in the current workshop version, or just the develop branch of the GitHub? I tried both versions, and the model didn't load correctly. I got some of the parts where it was fetching lines or something, but it didn't appear in-game. Any idea what's wrong?
I have been hitting my head for like 4 hours, but hopefully this saves someone some time:
[CODE]local function LerpAng( frac, startAngle, endAngle )
local dif = math.abs( endAngle - startAngle )
if dif > 180 then
if endAngle > startAngle then
startAngle = startAngle + 360
else
endAngle = endAngle + 360
end
end
local newVal = startAngle + ( ( endAngle - startAngle ) * frac )
if ( newVal >= 0 && newVal <= 360 ) then
return newVal
else
return ( newVal % 360 )
end
end[/CODE]
[IMG]https://i.imgur.com/5GqoVHi.gif[/IMG]
[IMG]https://i.imgur.com/5GqoVHi.gifv[/IMG]
[QUOTE=MDave;52800829]Not trying to be a dick, but feels like you have overengineered that a bit. Also, for repeating strings, lua has the builtin function string.rep, I recommend using that instead of manual concatenation.
I have been using this little snippet for a while for the same purphose:
[lua]
function string.fit(str, size, char)
local len = str:len()
local char = char or " "
if (len <= size) then
return str .. string.rep(char, size - len)
else
return str:sub(0, size -3) .. " .."
end
end
[/lua][/QUOTE]
No need to apologise. Stuff like that helps. I didn't know about that function. :)
Working on importing World of Warcraft pets and some other models into Garry's Mod, animations included. Some of the animations look a bit weird due to some issues with the exporter (I know what the issue is, so it'll be fixed). Practically speaking, this opens up a lot of potential. Tired of seeing headcrabs and manhacks as pets on servers with Pointshop 2? How about a [url=http://wow.zamimg.com/uploads/screenshots/normal/442385-argi.jpg]space goat[/url] instead? Want to make a boss battle function for your gamemode, but think antlion guards are boring? Why not a [url=http://media.mmo-champion.com/images/news/2016/january/HulkedGuldan_Super.jpg]roid-raging orc[/url]?
Point is, this opens the floodgates to a lot of cool shit. Unfortunately the model exporter doesn't export particles and doesn't really respect transparency, but I think I can figure it out. Hopefully.
[vid]http://rhap.city/f/Mn9wz.mp4[/vid]
Mind you, the tools were here for quite a while to do this kind of thing, but it's been such a pain in the ass until very recently that no one wanted to do it. That's why you can only find props and playermodels for WoW on the workshop, and not things like pets with animations directly from the game.
Finished a minigolf map for GMCL, just need to do some final polishing.
[T]https://i.imgur.com/ZVaGXvX.jpg[/T] [T]https://i.imgur.com/R1ESuY8.jpg[/T]
Also started working on another map about a week or two ago, just trying to get the lighting and basic theme down before I go ahead and start making more levels. I'm trying to make this map feel as cozy as possible. Also learned how to use the particle system editor to make the snow.
[T]https://i.imgur.com/IjkFxmQ.jpg[/T]
I came up with a quick and easy way to fake some ambient occlusion, too. It helps the map look less flat, and less like your average source map.
[T]https://i.imgur.com/PZpicjU.jpg[/T] [T]https://i.imgur.com/VPVFSEI.jpg[/T] [T]https://i.imgur.com/N20vSMH.jpg[/T]
Since our minigolf maps are fairly wide open, there's not much you can do in terms of optimizing them, not that optimizing it is really needed anyways, since there's so little going on. But that means I can just stick a func_viscluster on the entire map, make the course walls func_details, keep the main turf as a world brush, and up the resolution of the lightmaps.
Edit: Left out a part, you stick the turf 4 units into the func_detail wall, and since it's in the wall it doesn't get any light, giving off that nice ambient occlusion effect as the shadowed part meets the lit part.
[QUOTE=Koolaidmini;52802657]I have been hitting my head for like 4 hours, but hopefully this saves someone some time:
[CODE]local function LerpAng( frac, startAngle, endAngle )
local dif = math.abs( endAngle - startAngle )
if dif > 180 then
if endAngle > startAngle then
startAngle = startAngle + 360
else
endAngle = endAngle + 360
end
end
local newVal = startAngle + ( ( endAngle - startAngle ) * frac )
if ( newVal >= 0 && newVal <= 360 ) then
return newVal
else
return ( newVal % 360 )
end
end[/CODE]
[IMG]https://i.imgur.com/5GqoVHi.gif[/IMG]
[IMG]https://i.imgur.com/5GqoVHi.gifv[/IMG][/QUOTE]
the way i've found that works well I found in this stack overflow
[url]https://stackoverflow.com/questions/28036652/finding-the-shortest-distance-between-two-angles[/url]
I've implemented it like below and it worked well for me.
[code]
local diff = (((camGoalAng - camAngle) + 180) % 360) - 180
if diff < -180 then
diff = diff + 360
end
camAngle = camAngle + (diff * CalcViewDelta)
[/code]
generic translation
[code]
function lerpAngle( frac, startAngle, endAngle)
local angleDifference = (((endAngle - startAngle) + 180) % 360) - 180
if angleDifference < -180 then
angleDifference = angleDifference + 360
end
return startAngle + (angleDifference * frac)
end
[/code]
[QUOTE=BlueSkilly;52804044]-minigolfness-[/QUOTE]
You just using a triangular block light?
[QUOTE=wauterboi;52804164]You just using a triangular block light?[/QUOTE]
A triangular block light?
[QUOTE=wauterboi;52804173][img]https://developer.valvesoftware.com/w/images/0/0c/Toolsblocklight.gif[/img]
^ this blocks light, creating shadows[/QUOTE]
Oh, I thought that's what you meant. Nah, I'm not using any of those.
Edit: Oh, I get what you're confused about. I thought I explained it properly but I missed out a point, woops. Will be editing my post in a second here.
Making a new hud for my bhop gamemode
[IMG]https://puu.sh/y3jg0/9fcfcf137a.gif[/IMG]
thots?
Sorry, you need to Log In to post a reply to this thread.