msburgess3200 / zombiereloaded

Automatically exported from code.google.com/p/zombiereloaded
0 stars 0 forks source link

Dynamic knock back #155

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Decrease/increase knock back based on how many players there are nearby in a 
specified radius.

The calculation must be highly optimized because knock back should be 
updated at least every second. On 64-slot servers that might be too much if 
not optimized properly.

Original issue reported on code.google.com by richard.helgeby@gmail.com on 16 Apr 2010 at 12:04

GoogleCodeExporter commented 9 years ago
Each zombie could calculate their own knock back based on nearby humans and 
zombies. Its knock back is scaled by this multiplier: zombies / humans

If there are many humans and few zombies the knock back will be lower. And when 
opposite it will be higher.

The multiplier formula might need some tuning or correction.

Original comment by richard.helgeby@gmail.com on 13 Dec 2010 at 9:59

GoogleCodeExporter commented 9 years ago
That formula doesn't apply if there is 1 zombie vs 1 human.

Original comment by richard.helgeby@gmail.com on 13 Dec 2010 at 10:29

GoogleCodeExporter commented 9 years ago
To get nearby players (for each player): Loop through all other players and 
calculate the distance. Get those within the range and cache it.

Worst case scenario with 64 players: 64 * 64 vector calculations (4096) every 
second or maybe every half second.

Profile test: Make a test plugin with dummy vector arrays with random 
positions. Measure calculation performance for 64 players.

Original comment by richard.helgeby@gmail.com on 13 Dec 2010 at 10:49