AI can 'die' now; blackboard work

This commit is contained in:
Segey Lapin
2022-01-04 06:45:16 +03:00
parent 2573492f59
commit fedb6a38e1
19 changed files with 120929 additions and 93123 deletions

View File

@@ -101,6 +101,7 @@ func _ready():
data_hair_materials[mat] = load(mat) data_hair_materials[mat] = load(mat)
CharacterSystemWorld.add_hair_material(data_hair_materials[mat], "male") CharacterSystemWorld.add_hair_material(data_hair_materials[mat], "male")
CharacterSystemWorld.add_hair_material(data_hair_materials[mat], "female") CharacterSystemWorld.add_hair_material(data_hair_materials[mat], "female")
CharacterSystemWorld.create_character_pool(1024)
assert(male_faces.size() > 0) assert(male_faces.size() > 0)
assert(female_faces.size() > 0) assert(female_faces.size() > 0)
assert(male_hairs.size() > 0) assert(male_hairs.size() > 0)
@@ -159,114 +160,25 @@ func get_hair_node(sc: Node) -> Node:
return sc.get_node(e) return sc.get_node(e)
assert(0) assert(0)
return null return null
func compose_kinematic_character(g, enable_modules = [], face = -1, hair = -1, hair_mat = -1): #func compose_kinematic_character(g, enable_modules = [], face = -1, hair = -1, hair_mat = -1):
return CharacterSystemWorld.create_character(g, enable_modules, face, hair, hair_mat) # var id = create_character_in_pool(
var body = KinematicBody.new() # return CharacterSystemWorld.create_character(g, enable_modules, face, hair, hair_mat)
var cshape = CollisionShape.new()
body.add_child(cshape)
var capsule = CapsuleShape.new()
var character_data = {
"sex": g,
"modules": enable_modules
}
var face_scene: PackedScene
var hair_scene: PackedScene
var face_i: Node
var hair_i: Node
var face_node: Node
var hair_node: Node
match g:
"female":
if face == -1:
face = rnd.randi() % female_faces.size()
if hair == -1:
hair = rnd.randi() % female_hairs.size()
face_scene = mesh_female_faces[female_faces[face]]
hair_scene = mesh_female_hairs[female_hairs[hair]]
capsule.radius = 0.2
capsule.height = 1.1
capsule.margin = 0.05
cshape.translation.x = 0
cshape.translation.y = 0.751
cshape.translation.z = 0
cshape.rotation = Vector3(-PI/2.0, 0, 0)
var i = female.instance()
body.add_child(i)
i.transform = Transform()
face_node = get_face_node(i)
hair_node = get_hair_node(i)
"male":
if face == -1:
face = rnd.randi() % male_faces.size()
if hair == -1:
hair = rnd.randi() % male_hairs.size()
face_scene = mesh_male_faces[male_faces[face]]
hair_scene = mesh_male_hairs[male_hairs[hair]]
capsule.radius = 0.3
capsule.height = 1.2
capsule.margin = 0.05
cshape.translation.x = 0
cshape.translation.y = 0.899
cshape.translation.z = 0
cshape.rotation = Vector3(-PI/2.0, 0, 0)
var i = male.instance()
body.add_child(i)
i.transform = Transform()
face_node = get_face_node(i)
hair_node = get_hair_node(i)
assert(face_node)
face_i = face_scene.instance()
face_i.add_to_group("face")
prepare_extra_skeleton(face_i, "face")
hair_i = hair_scene.instance()
hair_i.add_to_group("hair")
prepare_extra_skeleton(hair_i, "hair")
if hair_mat == -1:
hair_mat = rnd.randi() % hair_materials.size()
var hmat = data_hair_materials[hair_materials[hair_mat]]
assert(hmat)
set_hair_material(hair_i, hmat)
for e in face_node.get_children():
e.queue_free()
for e in hair_node.get_children():
e.queue_free()
face_node.add_child(face_i)
hair_node.add_child(hair_i)
var face_ctrl_i = face_ctrl.instance()
face_ctrl_i.active = true
face_i.add_child(face_ctrl_i)
face_i.set_meta("body", body)
body.set_meta("face_control", face_ctrl_i)
body.set_meta("face_playback", "parameters/state/playback")
face_ctrl_i.add_to_group("face")
face_i.transform = Transform()
character_data.face = face
character_data.hair = hair
character_data.hair_mat = hair_mat
cshape.shape = capsule
body.set_meta("character_data", character_data)
for e in enable_modules:
assert(modules.has(e))
if modules.has(e):
assert(modules[e])
var obj = modules[e].new()
body.add_child(obj)
setup_character_physics(body)
body.add_to_group("character")
return body
func replace_character(obj, g, enable_modules = [], face = -1, hair = -1, hair_mat = -1): func replace_player_character(obj, g, enable_modules = [], face = -1, hair = -1, hair_mat = -1):
assert(obj) assert(obj)
var xform = obj.global_transform var xform = obj.global_transform
var p = obj.get_parent() var p = obj.get_parent()
obj.queue_free() obj.queue_free()
CharacterSystemWorld.create_player_character_in_pool(enable_modules, xform)
var body = CharacterSystemWorld.create_character_visual(0)
# var body = compose_kinematic_character(g, enable_modules, face, hair, hair_mat) # var body = compose_kinematic_character(g, enable_modules, face, hair, hair_mat)
var body = CharacterSystemWorld.create_character(g, enable_modules, face, hair, hair_mat) # var body = CharacterSystemWorld.create_character(g, enable_modules, face, hair, hair_mat)
p.add_child(body) # p.add_child(body)
body.global_transform = xform # body.global_transform = xform
var orientation = Transform() # var orientation = Transform()
orientation.basis = xform.basis # orientation.basis = xform.basis
body.set_meta("orientation", orientation) # body.set_meta("orientation", orientation)
return body return body
const basedir = "res://scenes/clothes/" const basedir = "res://scenes/clothes/"
#func prepare_extra_skeleton(obj, g): #func prepare_extra_skeleton(obj, g):

View File

