Updated AI to be more stable
This commit is contained in:
@@ -79,6 +79,7 @@ func stop_game():
|
|||||||
if _scores[k] > max_score:
|
if _scores[k] > max_score:
|
||||||
max_score = _scores[k]
|
max_score = _scores[k]
|
||||||
winner_team = k
|
winner_team = k
|
||||||
|
if winner_team >= 0:
|
||||||
for e in _teams[winner_team]:
|
for e in _teams[winner_team]:
|
||||||
world.increase_xp(e, min(e.xp * 2, min(100 * e.level, 1000)))
|
world.increase_xp(e, min(e.xp * 2, min(100 * e.level, 1000)))
|
||||||
for e in _cheers[winner_team]:
|
for e in _cheers[winner_team]:
|
||||||
@@ -257,9 +258,9 @@ func _process(delta):
|
|||||||
_main.add_child(_ball_instance)
|
_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.global_position = world.master_node.global_position + Vector2(randf() - 0.5, randf() - 0.5) * 20.0
|
||||||
_ball_instance.add_to_group("ball")
|
_ball_instance.add_to_group("ball")
|
||||||
catch_delay += 5.0
|
catch_delay += 10.0
|
||||||
else:
|
else:
|
||||||
drop_ball(_ball_carrier)
|
drop_ball(_ball_carrier)
|
||||||
catch_delay += 5.0
|
catch_delay += 7.0
|
||||||
if catch_delay > 0.0:
|
if catch_delay > 0.0:
|
||||||
catch_delay -= delta
|
catch_delay -= delta
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ func increase_xp(ch, num):
|
|||||||
print("next at ", ch.next_xp)
|
print("next at ", ch.next_xp)
|
||||||
|
|
||||||
func init_data():
|
func init_data():
|
||||||
for ci in range(12):
|
for ci in range(24):
|
||||||
var cd : = new_candidate()
|
var cd : = new_candidate()
|
||||||
line[ci] = cd
|
line[ci] = cd
|
||||||
team = {}
|
team = {}
|
||||||
|
|||||||
@@ -75,6 +75,6 @@ func _ready():
|
|||||||
func _process(delta):
|
func _process(delta):
|
||||||
if world.training:
|
if world.training:
|
||||||
for k in ball_game._scores.keys():
|
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")
|
start_training("gym", "action1")
|
||||||
|
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ __meta__ = {
|
|||||||
position = Vector2( -98.8876, 5.10718 )
|
position = Vector2( -98.8876, 5.10718 )
|
||||||
|
|
||||||
[node name="cheer0" type="Position2D" parent="gym/game_points/team0"]
|
[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"]
|
[node name="cheer1" type="Position2D" parent="gym/game_points/team0"]
|
||||||
position = Vector2( -164.864, -67.0573 )
|
position = Vector2( -164.864, -67.0573 )
|
||||||
@@ -800,7 +800,7 @@ __meta__ = {
|
|||||||
position = Vector2( 95.7458, 4.96942 )
|
position = Vector2( 95.7458, 4.96942 )
|
||||||
|
|
||||||
[node name="cheer0" type="Position2D" parent="gym/game_points/team1"]
|
[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"]
|
[node name="cheer1" type="Position2D" parent="gym/game_points/team1"]
|
||||||
position = Vector2( 165.089, -68.4698 )
|
position = Vector2( 165.089, -68.4698 )
|
||||||
@@ -946,6 +946,7 @@ anchor_right = 1.0
|
|||||||
margin_right = 138.0
|
margin_right = 138.0
|
||||||
margin_bottom = 33.0
|
margin_bottom = 33.0
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
"_edit_lock_": true,
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1103,7 +1104,7 @@ __meta__ = {
|
|||||||
[node name="wall_fix6" type="StaticBody2D" parent="."]
|
[node name="wall_fix6" type="StaticBody2D" parent="."]
|
||||||
position = Vector2( 592.823, 97.3416 )
|
position = Vector2( 592.823, 97.3416 )
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 17
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix6"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix6"]
|
||||||
shape = SubResource( 47 )
|
shape = SubResource( 47 )
|
||||||
@@ -1114,7 +1115,7 @@ __meta__ = {
|
|||||||
[node name="wall_fix7" type="StaticBody2D" parent="."]
|
[node name="wall_fix7" type="StaticBody2D" parent="."]
|
||||||
position = Vector2( 813.079, 413.793 )
|
position = Vector2( 813.079, 413.793 )
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 17
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix7"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix7"]
|
||||||
shape = SubResource( 47 )
|
shape = SubResource( 47 )
|
||||||
@@ -1125,7 +1126,7 @@ __meta__ = {
|
|||||||
[node name="wall_fix8" type="StaticBody2D" parent="."]
|
[node name="wall_fix8" type="StaticBody2D" parent="."]
|
||||||
position = Vector2( 593.487, 336.173 )
|
position = Vector2( 593.487, 336.173 )
|
||||||
collision_layer = 16
|
collision_layer = 16
|
||||||
collision_mask = 17
|
collision_mask = 16
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix8"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="wall_fix8"]
|
||||||
shape = SubResource( 47 )
|
shape = SubResource( 47 )
|
||||||
|
|||||||
Reference in New Issue
Block a user