Permalink
Browse files

Robots now get 5 ticks for syscalls each world-update tick.

  • Loading branch information...
1 parent 778d95f commit d9b2c1b85661e666d111ab08d803d12f60fc54a6 @jonasferry committed Sep 21, 2011
Showing with 20 additions and 14 deletions.
  1. +8 −5 doc/game_doc.html
  2. +2 −0 doc/gui_doc.html
  3. +1 −1 doc/init_doc.html
  4. +7 −6 src/game.tcl
  5. +1 −1 src/init.tcl
  6. +1 −1 tclrobots.tcl
View
13 doc/game_doc.html
@@ -82,10 +82,11 @@
set sim_syscall $data(r0,syscall,$tick)
append sim_syscall " => " $data(r0,sysreturn,$tick)
}
- update_robots
-
- if {$gui} {
- update_gui
+ if {$tick % 5 == 0} {
+ update_robots
+ if {$gui} {
+ update_gui
+ }
}
tick
@@ -119,6 +120,8 @@
} else {
# Game is paused, but GUI needs to respond
update
+ # Keep timebase up to date to not get skewed during pause
+ set timeAt5 [expr {[clock milliseconds] - $parms(tick) * ($tick - 4)}]
}
}
rename [info coroutine] ""
@@ -460,7 +463,7 @@
if {$data($robot,speed) > 0} {
set data($robot,range) \
[+ $data($robot,range) \
- [/ [* $data($robot,speed) $parms(sp)] 100]]
+ [/ [* $data($robot,speed) $parms(sp)] 100.0]]
# Modify range with random factor to avoid totally
# deterministic movement. Range is currently +- 1%.
View
2 doc/gui_doc.html
@@ -641,6 +641,8 @@
if {$mode eq "simulator"} {
set game(simulator) 1
+ } else {
+ set game(simulator) 0
}
# Check that the number of selected robots is correct
switch $mode {
View
2 doc/init_doc.html
@@ -70,7 +70,7 @@
# milliseconds per tick
if {$gui} {
- set parms(tick) 100
+ set parms(tick) 20
} else {
set parms(tick) 0
}
View
13 src/game.tcl
@@ -62,12 +62,13 @@ proc run_robots {} {
set sim_syscall $data(r0,syscall,$tick)
append sim_syscall " => " $data(r0,sysreturn,$tick)
}
- update_robots
-
- if {$gui} {
- update_gui
- }
- tick
+ if {$tick % 5 == 0} {
+ update_robots
+ if {$gui} {
+ update_gui
+ }
+ }
+ tick
# Check if single step is active in simulator mode
if {$game(simulator) && $step} {
View
2 src/init.tcl
@@ -63,7 +63,7 @@ proc init_parms {} {
# milliseconds per tick
if {$gui} {
- set parms(tick) 100
+ set parms(tick) 20
} else {
set parms(tick) 0
}
View
2 tclrobots.tcl
@@ -21,7 +21,7 @@
#
#******
-set version "3.0-alpha (2011-09-20)"
+set version "3.0-alpha (2011-09-21)"
# Provide package name for starpack build, see Makefile
package provide app-tclrobots 1.0

0 comments on commit d9b2c1b

Please sign in to comment.