minor cleanup
- removed comment-disabled code - reduced verbosity in protocol logging
This commit is contained in:
parent
b490cfc228
commit
49ff6af1f3
2
game.go
2
game.go
@ -220,8 +220,6 @@ func (g *game) send_update(payload *Boardstate) {
|
|||||||
player_payload.Obstacles = payload.Obstacles
|
player_payload.Obstacles = payload.Obstacles
|
||||||
}
|
}
|
||||||
|
|
||||||
// x, _ := json.Marshal(player_payload)
|
|
||||||
// log.Printf("%v", string(x))
|
|
||||||
p.send <- player_payload
|
p.send <- player_payload
|
||||||
}
|
}
|
||||||
for s := range g.spectators {
|
for s := range g.spectators {
|
||||||
|
@ -106,7 +106,6 @@ func (p *player) checkCollisions(g *game, move_vector v.Vector2d) (bool, v.Point
|
|||||||
player_rect := v.RectFromPoint(player.Robot.Position, 3)
|
player_rect := v.RectFromPoint(player.Robot.Position, 3)
|
||||||
collision, _, pos := v.RectIntersection(player_rect, p.Robot.Position, move_vector)
|
collision, _, pos := v.RectIntersection(player_rect, p.Robot.Position, move_vector)
|
||||||
if collision {
|
if collision {
|
||||||
// log.Printf("Player Collision %v hit %v, rect:%v", p.Robot.Position, move_vector, player_rect)
|
|
||||||
return collision, pos, player
|
return collision, pos, player
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +114,6 @@ func (p *player) checkCollisions(g *game, move_vector v.Vector2d) (bool, v.Point
|
|||||||
for _, obj := range g.obstacles {
|
for _, obj := range g.obstacles {
|
||||||
collision, _, pos := v.RectIntersection(obj.Bounds, p.Robot.Position, move_vector)
|
collision, _, pos := v.RectIntersection(obj.Bounds, p.Robot.Position, move_vector)
|
||||||
if collision {
|
if collision {
|
||||||
// log.Printf("Object Collision %v hit %v, rect:%v", p.Robot.Position, move_vector, obj.Bounds)
|
|
||||||
return collision, pos, nil
|
return collision, pos, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +191,6 @@ func (p *player) Tick(g *game) {
|
|||||||
p.Robot.Position = p.Robot.Position.Add(move_vector)
|
p.Robot.Position = p.Robot.Position.Add(move_vector)
|
||||||
if new_heading.Mag() > 0 {
|
if new_heading.Mag() > 0 {
|
||||||
p.Robot.Heading = new_heading
|
p.Robot.Heading = new_heading
|
||||||
// log.Printf("%v %v %v", new_heading, current_heading, angle)
|
|
||||||
} else {
|
} else {
|
||||||
log.Printf("Zero Heading %v", new_heading)
|
log.Printf("Zero Heading %v", new_heading)
|
||||||
}
|
}
|
||||||
|
@ -98,15 +98,11 @@ func addPlayer(ws *websocket.Conn) {
|
|||||||
log.Println("problem parsing the requested game id")
|
log.Println("problem parsing the requested game id")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Printf("requested game id: %+v", gid)
|
|
||||||
|
|
||||||
game := games.get(gid.Id)
|
game := games.get(gid.Id)
|
||||||
log.Printf("found game: %p", game)
|
|
||||||
if game == nil {
|
if game == nil {
|
||||||
log.Println("game was nil")
|
|
||||||
force := *debug
|
force := *debug
|
||||||
if force {
|
if force {
|
||||||
log.Println("forcing game start")
|
|
||||||
game = NewGame(gid.Id, float32(*width), float32(*height))
|
game = NewGame(gid.Id, float32(*width), float32(*height))
|
||||||
go game.run()
|
go game.run()
|
||||||
games.add(game)
|
games.add(game)
|
||||||
@ -140,7 +136,6 @@ func addPlayer(ws *websocket.Conn) {
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Printf("%s: %s clientid: %+v", gid.Id, player_id, clientid)
|
|
||||||
|
|
||||||
gameParam := NewGameParam(game.width, game.height)
|
gameParam := NewGameParam(game.width, game.height)
|
||||||
err = websocket.JSON.Send(ws, gameParam)
|
err = websocket.JSON.Send(ws, gameParam)
|
||||||
@ -149,7 +144,6 @@ func addPlayer(ws *websocket.Conn) {
|
|||||||
websocket.JSON.Send(ws, NewFailure("game param parse error"))
|
websocket.JSON.Send(ws, NewFailure("game param parse error"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Printf("gameparam: %+v", gameParam)
|
|
||||||
|
|
||||||
switch clientid.Type {
|
switch clientid.Type {
|
||||||
case "robot":
|
case "robot":
|
||||||
|
Loading…
Reference in New Issue
Block a user