bandwidth reduction, filtering explosions and sending objects as [4]int

This commit is contained in:
Fraser Graham
2013-11-16 23:13:03 -08:00
parent 5a2651d0dd
commit 58c084c7ab
4 changed files with 49 additions and 12 deletions
+13
View File
@@ -21,6 +21,19 @@ func (o Obstacle) distance_from_point(p v.Point2d) float32 {
return float32(dist)
}
func (o Obstacle) minify() [4]int {
out := [4]int{int(o.Bounds.A.X), int(o.Bounds.A.Y), int(o.Bounds.B.X), int(o.Bounds.B.Y)}
return out
}
func MinifyObstacles(o []Obstacle) [][4]int {
out := [][4]int{}
for i := range o {
out = append(out, o[i].minify())
}
return out
}
func GenerateObstacles(count int, width, height float32) []Obstacle {
out := []Obstacle{}
for i := 0; i < count; i++ {