Newbrict / ObjHunt

A Good Garry's Mod Prop Hunt
Apache License 2.0
17 stars 21 forks source link

Different health for different sized props #74

Open CSchulz opened 9 years ago

Newbrict commented 9 years ago

Already in the game

CSchulz commented 9 years ago

But it seems not to be possible to have more than 100 hp?

Newbrict commented 9 years ago

Yes, 100HP is the max, it's a fast drop off based on the volume of the prop you have, phones have (~10) hp everything from toasters and up have 100 HP, the game is for hiding, not tanking :)

CSchulz commented 9 years ago

So the max health value has no effect in the player_prop class?

Newbrict commented 9 years ago

mmm, it should. I'll look.

it doesn't have an effect. I think I've "magic numbered" all the prop health max values to 100

feel free to fix it and pull request

CSchulz commented 9 years ago

I think it is

local maxHP = math.Clamp( volume/10, 1, 100 )

https://github.com/Newbrict/ObjHunt/blob/a39942bf6978872d8cf950ebdc0111dca945f2f1/gamemode/init.lua#L297

Newbrict commented 9 years ago

I think that looks right.

I think the best way to do this is to analyze every prop in gmod for it's volume then map health values to distance from the mean value in standard deviations? I don't think a flat change will help much.

CSchulz commented 9 years ago

And the way prop hunt is doing it, is wrong?

They are doing it similar:

local ent_health = math.Clamp(ent:GetPhysicsObject():GetVolume() / 250, 1, 200)
local new_health = math.Clamp((pl.ph_prop.health / pl.ph_prop.max_health) * ent_health, 1, 200)
local per = pl.ph_prop.health / pl.ph_prop.max_health

https://github.com/xspacesoft/PropHunt/blob/master/gamemodes/prop_hunt/gamemode/lua/init.lua#L101

Newbrict commented 9 years ago

Prop hunt does everything wrong ;)

it should be based on a non linear curve, otherwise we get these massive ramp up from 0 to 100 HP on props with hardly any difference in size.

I don't know if I'll have a chance to get all the data, but if you can get me the volume of every prop I can do the analysis and write the code.

CSchulz commented 9 years ago

Do you have a snippet to get the volume of the current prop? Or a command to start the game without having enough players?

Newbrict commented 9 years ago

ent:GetPhysicsObject():GetVolume()

you want to put that in a loop over all the props in the game, ( all props with phys objects )

then just print out the name and volume

if you can get me that I'll do the rest.

CSchulz commented 9 years ago

Do you really want to use the volume? I would suggest the mass.

CSchulz commented 9 years ago

Volume: http://pastebin.com/eHVaMDV3

An example map with mass: http://pastebin.com/fYJBCMTt

Newbrict commented 9 years ago

Hmmm.... now that I think about it Volume might not make sense, because it doesn't accurately represent how visual an object is.

Mass is definitely not the right way to go though, the weight of the object shouldn't determine the health, for example a cinder block weighs about the same as a blue barrel?

I think the best way would be to take the surface area of the prop, if possible with the phys object to get the exact visual surface area otherwise simply with the bounding box of the hull of the prop.

This would base health more on how "visual" a prop is.

if there is no built in surface area for phys objects we'll have to go with the bounding box otherwise it'll be impossible to compute with what we have access to.

How did you generate your prop lists? they seem shorter than I expected, but it looks like you have something working there, good job!

If you want try to get a full list of surface areas, otherwise add me on steam we can talk about it over the weekend.

CSchulz commented 9 years ago

Hum ... but the mass also change the behavior of the prop, how it acts and so on, right?

I have filtered multiple entries on the same map and wrote a small script to get them all.

But we have look there is a built-in function PhysObj:GetSurfaceArea().

Newbrict commented 9 years ago

Yeah but I figure the health should be based on the how visible the prop is instead of the intrinsic properties of the prop :)