1.6 added
i made new prediction logic c#: -> i'll add this in 1.7 update
public static Vector3 GetPosition(Obj_AI_Base unit, int lenght) { if (Events.waypoints[unit.NetworkId].count < 3) { float x = Events.waypoints[unit.NetworkId].paths[1].X - unit.Position.X; float y = Events.waypoints[unit.NetworkId].paths[1].Y - unit.Position.Y; float dist = GetDistance(x, y); if (dist > lenght) { Vector3 dir = (Events.waypoints[unit.NetworkId].paths[1] - unit.Position) / dist; return unit.Position + (dir * lenght); } return Events.waypoints[unit.NetworkId].paths[1]; } return PointOnRoad(unit, lenght); } static Vector3 PointOnRoad(Obj_AI_Base unit, int extension) { float d = 0f; for (int i = 1; i < Events.waypoints[unit.NetworkId].count; i++) { float xx = Events.waypoints[unit.NetworkId].paths[i].X - Events.waypoints[unit.NetworkId].paths[i-1].X; float yy = Events.waypoints[unit.NetworkId].paths[i].Y - Events.waypoints[unit.NetworkId].paths[i-1].Y; d = d + GetDistance(xx,yy); if ( d > unit.MoveSpeed * ( ( Game.Time * 1000 ) - Events.waypoints[unit.NetworkId].last_move_time ) / 1000 ) { float dist = 0f; float x = Events.waypoints[unit.NetworkId].paths[i].X - unit.Position.X; float y = Events.waypoints[unit.NetworkId].paths[i].Y - unit.Position.Y; dist = GetDistance(x,y); if (dist > extension) { Vector3 dir = ( Events.waypoints[unit.NetworkId].paths[i] - unit.Position ) / dist; return unit.Position + ( dir * extension ); } if (i == Events.waypoints[unit.NetworkId].count - 1) { return Events.waypoints[unit.NetworkId].paths[i]; } for (int j = i+1; j < Events.waypoints[unit.NetworkId].count; i++) { float x2 = Events.waypoints[unit.NetworkId].paths[j].X - Events.waypoints[unit.NetworkId].paths[j-1].X; float y2 = Events.waypoints[unit.NetworkId].paths[j].Y - Events.waypoints[unit.NetworkId].paths[j-1].Y; float dist2 = GetDistance(x2,y2); if (dist2 > extension - dist) { Vector3 dir = ( Events.waypoints[unit.NetworkId].paths[j] - Events.waypoints[unit.NetworkId].paths[j-1] ) / dist2; return Events.waypoints[unit.NetworkId].paths[j-1] + ( dir * ( extension - dist ) ); } if (j == Events.waypoints[unit.NetworkId].count - 1) { return Events.waypoints[unit.NetworkId].paths[j]; } dist = dist + dist2; } } } return Vector3.Zero; }
We don't have path yet