… | |
… | |
2 | |
2 | |
3 | # this extension swaps out maps and resets them, in essence managing |
3 | # this extension swaps out maps and resets them, in essence managing |
4 | # the reset/swap policy of the server. |
4 | # the reset/swap policy of the server. |
5 | |
5 | |
6 | our $DEACTIVATE_TIMEOUT = 20; # number of seconds after which maps get deactivated to save cpu |
6 | our $DEACTIVATE_TIMEOUT = 20; # number of seconds after which maps get deactivated to save cpu |
7 | our $SWAP_TIMEOUT = 50; # number of seconds after which maps inactive get swapped out |
7 | our $SWAP_TIMEOUT = 35; # number of seconds after which maps inactive get swapped out |
8 | our $SCHEDULE_INTERVAL = 2; # time the map scheduler sleeps between runs |
8 | our $SCHEDULE_INTERVAL = 2; # time the map scheduler sleeps between runs |
9 | our $SAVE_TIMEOUT = 30; # save maps every n seconds |
9 | our $SAVE_TIMEOUT = 20; # save maps every n seconds |
10 | our $SAVE_INTERVAL = 0.3; # save at max. one map every $SAVE_INTERVAL |
10 | our $SAVE_INTERVAL = 0.1; # save at max. one map every $SAVE_INTERVAL |
11 | |
11 | |
12 | our $SCHEDULER = cf::coro { |
12 | our $SCHEDULER = cf::coro { |
13 | while () { |
13 | while () { |
14 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
14 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
15 | |
15 | |
… | |
… | |
48 | } |
48 | } |
49 | }; |
49 | }; |
50 | |
50 | |
51 | $SCHEDULER->prio (-2); |
51 | $SCHEDULER->prio (-2); |
52 | |
52 | |
|
|
53 | # map load prefetch |
|
|
54 | cf::map->attach ( |
|
|
55 | on_enter => sub { |
|
|
56 | my ($map, $pl) = @_; |
|
|
57 | |
|
|
58 | # floodfill surrounging maps, asynchronously |
|
|
59 | }, |
|
|
60 | ); |
|
|
61 | |