Updated AI to be more stable

This commit is contained in:
Segey Lapin
2019-07-18 06:44:22 +03:00
parent d9822b0b6e
commit 85016d14e7
4 changed files with 15 additions and 13 deletions

View File

@@ -79,10 +79,11 @@ func stop_game():
if _scores[k] > max_score:
max_score = _scores[k]
winner_team = k
for e in _teams[winner_team]:
world.increase_xp(e, min(e.xp * 2, min(100 * e.level, 1000)))
for e in _cheers[winner_team]:
world.increase_xp(e, min(e.xp * 2, min(200 * e.level, 2000)))
if winner_team >= 0:
for e in _teams[winner_team]:
world.increase_xp(e, min(e.xp * 2, min(100 * e.level, 1000)))
for e in _cheers[winner_team]:
world.increase_xp(e, min(e.xp * 2, min(200 * e.level, 2000)))
var base_speed = 300.0
func striker(ch: Dictionary, delta: float) -> Vector2:
@@ -257,9 +258,9 @@ func _process(delta):
_main.add_child(_ball_instance)
_ball_instance.global_position = world.master_node.global_position + Vector2(randf() - 0.5, randf() - 0.5) * 20.0
_ball_instance.add_to_group("ball")
catch_delay += 5.0
catch_delay += 10.0
else:
drop_ball(_ball_carrier)
catch_delay += 5.0
catch_delay += 7.0
if catch_delay > 0.0:
catch_delay -= delta

View File

@@ -101,7 +101,7 @@ func increase_xp(ch, num):
print("next at ", ch.next_xp)
func init_data():
for ci in range(12):
for ci in range(24):
var cd : = new_candidate()
line[ci] = cd
team = {}

View File

@@ -75,6 +75,6 @@ func _ready():
func _process(delta):
if world.training:
for k in ball_game._scores.keys():
if ball_game._scores[k] > 3.0:
if ball_game._scores[k] > 10.0:
start_training("gym", "action1")

View File

@@ -767,7 +767,7 @@ __meta__ = {
position = Vector2( -98.8876, 5.10718 )
[node name="cheer0" type="Position2D" parent="gym/game_points/team0"]
position = Vector2( -166.926, -150.6 )
position = Vector2( -148.35, -130.034 )
[node name="cheer1" type="Position2D" parent="gym/game_points/team0"]
position = Vector2( -164.864, -67.0573 )
@@ -800,7 +800,7 @@ __meta__ = {
position = Vector2( 95.7458, 4.96942 )
[node name="cheer0" type="Position2D" parent="gym/game_points/team1"]
position = Vector2( 164.645, -153.658 )
position = Vector2( 148.723, -129.111 )
[node name="cheer1" type="Position2D" parent="gym/game_points/team1"]
position = Vector2( 165.089, -68.4698 )
@@ -946,6 +946,7 @@ anchor_right = 1.0
margin_right = 138.0
margin_bottom = 33.0
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
@@ -1103,7 +1104,7 @@ __meta__ = {
[node name="wall_fix6" type="StaticBody2D" parent="."]
position = Vector2( 592.823, 97.3416 )
collision_layer = 16
collision_mask = 17
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix6"]
shape = SubResource( 47 )
@@ -1114,7 +1115,7 @@ __meta__ = {
[node name="wall_fix7" type="StaticBody2D" parent="."]
position = Vector2( 813.079, 413.793 )
collision_layer = 16
collision_mask = 17
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix7"]
shape = SubResource( 47 )
@@ -1125,7 +1126,7 @@ __meta__ = {
[node name="wall_fix8" type="StaticBody2D" parent="."]
position = Vector2( 593.487, 336.173 )
collision_layer = 16
collision_mask = 17
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix8"]
shape = SubResource( 47 )