@@ -350,7 +350,8 @@ func _physics_process(delta):
base.push_back("bandit") base.push_back("bandit")
if g.length() > 0: if g.length() > 0:
print(g, " ", base) print(g, " ", base)
characters.replace_character(n, g, base) CharacterSystemWorld.create_character_in_pool(g, base, n.global_transform)
n.queue_free()
elif n.is_in_group("car"): elif n.is_in_group("car"):
var p1 = cam.global_transform.origin var p1 = cam.global_transform.origin
var p2 = n.global_transform.origin var p2 = n.global_transform.origin

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=145 format=2] [gd_scene load_steps=153 format=2]
[ext_resource path="res://scenes/characters/vroid1-female.gltf" type="PackedScene" id=1] [ext_resource path="res://scenes/characters/vroid1-female.gltf" type="PackedScene" id=1]
[ext_resource path="res://scenes/hair/female-hair1.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/hair/female-hair1.tscn" type="PackedScene" id=2]
@@ -70,6 +70,32 @@ node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeBlendTree" id=15] [sub_resource type="AnimationNodeBlendTree" id=15]
[sub_resource type="AnimationNodeAnimation" id=156]
animation = "fall-back"
[sub_resource type="AnimationNodeTimeScale" id=157]
[sub_resource type="AnimationNodeBlendTree" id=154]
nodes/Animation/node = SubResource( 156 )
nodes/Animation/position = Vector2( 201, 341 )
nodes/TimeScale/node = SubResource( 157 )
nodes/TimeScale/position = Vector2( 440, 320 )
nodes/output/position = Vector2( 680, 320 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeAnimation" id=158]
animation = "fall-front"
[sub_resource type="AnimationNodeTimeScale" id=159]
[sub_resource type="AnimationNodeBlendTree" id=155]
nodes/Animation/node = SubResource( 158 )
nodes/Animation/position = Vector2( 161, 293 )
nodes/TimeScale/node = SubResource( 159 )
nodes/TimeScale/position = Vector2( 400, 280 )
nodes/output/position = Vector2( 720, 220 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeAnimation" id=16] [sub_resource type="AnimationNodeAnimation" id=16]
animation = "start-grabbed2" animation = "start-grabbed2"
@@ -153,7 +179,7 @@ nodes/TimeScale/position = Vector2( 580, 100 )
nodes/output/position = Vector2( 1120, 120 ) nodes/output/position = Vector2( 1120, 120 )
nodes/t1/node = SubResource( 26 ) nodes/t1/node = SubResource( 26 )
nodes/t1/position = Vector2( 880, 100 ) nodes/t1/position = Vector2( 880, 100 )
node_connections = [ "output", 0, "t1", "t1", 0, "TimeScale", "t1", 1, "TimeScale 2", "TimeScale 2", 0, "Animation 2", "TimeScale", 0, "Animation" ] node_connections = [ "output", 0, "t1", "TimeScale", 0, "Animation", "t1", 0, "TimeScale", "t1", 1, "TimeScale 2", "TimeScale 2", 0, "Animation 2" ]
[sub_resource type="AnimationNodeAnimation" id=28] [sub_resource type="AnimationNodeAnimation" id=28]
animation = "walk1p2" animation = "walk1p2"
@@ -185,7 +211,7 @@ nodes/TimeScale/position = Vector2( 620, 40 )
nodes/Transition/node = SubResource( 32 ) nodes/Transition/node = SubResource( 32 )
nodes/Transition/position = Vector2( 905, 264 ) nodes/Transition/position = Vector2( 905, 264 )
nodes/output/position = Vector2( 1280, 120 ) nodes/output/position = Vector2( 1280, 120 )
node_connections = [ "output", 0, "Transition", "Transition", 0, "TimeScale", "Transition", 1, "TimeScale 2", "TimeScale 2", 0, "Animation 2", "TimeScale", 0, "Animation" ] node_connections = [ "output", 0, "Transition", "TimeScale", 0, "Animation", "TimeScale 2", 0, "Animation 2", "Transition", 0, "TimeScale", "Transition", 1, "TimeScale 2" ]
[sub_resource type="AnimationNodeAnimation" id=34] [sub_resource type="AnimationNodeAnimation" id=34]
animation = "07_01-walk" animation = "07_01-walk"
@@ -262,7 +288,7 @@ nodes/TimeScale/position = Vector2( 640, 200 )
nodes/Transition/node = SubResource( 59 ) nodes/Transition/node = SubResource( 59 )
nodes/Transition/position = Vector2( 860, 220 ) nodes/Transition/position = Vector2( 860, 220 )
nodes/output/position = Vector2( 1080, 200 ) nodes/output/position = Vector2( 1080, 200 )
node_connections = [ "output", 0, "Transition", "Transition", 1, "TimeScale 2", "TimeScale 2", 0, "Animation 2", "TimeScale", 0, "Animation" ] node_connections = [ "output", 0, "Transition", "TimeScale", 0, "Animation", "TimeScale 2", 0, "Animation 2", "Transition", 1, "TimeScale 2" ]
[sub_resource type="AnimationNodeAnimation" id=61] [sub_resource type="AnimationNodeAnimation" id=61]
animation = "female-pray-startled1" animation = "female-pray-startled1"
@@ -328,7 +354,7 @@ nodes/attack2/position = Vector2( 1140, 300 )
nodes/output/position = Vector2( 1580, 180 ) nodes/output/position = Vector2( 1580, 180 )
nodes/speed/node = SubResource( 74 ) nodes/speed/node = SubResource( 74 )
nodes/speed/position = Vector2( 540, 60 ) nodes/speed/position = Vector2( 540, 60 )
node_connections = [ "speed", 0, "Animation", "output", 0, "attack2", "TimeScale 2", 0, "Animation 3", "attack2", 0, "attack1", "attack2", 1, "TimeScale 2", "attack1", 0, "speed", "attack1", 1, "TimeScale", "TimeScale", 0, "Animation 2" ] node_connections = [ "speed", 0, "Animation", "output", 0, "attack2", "TimeScale", 0, "Animation 2", "attack2", 0, "attack1", "attack2", 1, "TimeScale 2", "attack1", 0, "speed", "attack1", 1, "TimeScale", "TimeScale 2", 0, "Animation 3" ]
[sub_resource type="AnimationNodeAnimation" id=76] [sub_resource type="AnimationNodeAnimation" id=76]
animation = "dagger-sacrifice-counter-p" animation = "dagger-sacrifice-counter-p"
@@ -550,6 +576,10 @@ switch_mode = 2
switch_mode = 2 switch_mode = 2
auto_advance = true auto_advance = true
[sub_resource type="AnimationNodeStateMachineTransition" id=160]
[sub_resource type="AnimationNodeStateMachineTransition" id=161]
[sub_resource type="AnimationNodeStateMachine" id=110] [sub_resource type="AnimationNodeStateMachine" id=110]
states/attack-melee1/node = SubResource( 135 ) states/attack-melee1/node = SubResource( 135 )
states/attack-melee1/position = Vector2( 1277, 411.193 ) states/attack-melee1/position = Vector2( 1277, 411.193 )
@@ -559,6 +589,10 @@ states/climb1a/node = SubResource( 14 )
states/climb1a/position = Vector2( 947, 503.193 ) states/climb1a/position = Vector2( 947, 503.193 )
states/drive/node = SubResource( 15 ) states/drive/node = SubResource( 15 )
states/drive/position = Vector2( 868, 316.193 ) states/drive/position = Vector2( 868, 316.193 )
states/fall-back/node = SubResource( 154 )
states/fall-back/position = Vector2( 1301.67, 633.193 )
states/fall-front/node = SubResource( 155 )
states/fall-front/position = Vector2( 1357.67, 576.193 )
states/grabbed/node = SubResource( 18 ) states/grabbed/node = SubResource( 18 )
states/grabbed/position = Vector2( 1290, 90.193 ) states/grabbed/position = Vector2( 1290, 90.193 )
states/guard-front-melee1/node = SubResource( 147 ) states/guard-front-melee1/node = SubResource( 147 )
@@ -595,9 +629,9 @@ states/turn_right/node = SubResource( 126 )
states/turn_right/position = Vector2( 1059, 620.193 ) states/turn_right/position = Vector2( 1059, 620.193 )
states/use_tap/node = SubResource( 85 ) states/use_tap/node = SubResource( 85 )
states/use_tap/position = Vector2( 283, 143.193 ) states/use_tap/position = Vector2( 283, 143.193 )
transitions = [ "locomotion", "passenger", SubResource( 86 ), "passenger", "locomotion", SubResource( 87 ), "passenger", "drive", SubResource( 88 ), "drive", "passenger", SubResource( 89 ), "drive", "locomotion", SubResource( 90 ), "locomotion", "drive", SubResource( 91 ), "sacrifice", "sacrificed", SubResource( 92 ), "sacrificed", "sacrifice", SubResource( 93 ), "locomotion", "kneel", SubResource( 94 ), "kneel", "pray", SubResource( 95 ), "pray", "locomotion", SubResource( 96 ), "pray", "pray-startled", SubResource( 97 ), "pray-startled", "pray-startled-walk", SubResource( 98 ), "sleeping", "locomotion", SubResource( 99 ), "pray-startled-walk", "stand-startled", SubResource( 100 ), "stand-startled", "locomotion", SubResource( 101 ), "locomotion", "grabbed", SubResource( 102 ), "grabbed", "locomotion", SubResource( 103 ), "locomotion", "climb1", SubResource( 104 ), "climb1", "locomotion", SubResource( 105 ), "locomotion", "climb1a", SubResource( 106 ), "climb1a", "locomotion", SubResource( 107 ), "use_tap", "locomotion", SubResource( 108 ), "locomotion", "use_tap", SubResource( 109 ), "locomotion", "start_walking", SubResource( 117 ), "start_walking", "locomotion", SubResource( 118 ), "locomotion", "stop_walking", SubResource( 119 ), "stop_walking", "locomotion", SubResource( 120 ), "locomotion", "tun_left", SubResource( 127 ), "tun_left", "locomotion", SubResource( 128 ), "locomotion", "turn_right", SubResource( 129 ), "turn_right", "locomotion", SubResource( 130 ), "locomotion", "attack-melee1", SubResource( 136 ), "attack-melee1", "locomotion", SubResource( 137 ), "attack-melee1", "guard-melee1", SubResource( 141 ), "guard-melee1", "attack-melee1", SubResource( 142 ), "locomotion", "guard-melee1", SubResource( 143 ), "guard-melee1", "locomotion", SubResource( 144 ), "attack-melee1", "guard-front-melee1", SubResource( 148 ), "guard-front-melee1", "attack-melee1", SubResource( 149 ), "locomotion", "guard-front-melee1", SubResource( 150 ), "guard-front-melee1", "locomotion", SubResource( 151 ) ] transitions = [ "locomotion", "passenger", SubResource( 86 ), "passenger", "locomotion", SubResource( 87 ), "passenger", "drive", SubResource( 88 ), "drive", "passenger", SubResource( 89 ), "drive", "locomotion", SubResource( 90 ), "locomotion", "drive", SubResource( 91 ), "sacrifice", "sacrificed", SubResource( 92 ), "sacrificed", "sacrifice", SubResource( 93 ), "locomotion", "kneel", SubResource( 94 ), "kneel", "pray", SubResource( 95 ), "pray", "locomotion", SubResource( 96 ), "pray", "pray-startled", SubResource( 97 ), "pray-startled", "pray-startled-walk", SubResource( 98 ), "sleeping", "locomotion", SubResource( 99 ), "pray-startled-walk", "stand-startled", SubResource( 100 ), "stand-startled", "locomotion", SubResource( 101 ), "locomotion", "grabbed", SubResource( 102 ), "grabbed", "locomotion", SubResource( 103 ), "locomotion", "climb1", SubResource( 104 ), "climb1", "locomotion", SubResource( 105 ), "locomotion", "climb1a", SubResource( 106 ), "climb1a", "locomotion", SubResource( 107 ), "use_tap", "locomotion", SubResource( 108 ), "locomotion", "use_tap", SubResource( 109 ), "locomotion", "start_walking", SubResource( 117 ), "start_walking", "locomotion", SubResource( 118 ), "locomotion", "stop_walking", SubResource( 119 ), "stop_walking", "locomotion", SubResource( 120 ), "locomotion", "tun_left", SubResource( 127 ), "tun_left", "locomotion", SubResource( 128 ), "locomotion", "turn_right", SubResource( 129 ), "turn_right", "locomotion", SubResource( 130 ), "locomotion", "attack-melee1", SubResource( 136 ), "attack-melee1", "locomotion", SubResource( 137 ), "attack-melee1", "guard-melee1", SubResource( 141 ), "guard-melee1", "attack-melee1", SubResource( 142 ), "locomotion", "guard-melee1", SubResource( 143 ), "guard-melee1", "locomotion", SubResource( 144 ), "attack-melee1", "guard-front-melee1", SubResource( 148 ), "guard-front-melee1", "attack-melee1", SubResource( 149 ), "locomotion", "guard-front-melee1", SubResource( 150 ), "guard-front-melee1", "locomotion", SubResource( 151 ), "locomotion", "fall-front", SubResource( 160 ), "locomotion", "fall-back", SubResource( 161 ) ]
start_node = "locomotion" start_node = "locomotion"
graph_offset = Vector2( 489.672, 57.1925 ) graph_offset = Vector2( 496.672, 7.1925 )
[sub_resource type="AnimationNodeBlendTree" id=111] [sub_resource type="AnimationNodeBlendTree" id=111]
graph_offset = Vector2( 445.846, -157.796 ) graph_offset = Vector2( 445.846, -157.796 )
@@ -614,7 +648,7 @@ nodes/blade_right/position = Vector2( 1400, 100 )
nodes/output/position = Vector2( 1820, -20 ) nodes/output/position = Vector2( 1820, -20 )
nodes/state/node = SubResource( 110 ) nodes/state/node = SubResource( 110 )
nodes/state/position = Vector2( 480, 120 ) nodes/state/position = Vector2( 480, 120 )
node_connections = [ "output", 0, "blade_right", "all_scale", 0, "state", "blade_left", 0, "all_scale", "blade_left", 1, "Animation", "blade_right", 0, "blade_left", "blade_right", 1, "Animation 2" ] node_connections = [ "output", 0, "blade_right", "blade_right", 0, "blade_left", "blade_right", 1, "Animation 2", "blade_left", 0, "all_scale", "blade_left", 1, "Animation", "all_scale", 0, "state" ]
[sub_resource type="AnimationNodeStateMachinePlayback" id=112] [sub_resource type="AnimationNodeStateMachinePlayback" id=112]
@@ -632,7 +666,7 @@ bones/101/bound_children = [ NodePath("wrist_r") ]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00418961, 0.00654769, 0.00506566 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00418961, 0.00654769, 0.00506566 )
[node name="head" type="BoneAttachment" parent="skeleton/Skeleton" index="2"] [node name="head" type="BoneAttachment" parent="skeleton/Skeleton" index="2"]
transform = Transform( 0.83427, 0.331644, -0.440515, -0.191809, 0.923568, 0.332049, 0.516932, -0.192513, 0.834056, -0.0308392, 1.3151, 0.0139266 ) transform = Transform( 0.932316, 0.218868, -0.288047, -0.122982, 0.940534, 0.316554, 0.340181, -0.259705, 0.903776, -0.0353679, 1.31372, 0.0207836 )
bone_name = "Head" bone_name = "Head"
[node name="marker_talk" type="Spatial" parent="skeleton/Skeleton/head" index="0"] [node name="marker_talk" type="Spatial" parent="skeleton/Skeleton/head" index="0"]
@@ -662,7 +696,7 @@ transform = Transform( 1, -1.24197e-11, 0, 1.06852e-11, 1, -5.82077e-11, 0, 0, 1
[node name="female-face1" parent="skeleton/Skeleton/head/face" index="0" instance=ExtResource( 3 )] [node name="female-face1" parent="skeleton/Skeleton/head/face" index="0" instance=ExtResource( 3 )]
[node name="hips" type="BoneAttachment" parent="skeleton/Skeleton" index="3"] [node name="hips" type="BoneAttachment" parent="skeleton/Skeleton" index="3"]
transform = Transform( 0.999052, 0.0440607, -0.00179843, 0.0440316, -0.998945, -0.014082, -0.00241711, 0.0139897, -0.999873, 0.000203862, 0.862223, -0.00645695 ) transform = Transform( 0.988843, 0.0743826, -0.129405, 0.0739601, -0.997197, -0.00811786, -0.129657, -0.0015435, -0.991557, 0.000203862, 0.862472, -0.00645695 )
bone_name = "Hips" bone_name = "Hips"
[node name="marker_dagger_sacrifice" type="Spatial" parent="skeleton/Skeleton/hips" index="0"] [node name="marker_dagger_sacrifice" type="Spatial" parent="skeleton/Skeleton/hips" index="0"]
@@ -677,21 +711,21 @@ monitorable = false
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="wrist_r" type="BoneAttachment" parent="skeleton/Skeleton" index="4"] [node name="wrist_r" type="BoneAttachment" parent="skeleton/Skeleton" index="4"]
transform = Transform( -0.523493, 0.831405, 0.186331, 0.799005, 0.403087, 0.446219, 0.295882, 0.382472, -0.875311, 0.246516, 0.816854, 0.0530603 ) transform = Transform( -0.155847, 0.968072, -0.196331, 0.907188, 0.218911, 0.359287, 0.390795, -0.122115, -0.912342, 0.21806, 0.798826, -0.0352511 )
bone_name = "wrist_ik_R" bone_name = "wrist_ik_R"
[node name="weapon_right" type="Spatial" parent="skeleton/Skeleton/wrist_r" index="0"] [node name="weapon_right" type="Spatial" parent="skeleton/Skeleton/wrist_r" index="0"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, -0.08, 0, -0.01 ) transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, -0.08, 0, -0.01 )
[node name="wrist_l" type="BoneAttachment" parent="skeleton/Skeleton" index="5"] [node name="wrist_l" type="BoneAttachment" parent="skeleton/Skeleton" index="5"]
transform = Transform( -0.108058, -0.685164, 0.720328, -0.790371, 0.498715, 0.355805, -0.603024, -0.530878, -0.595424, -0.214561, 0.852356, -0.138021 ) transform = Transform( -0.119609, -0.729474, 0.673469, -0.929594, 0.320491, 0.182047, -0.34864, -0.604278, -0.716448, -0.256349, 0.818886, 0.0048945 )
bone_name = "wrist_ik_L" bone_name = "wrist_ik_L"
[node name="weapon_left" type="Spatial" parent="skeleton/Skeleton/wrist_l" index="0"] [node name="weapon_left" type="Spatial" parent="skeleton/Skeleton/wrist_l" index="0"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0.08, 0, -0.01 ) transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0.08, 0, -0.01 )
[node name="chest" type="BoneAttachment" parent="skeleton/Skeleton" index="6"] [node name="chest" type="BoneAttachment" parent="skeleton/Skeleton" index="6"]
transform = Transform( 0.993031, -0.0677989, -0.096651, 0.0571863, 0.992449, -0.10864, 0.103279, 0.102345, 0.989339, -0.00688225, 1.02154, -0.0291024 ) transform = Transform( 0.991647, -0.0337554, 0.124843, 0.0471192, 0.993257, -0.105626, -0.120448, 0.110622, 0.986529, -0.0143315, 1.02163, -0.0264497 )
bone_name = "Chest" bone_name = "Chest"
[node name="chest_hurt" type="Area" parent="skeleton/Skeleton/chest" index="0"] [node name="chest_hurt" type="Area" parent="skeleton/Skeleton/chest" index="0"]
@@ -706,7 +740,7 @@ shape = SubResource( 3 )
[node name="MeshInstance" type="MeshInstance" parent="skeleton/Skeleton" index="7"] [node name="MeshInstance" type="MeshInstance" parent="skeleton/Skeleton" index="7"]
[node name="neck" type="BoneAttachment" parent="skeleton/Skeleton" index="8"] [node name="neck" type="BoneAttachment" parent="skeleton/Skeleton" index="8"]
transform = Transform( 0.930267, -0.237234, -0.27995, 0.246019, 0.96927, -0.00386425, 0.272244, -0.0652763, 0.959976, -0.0132515, 1.24324, 0.0187659 ) transform = Transform( 0.942651, -0.3302, -0.0496428, 0.329635, 0.94388, -0.0191404, 0.053161, 0.00168132, 0.998576, -0.0108881, 1.24374, 0.020659 )
bone_name = "Neck" bone_name = "Neck"
[node name="marker_neck_grab" type="Position3D" parent="skeleton/Skeleton/neck" index="0"] [node name="marker_neck_grab" type="Position3D" parent="skeleton/Skeleton/neck" index="0"]
@@ -725,6 +759,8 @@ parameters/state/playback = SubResource( 112 )
parameters/state/attack-melee1/attack1_speed/scale = 1.0 parameters/state/attack-melee1/attack1_speed/scale = 1.0
parameters/state/climb1/TimeScale/scale = 2.0 parameters/state/climb1/TimeScale/scale = 2.0
parameters/state/climb1a/TimeScale/scale = 2.0 parameters/state/climb1a/TimeScale/scale = 2.0
parameters/state/fall-back/TimeScale/scale = 1.0
parameters/state/fall-front/TimeScale/scale = 1.0
parameters/state/grabbed/TimeScale/scale = 1.0 parameters/state/grabbed/TimeScale/scale = 1.0
parameters/state/guard-front-melee1/TimeScale/scale = 1.0 parameters/state/guard-front-melee1/TimeScale/scale = 1.0
parameters/state/guard-melee1/TimeScale/scale = 1.0 parameters/state/guard-melee1/TimeScale/scale = 1.0

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=116 format=2] [gd_scene load_steps=123 format=2]
[ext_resource path="res://scenes/characters/vroid1-man.gltf" type="PackedScene" id=1] [ext_resource path="res://scenes/characters/vroid1-man.gltf" type="PackedScene" id=1]
[ext_resource path="res://scenes/hair/male-hair1.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/hair/male-hair1.tscn" type="PackedScene" id=2]
@@ -79,6 +79,32 @@ nodes/TimeScale/position = Vector2( 520, 120 )
nodes/output/position = Vector2( 740, 140 ) nodes/output/position = Vector2( 740, 140 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ] node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeAnimation" id=166]
animation = "fall-back"
[sub_resource type="AnimationNodeTimeScale" id=167]
[sub_resource type="AnimationNodeBlendTree" id=162]
graph_offset = Vector2( -555.162, -192.155 )
nodes/Animation/node = SubResource( 166 )
nodes/Animation/position = Vector2( -180, 160 )
nodes/TimeScale/node = SubResource( 167 )
nodes/TimeScale/position = Vector2( 40, 160 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeAnimation" id=163]
animation = "fall-front"
[sub_resource type="AnimationNodeTimeScale" id=164]
[sub_resource type="AnimationNodeBlendTree" id=165]
nodes/Animation/node = SubResource( 163 )
nodes/Animation/position = Vector2( 239, 374 )
nodes/TimeScale/node = SubResource( 164 )
nodes/TimeScale/position = Vector2( 451, 367 )
nodes/output/position = Vector2( 800, 360 )
node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Animation" ]
[sub_resource type="AnimationNodeAnimation" id=14] [sub_resource type="AnimationNodeAnimation" id=14]
animation = "start-grab2" animation = "start-grab2"
@@ -290,7 +316,7 @@ nodes/TimeScale/position = Vector2( 780, 260 )
nodes/Transition/node = SubResource( 118 ) nodes/Transition/node = SubResource( 118 )
nodes/Transition/position = Vector2( 500, 280 ) nodes/Transition/position = Vector2( 500, 280 )
nodes/output/position = Vector2( 1000, 260 ) nodes/output/position = Vector2( 1000, 260 )
node_connections = [ "output", 0, "TimeScale", "Transition", 0, "Animation", "Transition", 1, "Animation 2", "TimeScale", 0, "Transition" ] node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Transition", "Transition", 0, "Animation", "Transition", 1, "Animation 2" ]
[sub_resource type="AnimationNodeAnimation" id=119] [sub_resource type="AnimationNodeAnimation" id=119]
animation = "turn-right" animation = "turn-right"
@@ -318,7 +344,7 @@ nodes/TimeScale/position = Vector2( 840, 260 )
nodes/Transition/node = SubResource( 120 ) nodes/Transition/node = SubResource( 120 )
nodes/Transition/position = Vector2( 560, 260 ) nodes/Transition/position = Vector2( 560, 260 )
nodes/output/position = Vector2( 1060, 260 ) nodes/output/position = Vector2( 1060, 260 )
node_connections = [ "output", 0, "TimeScale", "Transition", 0, "Animation", "Transition", 1, "Animation 2", "TimeScale", 0, "Transition" ] node_connections = [ "output", 0, "TimeScale", "TimeScale", 0, "Transition", "Transition", 0, "Animation", "Transition", 1, "Animation 2" ]
[sub_resource type="AnimationNodeAnimation" id=123] [sub_resource type="AnimationNodeAnimation" id=123]
animation = "dagger-sacrifice-counter-a" animation = "dagger-sacrifice-counter-a"
@@ -350,7 +376,7 @@ nodes/TimeScale/position = Vector2( 700, 140 )
nodes/Transition/node = SubResource( 125 ) nodes/Transition/node = SubResource( 125 )
nodes/Transition/position = Vector2( 940, 140 ) nodes/Transition/position = Vector2( 940, 140 )
nodes/output/position = Vector2( 1240, 140 ) nodes/output/position = Vector2( 1240, 140 )
node_connections = [ "output", 0, "Transition", "Transition", 0, "TimeScale", "Transition", 1, "TimeScale 2", "TimeScale 2", 0, "Animation 2", "TimeScale", 0, "Animation" ] node_connections = [ "output", 0, "Transition", "TimeScale", 0, "Animation", "TimeScale 2", 0, "Animation 2", "Transition", 0, "TimeScale", "Transition", 1, "TimeScale 2" ]
[sub_resource type="AnimationNodeStateMachineTransition" id=55] [sub_resource type="AnimationNodeStateMachineTransition" id=55]
@@ -443,6 +469,10 @@ switch_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id=161] [sub_resource type="AnimationNodeStateMachineTransition" id=161]
switch_mode = 2 switch_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id=168]
[sub_resource type="AnimationNodeStateMachineTransition" id=169]
[sub_resource type="AnimationNodeStateMachine" id=70] [sub_resource type="AnimationNodeStateMachine" id=70]
states/attack-melee1/node = SubResource( 142 ) states/attack-melee1/node = SubResource( 142 )
states/attack-melee1/position = Vector2( 804.317, 380 ) states/attack-melee1/position = Vector2( 804.317, 380 )
@@ -452,6 +482,10 @@ states/climb1a/node = SubResource( 10 )
states/climb1a/position = Vector2( 713.444, 92 ) states/climb1a/position = Vector2( 713.444, 92 )
states/drive/node = SubResource( 13 ) states/drive/node = SubResource( 13 )
states/drive/position = Vector2( 424, 557 ) states/drive/position = Vector2( 424, 557 )
states/fall-back/node = SubResource( 162 )
states/fall-back/position = Vector2( 568.317, 615 )
states/fall-front/node = SubResource( 165 )
states/fall-front/position = Vector2( 604.317, 536 )
states/grab/node = SubResource( 16 ) states/grab/node = SubResource( 16 )
states/grab/position = Vector2( 713.444, 145 ) states/grab/position = Vector2( 713.444, 145 )
states/guard-front-melee1/node = SubResource( 157 ) states/guard-front-melee1/node = SubResource( 157 )
@@ -476,12 +510,12 @@ states/turn_right/node = SubResource( 110 )
states/turn_right/position = Vector2( 177.444, 671 ) states/turn_right/position = Vector2( 177.444, 671 )
states/use_tap/node = SubResource( 54 ) states/use_tap/node = SubResource( 54 )
states/use_tap/position = Vector2( -138.556, 174 ) states/use_tap/position = Vector2( -138.556, 174 )
transitions = [ "locomotion", "drive", SubResource( 55 ), "drive", "locomotion", SubResource( 56 ), "locomotion", "passenger", SubResource( 57 ), "passenger", "locomotion", SubResource( 58 ), "drive", "passenger", SubResource( 59 ), "passenger", "drive", SubResource( 60 ), "sleeping", "locomotion", SubResource( 61 ), "locomotion", "grab", SubResource( 62 ), "grab", "locomotion", SubResource( 63 ), "locomotion", "climb1", SubResource( 64 ), "climb1", "locomotion", SubResource( 65 ), "locomotion", "climb1a", SubResource( 66 ), "climb1a", "locomotion", SubResource( 67 ), "locomotion", "use_tap", SubResource( 68 ), "use_tap", "locomotion", SubResource( 69 ), "locomotion", "stop_walking", SubResource( 100 ), "stop_walking", "locomotion", SubResource( 101 ), "locomotion", "start_walking", SubResource( 103 ), "start_walking", "locomotion", SubResource( 104 ), "locomotion", "turn_left", SubResource( 111 ), "turn_left", "locomotion", SubResource( 112 ), "locomotion", "turn_right", SubResource( 113 ), "turn_right", "locomotion", SubResource( 114 ), "locomotion", "attack-melee1", SubResource( 143 ), "attack-melee1", "locomotion", SubResource( 144 ), "attack-melee1", "guard-melee1", SubResource( 153 ), "guard-melee1", "attack-melee1", SubResource( 154 ), "locomotion", "guard-melee1", SubResource( 155 ), "guard-melee1", "locomotion", SubResource( 156 ), "locomotion", "guard-front-melee1", SubResource( 158 ), "guard-front-melee1", "locomotion", SubResource( 159 ), "guard-front-melee1", "attack-melee1", SubResource( 160 ), "attack-melee1", "guard-front-melee1", SubResource( 161 ) ] transitions = [ "locomotion", "drive", SubResource( 55 ), "drive", "locomotion", SubResource( 56 ), "locomotion", "passenger", SubResource( 57 ), "passenger", "locomotion", SubResource( 58 ), "drive", "passenger", SubResource( 59 ), "passenger", "drive", SubResource( 60 ), "sleeping", "locomotion", SubResource( 61 ), "locomotion", "grab", SubResource( 62 ), "grab", "locomotion", SubResource( 63 ), "locomotion", "climb1", SubResource( 64 ), "climb1", "locomotion", SubResource( 65 ), "locomotion", "climb1a", SubResource( 66 ), "climb1a", "locomotion", SubResource( 67 ), "locomotion", "use_tap", SubResource( 68 ), "use_tap", "locomotion", SubResource( 69 ), "locomotion", "stop_walking", SubResource( 100 ), "stop_walking", "locomotion", SubResource( 101 ), "locomotion", "start_walking", SubResource( 103 ), "start_walking", "locomotion", SubResource( 104 ), "locomotion", "turn_left", SubResource( 111 ), "turn_left", "locomotion", SubResource( 112 ), "locomotion", "turn_right", SubResource( 113 ), "turn_right", "locomotion", SubResource( 114 ), "locomotion", "attack-melee1", SubResource( 143 ), "attack-melee1", "locomotion", SubResource( 144 ), "attack-melee1", "guard-melee1", SubResource( 153 ), "guard-melee1", "attack-melee1", SubResource( 154 ), "locomotion", "guard-melee1", SubResource( 155 ), "guard-melee1", "locomotion", SubResource( 156 ), "locomotion", "guard-front-melee1", SubResource( 158 ), "guard-front-melee1", "locomotion", SubResource( 159 ), "guard-front-melee1", "attack-melee1", SubResource( 160 ), "attack-melee1", "guard-front-melee1", SubResource( 161 ), "locomotion", "fall-front", SubResource( 168 ), "locomotion", "fall-back", SubResource( 169 ) ]
start_node = "locomotion" start_node = "locomotion"
graph_offset = Vector2( -103.683, 58 ) graph_offset = Vector2( -230.683, 15 )
[sub_resource type="AnimationNodeBlendTree" id=71] [sub_resource type="AnimationNodeBlendTree" id=71]
graph_offset = Vector2( -610.686, 0 ) graph_offset = Vector2( -534, -71 )
nodes/Animation/node = SubResource( 2 ) nodes/Animation/node = SubResource( 2 )
nodes/Animation/position = Vector2( -200, 260 ) nodes/Animation/position = Vector2( -200, 260 )
"nodes/Animation 2/node" = SubResource( 1 ) "nodes/Animation 2/node" = SubResource( 1 )
@@ -493,15 +527,10 @@ nodes/blade_right/position = Vector2( 680, 320 )
nodes/output/position = Vector2( 1040, 120 ) nodes/output/position = Vector2( 1040, 120 )
nodes/state/node = SubResource( 70 ) nodes/state/node = SubResource( 70 )
nodes/state/position = Vector2( -179, 86 ) nodes/state/position = Vector2( -179, 86 )
node_connections = [ "output", 0, "blade_right", "blade_left", 0, "state", "blade_left", 1, "Animation", "blade_right", 0, "blade_left", "blade_right", 1, "Animation 2" ] node_connections = [ "output", 0, "blade_right", "blade_right", 0, "blade_left", "blade_right", 1, "Animation 2", "blade_left", 0, "state", "blade_left", 1, "Animation" ]
[sub_resource type="AnimationNodeStateMachinePlayback" id=72] [sub_resource type="AnimationNodeStateMachinePlayback" id=72]
[sub_resource type="CapsuleShape" id=162]
margin = 0.08
radius = 0.4
height = 1.12
[node name="vroid1-man" instance=ExtResource( 1 )] [node name="vroid1-man" instance=ExtResource( 1 )]
[node name="Skeleton" parent="." index="0"] [node name="Skeleton" parent="." index="0"]
@@ -514,7 +543,7 @@ bones/94/bound_children = [ NodePath("wrist_r") ]
bones/96/bound_children = [ NodePath("wrist_l") ] bones/96/bound_children = [ NodePath("wrist_l") ]
[node name="wrist_r" type="BoneAttachment" parent="Skeleton" index="2"] [node name="wrist_r" type="BoneAttachment" parent="Skeleton" index="2"]
transform = Transform( 0.0279129, 0.998728, 0.041974, 0.0839921, -0.0441852, 0.995486, 0.996075, -0.0242614, -0.0851186, 0.24008, 1.0159, -0.0908556 ) transform = Transform( 0.0279129, 0.998728, 0.041974, 0.0839921, -0.0441852, 0.995486, 0.996075, -0.0242614, -0.0851187, 0.24008, 1.0159, -0.113418 )
bone_name = "wrist_ik_r" bone_name = "wrist_ik_r"
[node name="marker_wrist_r_grab" type="Position3D" parent="Skeleton/wrist_r" index="0"] [node name="marker_wrist_r_grab" type="Position3D" parent="Skeleton/wrist_r" index="0"]
@@ -525,7 +554,7 @@ visible = false
transform = Transform( -1.62921e-07, -1, 0, -1.62921e-07, 2.65431e-14, 1, -1, 1.62921e-07, -1.62921e-07, -0.0452205, -0.00161505, -0.0947611 ) transform = Transform( -1.62921e-07, -1, 0, -1.62921e-07, 2.65431e-14, 1, -1, 1.62921e-07, -1.62921e-07, -0.0452205, -0.00161505, -0.0947611 )
[node name="wrist_l" type="BoneAttachment" parent="Skeleton" index="3"] [node name="wrist_l" type="BoneAttachment" parent="Skeleton" index="3"]
transform = Transform( 0.531637, -0.84656, 0.0264325, -0.0845947, -0.0220212, 0.996172, -0.842737, -0.531838, -0.0833217, -0.202819, 1.03278, -0.0249881 ) transform = Transform( 0.531637, -0.84656, 0.0264325, -0.0845947, -0.0220212, 0.996172, -0.842737, -0.531838, -0.0833217, -0.202819, 1.03678, -0.00230364 )
bone_name = "wrist_ik_l" bone_name = "wrist_ik_l"
[node name="marker_wrist_l_grab" type="Position3D" parent="Skeleton/wrist_l" index="0"] [node name="marker_wrist_l_grab" type="Position3D" parent="Skeleton/wrist_l" index="0"]
@@ -536,7 +565,7 @@ visible = false
transform = Transform( -1.62921e-07, 1, 0, 1.62921e-07, 2.65431e-14, -1, -1, -1.62921e-07, -1.62921e-07, 0.04, -0.01, -0.089 ) transform = Transform( -1.62921e-07, 1, 0, 1.62921e-07, 2.65431e-14, -1, -1, -1.62921e-07, -1.62921e-07, 0.04, -0.01, -0.089 )
[node name="head" type="BoneAttachment" parent="Skeleton" index="4"] [node name="head" type="BoneAttachment" parent="Skeleton" index="4"]
transform = Transform( 0.994828, 0.00617403, -0.101387, 0.0314632, 0.930328, 0.365376, 0.0965788, -0.366676, 0.925322, -0.0326583, 1.69764, -0.00392299 ) transform = Transform( 0.985928, 0.0311576, -0.16424, 0.0314512, 0.93036, 0.365296, 0.164184, -0.365322, 0.916287, -0.0322545, 1.69764, -0.00238798 )
bone_name = "J_Bip_C_Head" bone_name = "J_Bip_C_Head"
[node name="marker_talk" type="Position3D" parent="Skeleton/head" index="0"] [node name="marker_talk" type="Position3D" parent="Skeleton/head" index="0"]
@@ -563,7 +592,7 @@ transform = Transform( 0.967007, -0.0921614, 0.237496, 0.0940632, 0.995561, 0.00
shape = SubResource( 149 ) shape = SubResource( 149 )
[node name="hips" type="BoneAttachment" parent="Skeleton" index="5"] [node name="hips" type="BoneAttachment" parent="Skeleton" index="5"]
transform = Transform( 0.985395, -0.138022, 0.0997276, 0.150103, 0.98061, -0.125986, -0.0804051, 0.139115, 0.987006, 0.000514592, 1.10104, -0.0117666 ) transform = Transform( 0.980587, -0.131394, 0.145552, 0.150098, 0.980611, -0.125986, -0.126176, 0.145387, 0.981296, 0.000514592, 1.10104, -0.0117666 )
bone_name = "J_Bip_C_Hips" bone_name = "J_Bip_C_Hips"
[node name="marker_hips_action" type="Position3D" parent="Skeleton/hips" index="0"] [node name="marker_hips_action" type="Position3D" parent="Skeleton/hips" index="0"]
@@ -579,7 +608,7 @@ monitorable = false
shape = SubResource( 148 ) shape = SubResource( 148 )
[node name="neck" type="BoneAttachment" parent="Skeleton" index="6"] [node name="neck" type="BoneAttachment" parent="Skeleton" index="6"]
transform = Transform( 0.996345, -0.0385984, 0.0762004, 0.02621, 0.987196, 0.157347, -0.0812981, -0.154775, 0.984599, -0.0288674, 1.60068, 0.0112781 ) transform = Transform( 0.991482, -0.0457548, 0.121939, 0.0262054, 0.987196, 0.157347, -0.127577, -0.152812, 0.979986, -0.0277608, 1.60068, 0.0126202 )
bone_name = "J_Bip_C_Neck" bone_name = "J_Bip_C_Neck"
[node name="marker_neck_grab" type="Position3D" parent="Skeleton/neck" index="0"] [node name="marker_neck_grab" type="Position3D" parent="Skeleton/neck" index="0"]
@@ -587,7 +616,7 @@ transform = Transform( 0.998758, -0.00781338, 0.0492147, 0.00787775, 0.999969, -
visible = false visible = false
[node name="penis_2" type="BoneAttachment" parent="Skeleton" index="7"] [node name="penis_2" type="BoneAttachment" parent="Skeleton" index="7"]
transform = Transform( 0.985395, 0.0857902, -0.147092, 0.150103, -0.845508, 0.51243, -0.0804058, -0.527025, -0.846038, 0.00954038, 0.991264, -0.106081 ) transform = Transform( 0.980587, 0.061167, -0.186302, 0.150098, -0.845509, 0.512431, -0.126176, -0.530446, -0.838276, 0.00514091, 0.991264, -0.106399 )
bone_name = "penis2" bone_name = "penis2"
[node name="marker_penis_action" type="Position3D" parent="Skeleton/penis_2" index="0"] [node name="marker_penis_action" type="Position3D" parent="Skeleton/penis_2" index="0"]
@@ -595,7 +624,7 @@ transform = Transform( 0.998824, -0.0252848, -0.0413812, 0.0249792, 0.999657, -0
visible = false visible = false
[node name="chest" type="BoneAttachment" parent="Skeleton" index="8"] [node name="chest" type="BoneAttachment" parent="Skeleton" index="8"]
transform = Transform( 0.996345, -0.0216645, 0.0826291, 0.0262187, 0.998173, -0.0544353, -0.0812988, 0.0564028, 0.995092, -0.0233174, 1.33823, -0.00534375 ) transform = Transform( 0.991482, -0.0190115, 0.128848, 0.026214, 0.998173, -0.0544356, -0.127578, 0.0573495, 0.990169, -0.0229915, 1.33823, -0.00424174 )
bone_name = "J_Bip_C_Chest" bone_name = "J_Bip_C_Chest"
[node name="chest_hurt" type="Area" parent="Skeleton/chest" index="0"] [node name="chest_hurt" type="Area" parent="Skeleton/chest" index="0"]
@@ -618,6 +647,8 @@ parameters/state/attack-melee1/TimeScale/scale = 1.0
parameters/state/climb1/TimeScale/scale = 2.0 parameters/state/climb1/TimeScale/scale = 2.0
parameters/state/climb1a/TimeScale/scale = 2.0 parameters/state/climb1a/TimeScale/scale = 2.0
parameters/state/drive/TimeScale/scale = 1.0 parameters/state/drive/TimeScale/scale = 1.0
parameters/state/fall-back/TimeScale/scale = 1.0
parameters/state/fall-front/TimeScale/scale = 1.0
parameters/state/grab/TimeScale/scale = 1.0 parameters/state/grab/TimeScale/scale = 1.0
parameters/state/guard-melee1/TimeScale/scale = 1.0 parameters/state/guard-melee1/TimeScale/scale = 1.0
parameters/state/locomotion/loc/blend_position = Vector2( -0.00293946, -0.0151844 ) parameters/state/locomotion/loc/blend_position = Vector2( -0.00293946, -0.0151844 )
@@ -639,7 +670,3 @@ parameters/state/turn_right/Transition/current = 0
parameters/state/use_tap/TimeScale/scale = 1.0 parameters/state/use_tap/TimeScale/scale = 1.0
"parameters/state/use_tap/TimeScale 2/scale" = 1.0 "parameters/state/use_tap/TimeScale 2/scale" = 1.0
parameters/state/use_tap/Transition/current = 1 parameters/state/use_tap/Transition/current = 1
[node name="CollisionShape" type="CollisionShape" parent="." index="4"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0.96478, 0 )
shape = SubResource( 162 )

View File

@@ -1,12 +1,2 @@
extends Spatial extends Spatial
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
#func _ready():
# characters.replace_character($npc1, "male", ["cmdq", "marker", "hurtboxes", "bandit"])
# characters.replace_character($npc2, "female", ["cmdq", "marker", "hurtboxes", "bandit"])

View File

@@ -9,14 +9,15 @@ script = ExtResource( 3 )
[node name="campfire" parent="." instance=ExtResource( 1 )] [node name="campfire" parent="." instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
material/0 = null
material/1 = null
[node name="tent" parent="." instance=ExtResource( 2 )] [node name="tent" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 3 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 3 )
[node name="npc1" type="Spatial" parent="." groups=["bandit", "male", "spawn"]] [node name="npc1" type="Spatial" parent="." groups=["bandit", "male", "spawn"]]
transform = Transform( 0.930494, 0, 0.366306, 0, 1, 0, -0.366306, 0, 0.930494, 2.86465, 0.178202, 0 ) transform = Transform( 0.930494, 0, 0.366306, 0, 1, 0, -0.366306, 0, 0.930494, 4.71933, 0.178202, 0 )
[node name="npc3" type="Spatial" parent="." groups=["bandit", "male", "spawn"]]
transform = Transform( 0.930494, 0, 0.366306, 0, 1, 0, -0.366306, 0, 0.930494, 2.49152, 0.178202, 0 )
[node name="npc2" type="Spatial" parent="." groups=["bandit", "female", "spawn"]] [node name="npc2" type="Spatial" parent="." groups=["bandit", "female", "spawn"]]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.38509, 0.249482, 2.91225 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.38509, 0.249482, 0.0150008 )

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ var blood = preload("res://scenes/decals/blood.tscn")
var blood_decal = preload("res://scenes/decals/blood1-decal.gltf") var blood_decal = preload("res://scenes/decals/blood1-decal.gltf")
var rnd var rnd
var initialized = false var initialized = false
func init(): func init(tick):
assert(!initialized) assert(!initialized)
if initialized: if initialized:
return return
@@ -61,7 +61,7 @@ func area_hit(area, e):
# TODO: add delay # TODO: add delay
bi.queue_free() bi.queue_free()
func update_physics(delta): func update_physics(tick, delta):
assert(initialized) assert(initialized)
var root = get_character() var root = get_character()
if !root: if !root:
@@ -98,6 +98,6 @@ func update_physics(delta):
# decal.global_transform.basis = Basis(normal).scaled(Vector3(scale, 1.0, scale)).rotated(normal, rot) # decal.global_transform.basis = Basis(normal).scaled(Vector3(scale, 1.0, scale)).rotated(normal, rot)
return ERR_BUSY return ERR_BUSY
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY

View File

@@ -10,7 +10,7 @@ extends AIScriptModule
var animtree: AnimationTree var animtree: AnimationTree
var root_motion_track var root_motion_track
func init(): func init(tick):
# process_priority = 0 # process_priority = 0
pass pass
@@ -23,7 +23,7 @@ func can_walk_there(dest: Vector3) -> bool:
else: else:
return true return true
func update_physics(delta): func update_physics(tick, delta):
var root = get_character() var root = get_character()
var orientation: Transform var orientation: Transform
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
@@ -258,5 +258,5 @@ func update_physics(delta):
root.remove_meta("cmdqueue") root.remove_meta("cmdqueue")
return ERR_BUSY return ERR_BUSY
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY

View File

@@ -29,7 +29,7 @@ const guard_distance = 2.0
const engage_distance = 10.0 const engage_distance = 10.0
const flee_distance = 5.0 const flee_distance = 5.0
var blackboard = { var init_blackboard = {
"stamina": 100.0, "stamina": 100.0,
"health": 100.0, "health": 100.0,
"melee_weapon_equipped": false, "melee_weapon_equipped": false,
@@ -62,7 +62,7 @@ func combat_event(ev, data):
var dst = where.distance_squared_to(curpos) var dst = where.distance_squared_to(curpos)
if dst < guard_distance * guard_distance: if dst < guard_distance * guard_distance:
if who == player: if who == player:
blackboard.guard = true blackboard_set("guard", true)
"damage": "damage":
var who = data[0] var who = data[0]
var weapon = data[1] var weapon = data[1]
@@ -72,13 +72,15 @@ func combat_event(ev, data):
var dst = where.distance_squared_to(curpos) var dst = where.distance_squared_to(curpos)
if dst < attack_distance * attack_distance: if dst < attack_distance * attack_distance:
if who == player: if who == player:
blackboard.melee_damage = true blackboard_set("melee_damage", true)
var initialized = false var initialized = false
func init(): func init(tick):
assert(!initialized) assert(!initialized)
name = "bandit_ai" name = "bandit_ai"
root = get_character() root = get_character()
for e in init_blackboard.keys():
blackboard_set(e, init_blackboard[e])
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
rnd = RandomNumberGenerator.new() rnd = RandomNumberGenerator.new()
rnd.randomize() rnd.randomize()
@@ -377,6 +379,39 @@ class rest extends base_bhv:
assert(root) assert(root)
active = false active = false
finished = false finished = false
class unconcious extends base_bhv:
var root
var anim1
var anim2
var state = 0
func start(root: Node, anim1: String, anim2: String):
self.root = root
self.anim1 = anim1
self.anim2 = anim2
active = true
state = 0
func run(delta: float, bb: Dictionary):
assert(active)
assert(root)
assert(anim1)
assert(anim2)
match state:
0:
characters.animation_node_travel(root, anim1)
state = 1
# if finished:
# return
# if bb.stamina < 100.0:
# print("rest: stamina: ", bb.stamina)
# bb.stamina += 15500.0 * delta
# else:
# finished = true
func stop():
assert(active)
assert(root)
active = false
finished = false
#var walk_to: walkto #var walk_to: walkto
#var flee_to: walkto #var flee_to: walkto
@@ -392,76 +427,78 @@ var conf_behaviors: = {
"melee_attack": attack, "melee_attack": attack,
"guard": guard, "guard": guard,
"rest": rest, "rest": rest,
"get_melee_damage": get_damage "get_melee_damage": get_damage,
"unconcious": unconcious
} }
var pdst = INF var pdst = INF
static func calc_utility(utility: String, bb: Dictionary): func calc_utility(utility: String):
match utility: match utility:
"take_melee_weapon": "take_melee_weapon":
if bb.health <= 0.0: if blackboard_get("health") <= 0.0:
return 0.0 return 0.0
if bb.melee_weapon_equipped: if blackboard_get("melee_weapon_equipped"):
return 0.0 return 0.0
else: else:
if bb.enemy_distance < engage_distance * engage_distance: if blackboard_get("enemy_distance") < engage_distance * engage_distance:
return 110.0 return 110.0
"approach": "approach":
if bb.health <= 0.0: if blackboard_get("health") <= 0.0:
return 0.0 return 0.0
if bb.enemy_distance < 1.6 * 1.6: if blackboard_get("enemy_distance") < 1.6 * 1.6:
return 0.0 return 0.0
if bb.stamina > 50.0 && bb.enemy_distance < engage_distance * engage_distance: if blackboard_get("stamina") > 50.0 && blackboard_get("enemy_distance") < engage_distance * engage_distance:
return 10.0 + (bb.enemy_distance - 10.0) / 6.0 return 10.0 + (blackboard_get("enemy_distance") - 10.0) / 6.0
"melee_attack": "melee_attack":
if bb.health <= 0.0: if blackboard_get("health") <= 0.0:
return 0.0 return 0.0
if bb.melee_weapon_equipped: if blackboard_get("melee_weapon_equipped"):
if bb.attack_cooldown <= 0.0: if blackboard_get("attack_cooldown") <= 0.0:
var d = attack_distance * attack_distance var d = attack_distance * attack_distance
if bb.stamina > 20.0 && bb.enemy_distance <= d: if blackboard_get("stamina") > 20.0 && blackboard_get("enemy_distance") <= d:
return 50.0 return 50.0
"flee": "flee":
if bb.health <= 0.0: if blackboard_get("health") <= 0.0:
return 0.0 return 0.0
if bb.flee_cooldown > 0.0: if blackboard_get("flee_cooldown") > 0.0:
return 0.0 return 0.0
if bb.stamina <= 50.0 && bb.stamina > 10.0 && bb.enemy_distance < flee_distance * flee_distance: if blackboard_get("stamina") <= 50.0 && blackboard_get("stamina") > 10.0 && blackboard_get("enemy_distance") < flee_distance * flee_distance:
return 100.0 + clamp((100.0 - bb.stamina), 0, 90.0) * 2.0 return 100.0 + clamp((100.0 - blackboard_get("stamina")), 0, 90.0) * 2.0
if bb.stamina <= 10.0 && bb.enemy_distance <= flee_distance * flee_distance * 0.5: if blackboard_get("stamina") <= 10.0 && blackboard_get("enemy_distance") <= flee_distance * flee_distance * 0.5:
return 250.0 return 250.0
if bb.stamina <= 50.0 && bb.enemy_distance < engage_distance * engage_distance: if blackboard_get("stamina") <= 50.0 && blackboard_get("enemy_distance") < engage_distance * engage_distance:
if bb.randf < 0.3: if blackboard_get("randf") < 0.3:
return 100.0 return 100.0
if bb.enemy_distance < 1.4 * 1.4: if blackboard_get("enemy_distance") < 1.4 * 1.4:
return 150.0 return 150.0
if bb.health < 50 && bb.health > 15: if blackboard_get("health") < 50 && blackboard_get("health") > 15:
return 160 return 160
"guard": "guard":
if bb.health <= 0.0: if blackboard_get("health") <= 0.0:
return 0.0 return 0.0
if bb.guard_cooldown > 0.0: if blackboard_get("guard_cooldown") > 0.0:
return 0.0 return 0.0
elif bb.guard: elif blackboard_get("guard"):
bb.guard = false blackboard_set("guard", false)
return 300.0 return 300.0
# elif bb.enemy_distance < guard_distance * guard_distance * 0.3 && bb.stamina > 10.0: # elif blackboard_get("enemy_distance") < guard_distance * guard_distance * 0.3 && blackboard_get("stamina") > 10.0:
# return 80 # return 80
# elif bb.enemy_distance < attack_distance * attack_distance * 0.3: # elif blackboard_get("enemy_distance") < attack_distance * attack_distance * 0.3:
# return 10.0 # return 10.0
"rest": "unconcious":
if bb.stamina >= 100.0: if blackboard_get("health") < 10:
return 0.0
if bb.stamina <= 10.0 && bb.enemy_distance >= flee_distance * flee_distance:
return 100.0 + bb.enemy_distance / 10.0
if bb.health < 10:
return 2000 return 2000
"get_melee_damage": "rest":
if bb.health <= 0.0: if blackboard_get("stamina") >= 100.0:
return 0.0 return 0.0
if bb.melee_damage: if blackboard_get("stamina") <= 10.0 && blackboard_get("enemy_distance") >= flee_distance * flee_distance:
bb.melee_damage = false return 100.0 + blackboard_get("enemy_distance") / 10.0
print("DAMAGE2 ", bb.health) "get_melee_damage":
if blackboard_get("health") <= 0.0:
return 0.0
if blackboard_get("melee_damage"):
blackboard_set("melee_damage", false)
print("DAMAGE2 ", blackboard_get("health"))
return 1000 return 1000
_: _:
assert(false) assert(false)
@@ -473,7 +510,7 @@ func select_behavior():
best_behavior = "rest" best_behavior = "rest"
best_utility = 0.0 best_utility = 0.0
for e in conf_behaviors.keys(): for e in conf_behaviors.keys():
var utility = calc_utility(e, blackboard) var utility = calc_utility(e)
if e == last_behavior: if e == last_behavior:
utility *= 2.0 utility *= 2.0
if best_utility < utility: if best_utility < utility:
@@ -486,7 +523,7 @@ var last_bhv
var last_running = [] var last_running = []
var current_running = [] var current_running = []
var run_behaviors = {} var run_behaviors = {}
func update_physics(delta): func update_physics(tick, delta):
assert(initialized) assert(initialized)
assert(root) assert(root)
var cam = root.get_viewport().get_camera() var cam = root.get_viewport().get_camera()
@@ -498,10 +535,10 @@ func update_physics(delta):
var o = root.global_transform.origin var o = root.global_transform.origin
var p = cam.get_meta("player").global_transform var p = cam.get_meta("player").global_transform
pdst = o.distance_squared_to(p.origin) pdst = o.distance_squared_to(p.origin)
blackboard.enemy_distance = pdst blackboard_set("enemy_distance", pdst)
blackboard.randf = rnd.randf() blackboard_set("randf", rnd.randf())
blackboard.enemy_pos = p.origin blackboard_set("enemy_pos", p.origin)
blackboard.space = space blackboard_set("space", space)
# var adest = o + (p.origin - o).normalized() * min(2.0, sqrt(pdst)) # var adest = o + (p.origin - o).normalized() * min(2.0, sqrt(pdst))
var adest = p.origin var adest = p.origin
var away = (o - p.origin).normalized() var away = (o - p.origin).normalized()
@@ -511,7 +548,7 @@ func update_physics(delta):
var enemy_dir: Vector3 = Transform(p.basis, Vector3()).xform(Vector3(0, 0, -1)) var enemy_dir: Vector3 = Transform(p.basis, Vector3()).xform(Vector3(0, 0, -1))
var root_dir: Vector3 = Transform(root.global_transform.basis, Vector3()).xform(Vector3(0, 0, -1)) var root_dir: Vector3 = Transform(root.global_transform.basis, Vector3()).xform(Vector3(0, 0, -1))
var dot = root_dir.dot(enemy_dir) var dot = root_dir.dot(enemy_dir)
blackboard.dot = dot blackboard_set("dot", dot)
var prev_state = state var prev_state = state
match state: match state:
@@ -544,6 +581,8 @@ func update_physics(delta):
run_behaviors[bhv].start(root, "guard-melee1", "guard-front-melee1") run_behaviors[bhv].start(root, "guard-melee1", "guard-front-melee1")
"get_melee_damage": "get_melee_damage":
run_behaviors[bhv].start(root, "guard-melee1", "guard-front-melee1", 10.0) run_behaviors[bhv].start(root, "guard-melee1", "guard-front-melee1", 10.0)
"unconcious":
run_behaviors[bhv].start(root, "fall-front", "fall-back")
_: _:
assert(false) assert(false)
# print("adding behavior: ", bhv) # print("adding behavior: ", bhv)
@@ -552,10 +591,10 @@ func update_physics(delta):
if !e in last_running: if !e in last_running:
if !e.active: if !e.active:
e.activate() e.activate()
e.run(delta, blackboard) e.run(delta, blackboard_get_dict())
#FIXME: mess :( #FIXME: mess :(
if e == run_behaviors["flee"]: if e == run_behaviors["flee"]:
blackboard.flee_cooldown = 2.0 + rnd.randf() * 3.0 blackboard_set("flee_cooldown", 2.0 + rnd.randf() * 3.0)
if e.finished && e.active: if e.finished && e.active:
# print("in current run but finished") # print("in current run but finished")
e.stop() e.stop()
@@ -570,18 +609,18 @@ func update_physics(delta):
state = 3 state = 3
3: 3:
state = 0 state = 0
if blackboard.stamina < 100.0: if blackboard_get("stamina") < 100.0:
blackboard.stamina += delta blackboard_set("stamina", blackboard_get("stamina") + delta)
if blackboard.attack_cooldown > 0.0: if blackboard_get("attack_cooldown") > 0.0:
blackboard.attack_cooldown -= delta blackboard_set("attack_cooldown", blackboard_get("attack_cooldown") - delta)
if blackboard.guard_cooldown > 0.0: if blackboard_get("guard_cooldown") > 0.0:
blackboard.guard_cooldown -= delta blackboard_set("guard_cooldown", blackboard_get("guard_cooldown") - delta)
if blackboard.flee_cooldown > 0.0: if blackboard_get("flee_cooldown") > 0.0:
blackboard.flee_cooldown -= delta blackboard_set("flee_cooldown", blackboard_get("flee_cooldown") - delta)
blackboard.stamina = clamp(blackboard.stamina, 0, 100.0) blackboard_set("stamina", clamp(blackboard_get("stamina"), 0, 100.0))
blackboard.health = clamp(blackboard.health, 0, 100.0) blackboard_set("health", clamp(blackboard_get("health"), 0, 100.0))
return ERR_BUSY return ERR_BUSY
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY
## ##

View File

@@ -6,7 +6,7 @@ extends AIScriptModule
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func init(): func init(tick):
var root = get_character() var root = get_character()
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
var cmdq = [] var cmdq = []
@@ -38,7 +38,7 @@ func action(data):
# print(data) # print(data)
# marker_hips_action(data) # marker_hips_action(data)
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY
func update_physics(delta): func update_physics(tick, delta):
return ERR_BUSY return ERR_BUSY

View File

@@ -24,7 +24,7 @@ var material = preload("res://scenes/clothes/mystress_clothes.material")
# ACTION # ACTION
#} #}
#var state = PRAYING #var state = PRAYING
func init(): func init(tick):
root = get_character() root = get_character()
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
root.add_to_group("mystress") root.add_to_group("mystress")
@@ -74,7 +74,7 @@ func get_dest(pt: Vector3, exclusions: Array) -> Vector3:
if !r.empty(): if !r.empty():
ret = r.position - offt ret = r.position - offt
return ret return ret
func update_physics(delta): func update_physics(tick, delta):
var cmdq = [] var cmdq = []
if !skel: if !skel:
skel = root.get_meta("skeleton") skel = root.get_meta("skeleton")
@@ -226,5 +226,5 @@ func update_physics(delta):
## cmdq.push_back(["equip", "wrist_r/weapon_right", "s_dagger"]) ## cmdq.push_back(["equip", "wrist_r/weapon_right", "s_dagger"])
## other.set_meta("cmdqueue", cmdq) ## other.set_meta("cmdqueue", cmdq)
## group_manager.submit_player_npc_event_arot(root, "sacrificed-a", root, "sacrificed", root) ## group_manager.submit_player_npc_event_arot(root, "sacrificed-a", root, "sacrificed", root)
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY

View File

@@ -22,7 +22,7 @@ var basedir = "res://scenes/clothes/"
var material_female = preload("res://scenes/clothes/nun-clothes.material") var material_female = preload("res://scenes/clothes/nun-clothes.material")
var material_male = preload("res://scenes/clothes/clothes-male.material") var material_male = preload("res://scenes/clothes/clothes-male.material")
func init(): func init(tick):
name = "student_ai" name = "student_ai"
root = get_character() root = get_character()
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
@@ -42,8 +42,8 @@ func init():
g += garments_male_main g += garments_male_main
h += garments_head_male h += garments_head_male
characters.call_deferred("setup_garments", root, g, h, material_male) characters.call_deferred("setup_garments", root, g, h, material_male)
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY
func update_physics(delta): func update_physics(tick, delta):
return ERR_BUSY return ERR_BUSY

View File

@@ -15,7 +15,7 @@ var garments = ["male-panties1", "male-shirt1"]
var garments_head = [] var garments_head = []
var basedir = "res://scenes/clothes/" var basedir = "res://scenes/clothes/"
var material = preload("res://scenes/clothes/clothes-male.material") var material = preload("res://scenes/clothes/clothes-male.material")
func init(): func init(tick):
root = get_character() root = get_character()
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
@@ -81,8 +81,8 @@ func setup_garments():
# cmdq.push_back(["equip", "wrist_r/weapon_right", "s_dagger"]) # cmdq.push_back(["equip", "wrist_r/weapon_right", "s_dagger"])
# other.set_meta("cmdqueue", cmdq) # other.set_meta("cmdqueue", cmdq)
# group_manager.submit_player_npc_event_arot(root, "sacrificed-a", root, "sacrificed", root) # group_manager.submit_player_npc_event_arot(root, "sacrificed-a", root, "sacrificed", root)
func update_physics(delta): func update_physics(tick, delta):
return ERR_BUSY return ERR_BUSY
func update(delta): func update(tick, delta):
return ERR_BUSY return ERR_BUSY

View File

@@ -10,7 +10,7 @@ extends AIScriptModule
var cam var cam
var fps_cam var fps_cam
var motion = Vector2() var motion = Vector2()
func init(): func init(tick):
var root = get_character() var root = get_character()
assert(root.has_meta("skeleton")) assert(root.has_meta("skeleton"))
@@ -19,7 +19,7 @@ var jump = false
var equipped = false var equipped = false
var vjump = Vector3() var vjump = Vector3()
func update(delta): func update(tick, delta):
if !controls.is_gui: if !controls.is_gui:
if !attack: if !attack:
if Input.is_action_just_pressed("attack"): if Input.is_action_just_pressed("attack"):
@@ -31,7 +31,7 @@ func update(delta):
return ERR_BUSY return ERR_BUSY
func update_physics(delta): func update_physics(tick, delta):
var orientation: Transform var orientation: Transform
var root = get_character() var root = get_character()
if !root.has_meta("cam"): if !root.has_meta("cam"):

View File

@@ -124,7 +124,7 @@ func _process(delta):
var fps_cam_rot_y var fps_cam_rot_y
var fps_cam_rot_x var fps_cam_rot_x
var default_offset var default_offset
player = characters.replace_character($player, "male", ["player", "cmdq", "player_clothes", "hurtboxes"]) player = characters.replace_player_character($player, "male", ["player", "cmdq", "player_clothes", "hurtboxes"])
$player.remove_child(viewer) $player.remove_child(viewer)
player.add_child(viewer) player.add_child(viewer)
# player.add_child(VoxelViewer.new()) # player.add_child(VoxelViewer.new())