1 float turret_stdproc_targetscore_support(entity _turret,entity _target)
3 float score; // Total score
4 float s_score, d_score;
6 if (_turret.enemy == _target) s_score = 1;
8 d_score = min(_turret.target_range_optimal,tvt_dist) / max(_turret.target_range_optimal,tvt_dist);
10 score = (d_score * _turret.target_select_rangebias) +
11 (s_score * _turret.target_select_samebias);
17 * Generic bias aware score system.
19 float turret_stdproc_targetscore_generic(entity _turret, entity _target)
21 float d_dist; // Defendmode Distance
22 float score; // Total score
23 float d_score; // Distance score
24 float a_score; // Angular score
25 float m_score; // missile score
26 float p_score; // player score
27 float ikr; // ideal kill range
29 if (_turret.tur_defend)
31 d_dist = vlen(real_origin(_target) - _turret.tur_defend.origin);
32 ikr = vlen(_turret.origin - _turret.tur_defend.origin);
33 d_score = 1 - d_dist / _turret.target_range;
37 // Make a normlized value base on the targets distance from our optimal killzone
38 ikr = _turret.target_range_optimal;
39 d_score = min(ikr, tvt_dist) / max(ikr, tvt_dist);
42 a_score = 1 - tvt_thadf / _turret.aim_maxrot;
44 if ((_turret.target_select_missilebias > 0) && (_target.flags & FL_PROJECTILE))
47 if ((_turret.target_select_playerbias > 0) && (_target.flags & FL_CLIENT))
50 d_score = max(d_score, 0);
51 a_score = max(a_score, 0);
52 m_score = max(m_score, 0);
53 p_score = max(p_score, 0);
55 score = (d_score * _turret.target_select_rangebias) +
56 (a_score * _turret.target_select_anglebias) +
57 (m_score * _turret.target_select_missilebias) +
58 (p_score * _turret.target_select_playerbias);
60 if(_turret.target_range < vlen(_turret.tur_shotorg - real_origin(_target)))
67 string sd,sa,sm,sp,ss;
68 string sdt,sat,smt,spt;
71 d_score *= _turret.target_select_rangebias;
75 //v_score *= _turret.target_select_samebias;
76 //svt = ftos(v_score);
79 a_score *= _turret.target_select_anglebias;
83 m_score *= _turret.target_select_missilebias;
87 p_score *= _turret.target_select_playerbias;
92 bprint("^3Target scores^7 \[ ",_turret.netname, " \] ^3for^7 \[ ", _target.netname," \]\n");
93 bprint("^5Range:\[ ",sd, " \]^2+bias:\[ ",sdt," \]\n");
94 bprint("^5Angle:\[ ",sa, " \]^2+bias:\[ ",sat," \]\n");
95 bprint("^5Missile:\[ ",sm," \]^2+bias:\[ ",smt," \]\n");
96 bprint("^5Player:\[ ",sp, " \]^2+bias:\[ ",spt," \]\n");
97 bprint("^3Total (w/bias):\[^1",ss,"\]\n");
105 float turret_stdproc_targetscore_close(entity _turret,entity _target)
107 return 1 - (tvt_dist / _turret.target_range);
110 float turret_stdproc_targetscore_far (entity _turret,entity _target)
112 return tvt_dist / _turret.target_range;
115 float turret_stdproc_targetscore_optimal(entity _turret,entity _target)
117 return min(_turret.target_range_optimal,tvt_dist) / max(_turret.target_range_optimal,tvt_dist);
120 float turret_stdproc_score_angular(entity _turret,entity _target)
122 return 1 - (tvt_thadf / _turret.aim_maxrot);
125 float turret_stdproc_targetscore_defend(entity _turret,entity _target)
128 //min(_target.origin,_turret.tur_defend.origin) / max(_target.origin,_turret.tur_defend.origin);