diff --git a/entities/player/bot_player/bot_player.tscn b/entities/player/bot_player/bot_player.tscn new file mode 100644 index 0000000..84ea7a7 --- /dev/null +++ b/entities/player/bot_player/bot_player.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=4 format=3 uid="uid://b2mg28gfrryvq"] + +[ext_resource type="PackedScene" uid="uid://cbhx1xme0sb7k" path="res://entities/player/player.tscn" id="1_m1pq5"] + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_e7c8i"] +resource_local_to_scene = true +bounce = 1.0 +absorbent = true + +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dmjop"] +resource_local_to_scene = true +radius = 0.25 + +[node name="BotPlayer" instance=ExtResource("1_m1pq5")] +physics_material_override = SubResource("PhysicsMaterial_e7c8i") +bot_enabled = true +bot_aims = true +bot_shoots = true +bot_chases = true +bot_strafes = true +username = "Bot" +peer_id = 99 +team_id = 2 +team_ids = [-1, 2] + +[node name="CollisionShape3D" parent="." index="0"] +shape = SubResource("CapsuleShape3D_dmjop") + +[node name="CollisionShape3D" parent="Health" index="0"] +shape = SubResource("CapsuleShape3D_dmjop") + +[node name="Inventory" parent="Pivot" index="1"] +visible = false + +[node name="ThirdPerson" parent="." index="6"] +visible = true + +[node name="Mesh" parent="ThirdPerson" index="0" node_paths=PackedStringArray("spine_ik_target_attachment")] +spine_ik_target_attachment = NodePath("../../Pivot/Inventory/ChainGun") + +[editable path="ThirdPerson/Mesh"] +[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun"] +[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh"] +[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun"] +[editable path="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher"] diff --git a/entities/player/player.gd b/entities/player/player.gd index ad3a2d8..5de23b1 100644 --- a/entities/player/player.gd +++ b/entities/player/player.gd @@ -54,6 +54,26 @@ signal respawned(player: Player) @export_group("State") @export var input: PlayerInputController +@export_group("Bot") +@export var bot_enabled: bool = false +@export var bot_look_node3d : Node3D +@export var bot_aims: bool +@export var bot_shoots: bool +@export var bot_chases: bool +@export var bot_chase_distance: float = 10.0 +@export var bot_strafes: bool +@export var shapecast_enemies_near : ShapeCast3D +@export var shapecast_enemies_far : ShapeCast3D +@export var raycast_enemies_los : RayCast3D +var bot_enemy : Player +var bot_strafing :float = 0 #always -1, 0, or +1, oscillates =to change strafe direction +var bot_strafe_time_nominal: float = 1.5 #the amount of time to strafe in each direction +var bot_strafe_time_offset: float = 1 #the scale of an oscillating offset to the nominal time. +var bot_movement_input: Vector3 = Vector3.ZERO +var bot_rotation_input: Vector3 = Vector3.ZERO + + +@export_group("Rendering") @onready var animation_player:AnimationPlayer = $AnimationPlayer @onready var collision_shape:CollisionShape3D = $CollisionShape3D @onready var _jetpack_particles:Array = tp_mesh.get_node("JetpackFX").get_children() @@ -64,6 +84,7 @@ var _jumping:bool = false var _stutter:bool = false var _stutter_treshold:int = int(energy_max * .3) +@export_group("Multiplayer") static var pawn_player:Player @export var username:String = "Newblood": @@ -73,6 +94,7 @@ static var pawn_player:Player set = set_peer_id @export var team_id:int = -1 +@export var team_ids = Array([], TYPE_INT, "", null) signal username_changed(new_username:int) signal peer_id_changed(new_peer_id:int) @@ -135,6 +157,7 @@ func _ready() -> void: # sets initial camera rotation to match global rotation of player input.camera_rotation = global_rotation + _bot_start() #check for bot conditions if _is_pawn(): pawn_player = self @@ -164,9 +187,11 @@ func _ready() -> void: input.camera_rotation = pivot.rotation func _process(_delta:float) -> void: + _set_collision_layers() if not is_alive(): return - + if bot_enabled: + _bot_process() if _is_pawn(): # handle pivot rotation pivot.rotation.x = lerp_angle(pivot.rotation.x, input.camera_rotation.x, .5) @@ -195,6 +220,109 @@ func _is_pawn() -> bool: queue_free() return true +func _set_collision_layers() ->void: + set_collision_layer_value(8 + team_id, true) + for id in team_ids: + if id != team_id: + shapecast_enemies_near.set_collision_mask_value(8 + id, true) + shapecast_enemies_far.set_collision_mask_value(8 + id, true) + raycast_enemies_los.set_collision_mask_value(8 + id, true) + + +func _bot_start() -> void: + #this is where we would check for any missing nodes or parameters + # and accordingly disable the bot bools so they don't error out + if not bot_aims and not bot_shoots and not bot_strafes: + shapecast_enemies_near.enabled = false + shapecast_enemies_far.enabled = false + raycast_enemies_los.enabled = false + +func _bot_process() -> void: + #this function should just be for checking conditons that would call behaviors, + #not for performing the behaviors themselves (ie aim, shoot, etc) + if bot_enemy: #we have an enemy, no need to find one + if not is_alive() or not bot_enemy.is_alive(): #if we or the enemy are dead + #clear the enemy + bot_enemy = null + else: #we have a living enemy, try to shoot it + if bot_aims: + _bot_aim() + if bot_shoots: + _bot_shoot() + else: #we have no enemy, so find one + _bot_search_enemy() + _bot_move() + pass #passing here just to emphasize that bot_move runs after everything + +func _bot_search_enemy() -> void: + #near sensor takes priority over far, and + #save clocks by disabling far sensor when near has found an enemy + var enable_far : bool = true + if shapecast_enemies_near.is_colliding(): + enable_far = false + shapecast_enemies_far.enabled = enable_far + var enemy = shapecast_enemies_near.get_collider(0) + if enemy is Player: + bot_enemy = enemy + if shapecast_enemies_far.enabled and shapecast_enemies_far.is_colliding(): + enable_far = false + var enemy = shapecast_enemies_far.get_collider(0) + if enemy is Player: + bot_enemy = enemy + shapecast_enemies_far.enabled = enable_far + +func _bot_aim() -> void: + if not bot_enemy: + return + # add randomness + bot_look_node3d.look_at(bot_enemy.position) +# bot_rotation_input = Vector3(0.0, bot_look_node3d.rotation.y, 0.0) + #just sets turret-style rotation to enemy + +func _bot_shoot() -> void: + #to replace with smarter system using gradual following, skill level and accuracy + #in next version, make sure an ally is not in the way + if raycast_enemies_los.is_colliding(): #we are aiming directly at the enemy + var target = raycast_enemies_los.get_collider() + if target is Player: + var weapon = inventory.get_child(0) #hopefully I'll soon know a better way than this + weapon.trigger() #kerpow + +func _bot_move() ->void: + bot_movement_input = Vector3.ZERO + if bot_enemy: + if bot_chases: + _bot_chase() + if bot_strafes: + _bot_strafe() + +func _bot_chase() ->void: + #difference between goal and position + var chase_dir :float = (bot_enemy.position - position).length() - bot_chase_distance + #don't forget Z is inverted + bot_movement_input += Vector3(0.0, 0.0, -chase_dir).normalized() + + +func _bot_strafe() -> void: + #this is the first bot movement behavior. just circles the enemy randomly + # chop time into a small number so we can scale it without getting massive fluctuations from sin + #I dunno, just make it a multiple of everything so sin finishes smoothly at the end + var strafe_ms_max : int = (bot_strafe_time_nominal + bot_strafe_time_offset) * PI * 2000 + var ms_cycleable : int = Time.get_ticks_msec() % strafe_ms_max + var time_cycleable: float = ms_cycleable / 1000.0 + var cycle_offset : float = sin(time_cycleable) * bot_strafe_time_offset #currently cycles at a rate of PI seconds + var cycle_rate: float = bot_strafe_time_nominal + cycle_offset # now we have a smoothly oscillating number + var cycle: float = PI * cycle_rate #don't use PI * 2 because we want the nominal time PER DIRECTION + var cycle_sin: float = sin(time_cycleable / cycle) * 1.49 #scale beyond -1/+1 so we spend less time on zero + if cycle_sin > 0.25: + bot_strafing = 1.0 + elif cycle_sin < -0.25: + bot_strafing = -1.0 + else: + bot_strafing = 0.0 + bot_strafing = round(cycle_sin) + bot_movement_input += Vector3(bot_strafing, 0, 0) #set the player input to the strafing value + func _on_throw(pressed: bool) -> void: var flag: Flag = flag_carry_component._flag if pressed and flag and flag.state == flag.FlagState.TAKEN: @@ -268,7 +396,15 @@ func _integrate_forces(_state:PhysicsDirectBodyState3D) -> void: # skip if player is dead if not is_alive(): return - + if bot_enabled: + if bot_aims: + # turn left/right uses this (Player) + global_rotation.y = bot_look_node3d.global_rotation.y + #look up/down uses pivot + pivot.rotation.x = bot_look_node3d.rotation.x + if bot_chases or bot_strafes: + input.direction.x = bot_movement_input.x + input.direction.y = bot_movement_input.z var world_direction := Vector3(input.direction.x, 0.0, input.direction.y) var view_direction := camera.global_transform.basis * world_direction diff --git a/entities/player/player.tscn b/entities/player/player.tscn index c080695..183928b 100644 --- a/entities/player/player.tscn +++ b/entities/player/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=43 format=3 uid="uid://cbhx1xme0sb7k"] +[gd_scene load_steps=45 format=3 uid="uid://cbhx1xme0sb7k"] [ext_resource type="Script" path="res://entities/player/player.gd" id="1_y2i7h"] [ext_resource type="PackedScene" uid="uid://bbeecp3jusppn" path="res://interfaces/hud/iffs/IFF.tscn" id="2_s5wgp"] @@ -22,6 +22,14 @@ resource_local_to_scene = true bounce = 1.0 absorbent = true +[sub_resource type="SphereShape3D" id="SphereShape3D_2438a"] +margin = 1.0 +radius = 12.0 + +[sub_resource type="SphereShape3D" id="SphereShape3D_glux8"] +margin = 1.0 +radius = 24.0 + [sub_resource type="Animation" id="Animation_eoxkv"] length = 0.001 tracks/0/type = "value" @@ -233,7 +241,7 @@ properties/3/replication_mode = 2 [sub_resource type="SphereShape3D" id="SphereShape3D_hwe6e"] radius = 0.2 -[node name="Player" type="RigidBody3D" node_paths=PackedStringArray("iff", "health", "flag_carry_component", "walkable_surface_sensor", "hud", "inventory", "tp_mesh", "third_person", "pivot", "camera", "input")] +[node name="Player" type="RigidBody3D" node_paths=PackedStringArray("iff", "health", "flag_carry_component", "walkable_surface_sensor", "hud", "inventory", "tp_mesh", "third_person", "pivot", "camera", "input", "bot_look_node3d", "shapecast_enemies_near", "shapecast_enemies_far", "raycast_enemies_los")] collision_mask = 2147483649 collision_priority = 9.0 axis_lock_angular_x = true @@ -257,6 +265,10 @@ third_person = NodePath("ThirdPerson") pivot = NodePath("Pivot") camera = NodePath("Pivot/Camera3D") input = NodePath("Inputs") +bot_look_node3d = NodePath("bot_look_node3d") +shapecast_enemies_near = NodePath("Pivot/ShapecastEnemiesNear") +shapecast_enemies_far = NodePath("Pivot/ShapecastEnemiesFar") +raycast_enemies_los = NodePath("Pivot/RaycastEnemiesLOS") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) @@ -305,6 +317,20 @@ mesh = NodePath("FlagMesh") [node name="FlagMesh" parent="Pivot/FlagCarryComponent" instance=ExtResource("18_7nkei")] +[node name="ShapecastEnemiesNear" type="ShapeCast3D" parent="Pivot"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, -6) +shape = SubResource("SphereShape3D_2438a") +collision_mask = 128 + +[node name="ShapecastEnemiesFar" type="ShapeCast3D" parent="Pivot"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, -26) +shape = SubResource("SphereShape3D_glux8") +collision_mask = 128 + +[node name="RaycastEnemiesLOS" type="RayCast3D" parent="Pivot"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.25, -0.4) +target_position = Vector3(0, 0, -40) + [node name="HUD" parent="." instance=ExtResource("3_ccety")] [node name="AnimationPlayer" type="AnimationPlayer" parent="."] @@ -332,48 +358,63 @@ bones/8/rotation = Quaternion(0.675761, -0.399581, 0.409695, 0.464577) bones/10/rotation = Quaternion(0.212344, -0.0870591, -0.287653, 0.929831) bones/12/rotation = Quaternion(0.0811501, 0.206806, -0.754068, 0.618084) bones/14/rotation = Quaternion(0.00943715, 0.0971687, -0.145046, 0.984597) +bones/14/scale = Vector3(1, 1, 1) bones/16/rotation = Quaternion(0.202944, -0.189284, -0.192306, 0.941278) bones/18/rotation = Quaternion(0.00767626, 0.0143343, 0.192225, 0.981216) bones/20/rotation = Quaternion(-0.123455, 0.0248345, 0.23344, 0.964183) bones/24/rotation = Quaternion(0.0450684, -0.000817573, 0.0508488, 0.997689) +bones/24/scale = Vector3(1, 1, 1) bones/26/rotation = Quaternion(0.100545, -2.54424e-07, 0.00792588, 0.994901) bones/28/rotation = Quaternion(0.288532, -7.96814e-08, 0.0227446, 0.9572) bones/32/rotation = Quaternion(0.0067407, -0.0316083, 0.105474, 0.993897) bones/34/rotation = Quaternion(0.780684, 6.72079e-08, 0.0615403, 0.621889) +bones/34/scale = Vector3(1, 1, 1) bones/36/rotation = Quaternion(0.580978, -9.89914e-08, 0.0457976, 0.81263) +bones/36/scale = Vector3(1, 1, 1) bones/40/rotation = Quaternion(0.091374, 0.113691, 0.100265, 0.984211) bones/42/rotation = Quaternion(0.836841, 2.02021e-07, 0.0659672, 0.543457) bones/44/rotation = Quaternion(0.633142, -1.16317e-07, 0.0499098, 0.772425) +bones/44/scale = Vector3(1, 1, 1) bones/48/rotation = Quaternion(0.0427938, 0.15521, 0.085814, 0.983216) bones/50/rotation = Quaternion(0.729888, -5.53666e-08, 0.0575362, 0.681141) bones/52/rotation = Quaternion(0.624012, -7.97555e-08, 0.0491901, 0.779865) bones/56/rotation = Quaternion(-0.0254885, 0.0439755, -0.00910637, 0.998666) bones/58/rotation = Quaternion(-0.0119802, 0.289956, -0.0527054, 0.955513) +bones/58/scale = Vector3(1, 1, 1) bones/62/rotation = Quaternion(0.689943, 0.375565, -0.410267, 0.463261) bones/64/rotation = Quaternion(0.337746, -0.290519, 0.159479, 0.880961) bones/66/rotation = Quaternion(0.540371, -0.580679, 0.406779, 0.453147) bones/68/position = Vector3(-1.77636e-17, 0.240718, 0) bones/68/rotation = Quaternion(0.0150529, -0.289001, 0.0720108, 0.954498) +bones/68/scale = Vector3(1, 1, 1) bones/70/rotation = Quaternion(0.155965, 0.0109114, -0.00107202, 0.987702) bones/72/rotation = Quaternion(0.563923, 3.95812e-08, -0.0577906, 0.823803) +bones/72/scale = Vector3(1, 1, 1) bones/74/rotation = Quaternion(0.285209, 0.0197164, -0.0936782, 0.953673) bones/78/rotation = Quaternion(0.057484, -0.0698946, -0.0100642, 0.995846) bones/80/rotation = Quaternion(0.433127, 5.45988e-08, -0.0443866, 0.900239) +bones/80/scale = Vector3(1, 1, 1) bones/82/rotation = Quaternion(0.274138, -1.89757e-08, -0.0280937, 0.96128) bones/86/rotation = Quaternion(0.244152, 0.0521336, 0.176446, 0.952123) bones/88/rotation = Quaternion(0.0146391, -1.48753e-07, -0.121951, 0.992428) +bones/88/scale = Vector3(1, 1, 1) bones/90/rotation = Quaternion(-0.147655, -0.0737763, 0.197847, 0.966236) +bones/90/scale = Vector3(1, 1, 1) bones/94/rotation = Quaternion(0.180682, 0.0832945, -0.00387313, 0.980001) +bones/94/scale = Vector3(1, 1, 1) bones/96/rotation = Quaternion(0.245651, -6.3621e-08, -0.0251742, 0.969032) bones/98/rotation = Quaternion(0.246432, 7.61938e-08, -0.0252543, 0.968831) +bones/98/scale = Vector3(1, 1, 1) bones/102/rotation = Quaternion(0.179829, 0.0890365, -0.000307644, 0.97966) bones/104/rotation = Quaternion(0.388149, 1.27126e-07, -0.0397774, 0.920738) bones/106/rotation = Quaternion(0.372324, -1.37021e-07, -0.0381557, 0.927318) bones/110/rotation = Quaternion(-0.167577, 0.223934, 0.958827, 0.0492099) +bones/110/scale = Vector3(1, 1, 1) bones/112/rotation = Quaternion(-0.466474, -0.0088339, -0.0232928, 0.884184) bones/114/rotation = Quaternion(0.575696, 0.0793941, -0.0250592, 0.813414) bones/116/rotation = Quaternion(0.355062, 0.0493655, 0.0246355, 0.933213) bones/120/rotation = Quaternion(0.115252, 0.282473, 0.945749, -0.111737) +bones/120/scale = Vector3(1, 1, 1) bones/122/rotation = Quaternion(-0.494906, -0.0647935, 0.0183973, 0.866332) bones/124/rotation = Quaternion(0.417677, -0.0431149, 0.0062569, 0.90755) bones/126/rotation = Quaternion(0.397818, -0.0427722, -0.00601182, 0.916447) @@ -381,51 +422,69 @@ bones/126/rotation = Quaternion(0.397818, -0.0427722, -0.00601182, 0.916447) [node name="HandAttachment" parent="ThirdPerson/Mesh/Node/Skeleton3D" index="0"] transform = Transform3D(-0.152214, 0.0548831, 0.986823, 0.933991, 0.334546, 0.125459, -0.323252, 0.94078, -0.102183, -0.261612, 1.14328, 0.0896011) +[node name="Skeleton3D" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature" index="0"] +bones/0/position = Vector3(0, -0.454934, -1.09865) + [node name="grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="0"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.6068e-14, -1.19209e-07, 9.53674e-07) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.84217e-14, -1.19209e-07, 9.53674e-07) [node name="grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D/grip" index="0"] layers = 2 [node name="main" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="1"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.6068e-14, -1.19209e-07, 9.53674e-07) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.84217e-14, -1.19209e-07, 9.53674e-07) [node name="main" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D/main" index="0"] layers = 2 [node name="sides" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D" index="2"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.6068e-14, -1.19209e-07, 9.53674e-07) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.84217e-14, -1.19209e-07, 9.53674e-07) [node name="sides" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/SpaceGun/Mesh/Armature/Skeleton3D/sides" index="0"] layers = 2 +[node name="BarrelsInner" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="0"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946) + [node name="BarrelsInner" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D/BarrelsInner" index="0"] layers = 2 +[node name="BarrelsOuter" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="1"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946) + [node name="BarrelsOuter" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D/BarrelsOuter" index="0"] layers = 2 +[node name="Base" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946) + [node name="Base" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D/Base" index="0"] layers = 2 +[node name="Grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D" index="3"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.692504, 1.30946) + [node name="Grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun/Armature/Skeleton3D/Grip" index="0"] layers = 2 [node name="Barrels" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/ChainGun" index="2"] -transform = Transform3D(-1, 0, 8.42847e-08, 8.3819e-08, 0, 1, 0, 1, -3.72529e-09, -1.19209e-07, -4.76837e-07, -0.55315) +transform = Transform3D(-1, 0, 8.70787e-08, 8.47504e-08, 3.72529e-09, 1, 0, 1, -3.72529e-09, 0, 4.76837e-07, -0.55315) -[node name="Skeleton3D" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature" index="0"] -bones/0/rotation = Quaternion(0, 0.707107, 0.707107, 0) -bones/1/rotation = Quaternion(0, 0.707107, 0.707107, 0) -bones/2/rotation = Quaternion(0, 0.707107, 0.707107, 0) -bones/3/rotation = Quaternion(0, 0.707107, 0.707107, 0) +[node name="barrel" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="0"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.19209e-07, 0) [node name="barrel" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D/barrel" index="0"] layers = 2 +[node name="grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="1"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.082471, -0.0653242) + [node name="grip" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D/grip" index="0"] layers = 2 +[node name="main" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D" index="2"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.19209e-07, 0) + [node name="main" parent="ThirdPerson/Mesh/Node/Skeleton3D/HandAttachment/GrenadeLauncher/Armature/Skeleton3D/main" index="0"] layers = 2 @@ -483,6 +542,8 @@ shape = SubResource("SphereShape3D_hwe6e") target_position = Vector3(0, 0, 0) collision_mask = 2147483649 +[node name="bot_look_node3d" type="Node3D" parent="."] + [connection signal="child_entered_tree" from="Pivot/Inventory" to="Pivot/Inventory" method="_on_child_entered_tree"] [editable path="ThirdPerson/Mesh"] diff --git a/maps/blaze/blaze.tscn b/maps/blaze/blaze.tscn index c178b1c..0509616 100644 --- a/maps/blaze/blaze.tscn +++ b/maps/blaze/blaze.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://rqirbdfmt2g6"] +[gd_scene load_steps=27 format=3 uid="uid://rqirbdfmt2g6"] [ext_resource type="Script" path="res://maps/map.gd" id="1_mnbe8"] [ext_resource type="Script" path="res://maps/spawns.gd" id="2_6f0my"] @@ -6,6 +6,9 @@ [ext_resource type="Texture2D" uid="uid://cyw6oism6152n" path="res://maps/blaze/assets/textures/Ground074_1K-PNG/Ground074_1K-PNG_Color.png" id="4_g7p33"] [ext_resource type="Texture2D" uid="uid://b3hocnuaq1y5g" path="res://maps/blaze/assets/textures/Ground068_1K-PNG/Ground068_1K-PNG_Color.png" id="5_ako74"] [ext_resource type="Texture2D" uid="uid://c43blkvrhgves" path="res://maps/blaze/assets/textures/Ground068_1K-PNG/Ground068_1K-PNG_NormalDX.png" id="6_7no1c"] +[ext_resource type="PackedScene" uid="uid://cbhx1xme0sb7k" path="res://entities/player/player.tscn" id="7_68d7w"] +[ext_resource type="PackedScene" uid="uid://dlmcleklcrqcr" path="res://maps/setpieces/2LevelTower_002.tscn" id="9_ibix1"] +[ext_resource type="PackedScene" uid="uid://b2mg28gfrryvq" path="res://entities/player/bot_player/bot_player.tscn" id="9_v86p3"] [sub_resource type="Resource" id="Resource_5nwqp"] script = ExtResource("2_6f0my") @@ -81,6 +84,26 @@ plane = Plane(0, 0, 1, 0) [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ol8ht"] plane = Plane(0, 0, -1, 0) +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_ihe11"] +resource_local_to_scene = true +bounce = 1.0 +absorbent = true + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_u3mjy"] +resource_local_to_scene = true +bounce = 1.0 +absorbent = true + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_7731t"] +resource_local_to_scene = true +bounce = 1.0 +absorbent = true + +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_bblfp"] +resource_local_to_scene = true +bounce = 1.0 +absorbent = true + [node name="Blaze" type="Node3D" node_paths=PackedStringArray("terrain")] script = ExtResource("1_mnbe8") terrain = NodePath("Terrain3D") @@ -129,3 +152,33 @@ shape = SubResource("WorldBoundaryShape3D_3mpfb") [node name="North" type="CollisionShape3D" parent="Boundaries"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 921.6) shape = SubResource("WorldBoundaryShape3D_ol8ht") + +[node name="2LevelTower_002" parent="." instance=ExtResource("9_ibix1")] +transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 15.2224, 87.6573, -52.2109) + +[node name="2LevelTower_003" parent="." instance=ExtResource("9_ibix1")] +transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 57.5106, 68.9229, -1.53735) + +[node name="BotPlayerAll" parent="." instance=ExtResource("9_v86p3")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 57.5106, 75.9634, -1.53735) +physics_material_override = SubResource("PhysicsMaterial_ihe11") +peer_id = 97 + +[node name="BotPlayerAim" parent="." instance=ExtResource("9_v86p3")] +transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 23.1087, 89.6573, -51.553) +physics_material_override = SubResource("PhysicsMaterial_u3mjy") +bot_shoots = false +bot_chases = false +bot_strafes = false + +[node name="BotPlayerAimShoot" parent="." instance=ExtResource("9_v86p3")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15.5631, 89.6573, -60) +physics_material_override = SubResource("PhysicsMaterial_7731t") +bot_chases = false +bot_strafes = false +peer_id = 98 + +[node name="Player" parent="." instance=ExtResource("7_68d7w")] +transform = Transform3D(0.170209, 0, -0.985408, 0, 1, 0, 0.985408, 0, 0.170209, 13.8219, 89.6573, -44.4902) +physics_material_override = SubResource("PhysicsMaterial_bblfp") +team_ids = [-1, 2] diff --git a/maps/setpieces/2LevelTower_002.bin b/maps/setpieces/2LevelTower_002.bin new file mode 100644 index 0000000..72605dd Binary files /dev/null and b/maps/setpieces/2LevelTower_002.bin differ diff --git a/maps/setpieces/2LevelTower_002.gltf b/maps/setpieces/2LevelTower_002.gltf new file mode 100644 index 0000000..71dd10f --- /dev/null +++ b/maps/setpieces/2LevelTower_002.gltf @@ -0,0 +1,137 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v4.3.47", + "version":"2.0" + }, + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Cube" + } + ], + "materials":[ + { + "doubleSided":true, + "name":"Material", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0 + }, + "metallicFactor":0, + "roughnessFactor":0.5 + } + } + ], + "meshes":[ + { + "name":"Cube.001", + "primitives":[ + { + "attributes":{ + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 + }, + "indices":3, + "material":0 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + } + ], + "images":[ + { + "mimeType":"image/jpeg", + "name":"IMGP5511_seamless.jpg", + "uri":"IMGP5511_seamless.jpg" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5126, + "count":804, + "max":[ + 4.5, + 4, + 4.5 + ], + "min":[ + -4.5, + -6, + -4.5 + ], + "type":"VEC3" + }, + { + "bufferView":1, + "componentType":5126, + "count":804, + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":804, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5123, + "count":1788, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":9648, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":9648, + "byteOffset":9648, + "target":34962 + }, + { + "buffer":0, + "byteLength":6432, + "byteOffset":19296, + "target":34962 + }, + { + "buffer":0, + "byteLength":3576, + "byteOffset":25728, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9729, + "minFilter":9987 + } + ], + "buffers":[ + { + "byteLength":29304, + "uri":"2LevelTower_002.bin" + } + ] +} diff --git a/maps/setpieces/2LevelTower_002.gltf.import b/maps/setpieces/2LevelTower_002.gltf.import new file mode 100644 index 0000000..fce2200 --- /dev/null +++ b/maps/setpieces/2LevelTower_002.gltf.import @@ -0,0 +1,43 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://b0x5m0n56sifh" +path="res://.godot/imported/2LevelTower_002.gltf-8d6069b3bbe136f6c42134afc032c4ad.scn" + +[deps] + +source_file="res://maps/setpieces/2LevelTower_002.gltf" +dest_files=["res://.godot/imported/2LevelTower_002.gltf-8d6069b3bbe136f6c42134afc032c4ad.scn"] + +[params] + +nodes/root_type="StaticBody3D" +nodes/root_name="" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +_subresources={ +"nodes": { +"PATH:Cube": { +"generate/physics": true, +"physics/shape_type": 2 +} +} +} +gltf/naming_version=1 +gltf/embedded_image_handling=1 diff --git a/maps/setpieces/2LevelTower_002.tscn b/maps/setpieces/2LevelTower_002.tscn new file mode 100644 index 0000000..1223ba9 --- /dev/null +++ b/maps/setpieces/2LevelTower_002.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=3 format=3 uid="uid://dlmcleklcrqcr"] + +[ext_resource type="PackedScene" uid="uid://b0x5m0n56sifh" path="res://maps/setpieces/2LevelTower_002.gltf" id="1_ubdt5"] + +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_2xkme"] + +[node name="2LevelTower_002" type="Node3D"] + +[node name="2LevelTower_002" parent="." instance=ExtResource("1_ubdt5")] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="2LevelTower_002"] +shape = SubResource("ConcavePolygonShape3D_2xkme") diff --git a/maps/setpieces/IMGP5511_seamless.jpg b/maps/setpieces/IMGP5511_seamless.jpg new file mode 100644 index 0000000..c29e7fb Binary files /dev/null and b/maps/setpieces/IMGP5511_seamless.jpg differ diff --git a/maps/setpieces/IMGP5511_seamless.jpg.import b/maps/setpieces/IMGP5511_seamless.jpg.import new file mode 100644 index 0000000..88acda5 --- /dev/null +++ b/maps/setpieces/IMGP5511_seamless.jpg.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://1iej4ijxtonx" +path.s3tc="res://.godot/imported/IMGP5511_seamless.jpg-d5ed2ab9327eae776d4fd7ad505a475b.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://maps/setpieces/IMGP5511_seamless.jpg" +dest_files=["res://.godot/imported/IMGP5511_seamless.jpg-d5ed2ab9327eae776d4fd7ad505a475b.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0