Method: Bcpm::Match.simulator_config

Defined in:
lib/bcpm/match.rb

.simulator_config(player1_name, player2_name, silence_b, map_name, binfile, txtfile) ⇒ Object

Options to be overridden for the battlecode simulator.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/bcpm/match.rb', line 99

def self.simulator_config(player1_name, player2_name, silence_b, map_name, binfile, txtfile)
  Bcpm::Config[:client3d] ||= 'off'
  Bcpm::Config[:sound] ||= 'off'
  config = {
    'bc.engine.silence-a' => !silence_b,
    'bc.engine.silence-b' => !!silence_b,
    'bc.dialog.skip' => true,
    'bc.server.throttle' => 'yield',
    'bc.server.throttle-count' => 100000,
    'bc.client.opengl' => Bcpm::Config[:client3d],
    'bc.client.sound-on' => Bcpm::Config[:sound] || 'off',
    
    # Healthy production defaults.
    'bc.engine.breakpoints' => false,
    'bc.engine.debug-methods' => false,
    'bc.engine.upkeep' => true
  }
  map_path = nil
  if map_name
    if File.basename(map_name) != map_name
      map_path = File.dirname map_name
      map_name = File.basename(map_name).sub(/\.xml$/, '')
    end
  end
  config['bc.game.maps'] = map_name if map_name
  config['bc.game.map-path'] = map_path if map_path
  config['bc.game.team-a'] = player1_name if player1_name
  config['bc.game.team-b'] = player2_name if player2_name
  config['bc.server.save-file'] = binfile if binfile
  config['bc.server.transcribe-input'] = binfile if binfile
  config['bc.server.transcribe-output'] = txtfile if txtfile
  config
end