Donnerstag, 18. November 2010

Combat Damage in Season 2

The combat damage in ZeroX has been quite high. Until now the combat damage has been divided inversely proportional to the population size, both agents suffered the same combat damage.
With season 2 this will change in favor of the bigger adversary. The combat damage for the smaller will remain the same. But the damage for the bigger will also be inversely proportional to the population sizes. Let's compare the two algorithms with a seek and destroy sequence with:

  Season 1 Season 2
step   Agent 1 Agent 2 Agent 1 Agent 2
1 population 1000 1500 1000 1500
combat damage 600 600 600 400
2 population 400 900 400 1100
combat damage 276 276 293 107
3 population 124 624 106 993
combat damage 103 103 96 11
4 population 21 521 10 982
combat damage 20 20 10 1
5 population 1 501 0 981

As in season 1 both adversary were classified excat the same, therefore they suffered the same damage. The bigger one could never take advantage of his population superiority. This will now be considered.

Mittwoch, 10. November 2010

Secure your steps, how to disengage from a move action

Update: This feature has been removed in with the beginning of the 3rd season. Instead use look_at for agents in level Clone War.

In Zero X the simulation and all agents are running continuously. That's one big difference to other programming games, that usually are round based. The consequence is, that in the time between an agent inspects his environment with a look_around and the action he takes, with a move_to for example, the environment can change.
For example a field is free, when he makes the look_around, but has been occupied in the meanwhile by another agent, when he moves. This would result in a unintended attack against this other agent.

Although this case is rare, as a look_around and a move_to are very close. But this time gape can grow bigger as the analysis of the environment takes more time. In general agents have to deal with this kind of insecurity about their perception. This one of the many challenges in this game.

But in order to handle better this kind of insecurity, starting with season 2, move_to can now take a block.
move_to(x,y) {|target| ... }
The argument passed to the block is another view of the target field at the exact time of the movement. This gives the agent the chance to check the preconditions of his action. If they are not fulfilled anymore, he can now disengage from the move action.

move_to(x,y) do |target|
  unless target.has_no_population?
     disengage 'field is not free anymore!'
  end
end
Disengage can take a message, that will then be displayed in your reports. The action is canceled and the agent remains on his starting field. But disengage comes not for free. A move_to would cost 6 action points, disengage from this action still costs 3 action points.

Disengage can only be used within an action block like the one in move_to.

Donnerstag, 26. August 2010

The End of Season 1

The 10th tournament ended actually with two winners, Bulldog and Rincewind. Both made 6.8 points, Bulldog is only ranked first, because he has a better overall ranking.

After 10 tournaments, it's time to look back. The first tournament began with 9 agents, by now the agents have doubled. They not only have become more, no they also have become better. FireLion the winner of the first two tournaments, looked in the beginning very promising, but in the meanwhile has been displaced to the 10th rank. Others have come with a better strategy.

After total 46 games, the ranking list can grouped in three parts:
There's the 5plus group, agents that have an average of more than 5 points. Means they don't only survive in most of the games, the also achieve better ranks. WoodElf, Bulldog, Gruyere, Oreiller, Mild Gruyere and Rincewind are in this group.
The second group are agents that survive sometimes, they have an average of 3 to 4 points. And then there's the last group that have less than 3 points, meaning they don't survive very often.

But remember this tournaments are not only about winning or loosing, in fact I don't see any loosing in contributing an agent. It's about to figure out which strategy works better then another.

After 10 tournaments we make a break and end the first season. We will continue the tournaments in October, the exact date will be announced.

Congratulations to everybody and see you soon for the second season!

Samstag, 31. Juli 2010

Attacked Events

In Zero X some events are directly reported to the agents. They can read them, during their think method with next_event or iterate over them with each_event. The event will be removed as soon as it has been read.
event = next_event
event.class    # => AttackedEvent
event.attacker # => '003' agent code name
event.damage   # => 132
If an agent is attacked by another agent, the victim receives an attacked event. The event includes the code name of the attacker and the damage suffered.

Here an example with an iterator:
each_event do |event|
  if event.instance_of? AttackedEvent
    puts "attacked by #{event.attacker} and suffered #{event.damage}"
  end
end
In your tests you can fire the attacked event by using has_been_attacked_by. The method takes the codename of the attacker and an optional damage parameter.
it "should behave different if it has been attacked" do
  @agent.has_been_attacked_by '003'
  @agent.think
  ...
end
The new test methods are available with SDK Version 0.9.7.
Download the new SDK V0.9.7

See the documentation.

Donnerstag, 22. Juli 2010

Bulldog wins 9th tournament

Bulldog won the 9th tournament with 8.0 points. He won 2 games, made one second place and a third place.
Wood Elf, the high flyer of the last tournament, made this time only 4.6 points and was placed at rank 6, still holding the first rank in the total ranking.
Newcomer Mild Gruyere won 1 game and is placed 4th in the tournament ranking.

I'm still experimenting with the runtime velocity of the simulation. This time the simulation run even slower, the action cost to time unit ratio was 1/15. Like this the resource reached their maximum at the end of each game. I think will keep the action costs in this range for the next tournament.
class Agency < Tournament::Agency
  level 'Greenfields'
  agents_per_game 22
  games_per_agent 1
  game_duration 300 # sec
  time_unit 45 # sec
  action_cost_time_unit_ratio 1.0 / 15.0
  build_options 'Greenfields::World' => { :size => 8 },
                'Greenfields::Resource' => { :size => 4000..16000 },
                'Greenfields::Population' => { :size => 40..160 }
end
Ranking of the 9th tournament.

Montag, 5. Juli 2010

High-Flyer

Incredible! Wood Elf makes the perfect tournament with 10 points! This means she won all 5 games in the tournament. Having a look at the rankings of Wood Elf, we see that, in the 4 tournaments she participated, she won 3 of them and made a second place in the other. This is clear an outstanding performance.
She now leads the overall ranking with 7.85 points, leaving the second placed Gruyere with 5.69 points behind.

The world size for this tournament has now been increased by one to eight. And the simulation run even slower, one time unit now took 30 seconds.
Here the whole configuration for the last tournament:
module Greenfields

  class Agency < Tournament::Agency
    level 'Greenfields'
    agents_per_game 22
    games_per_agent 5
    game_duration 1800 # sec
    time_unit 30 # sec
    action_cost_time_unit_ratio 1.0 / 10.0
    build_options 'Greenfields::World' => { :size => 8 },
                  'Greenfields::Resource' => { :size => 4000..16000 },
                  'Greenfields::Population' => { :size => 40..160 }
  end

end

Ranking of the 8th tournament.

Sonntag, 20. Juni 2010

The 5th and 6th Tournament

For the last two tournaments there were 5 games each and 16 agents, who participated.
We had an amazing newcomer "Wood Elf", who left with 7.8 EPS all other behind. In the 5th tournament Wood Elf won 2 games, made a second and a third place. But she also takes the first place in the overall ranking. FireLion falls back to the third place.

In the 6th tournament, Gruyere strikes for the second time. One game won, 3 times a second place and one third place, gives him excellent 8 EPS. Gruyere takes now the second place in the overall ranking. Will he become number one in the tournaments to come or can Wood Elf defend her position?

As in the last post announced the simulation runned slower for the last two tournaments. The action cost to time unit ratio has been set to 1/4. Also the world size has been increased and has now a size of 7. Here the complete configuration for the last tournament:
module Greenfields

  class Agency < Tournament::Agency
    level 'Greenfields'
    agents_per_game 16
    games_per_agent 5
    game_duration 1800 # sec
    time_unit 12 # sec
    action_cost_time_unit_ratio 1.0 / 4.0
    build_options 'Greenfields::World' => { :size => 7 },
                  'Greenfields::Resource' => { :size => 4000..16000 },
                  'Greenfields::Population' => { :size => 40..160 }

  end

end
Checkout the the ranking.