update biome generator to support new ai #34
@@ -15,8 +15,8 @@ var _enable_state_machine: bool = true
|
|||||||
@export var anim_player: AnimationPlayer
|
@export var anim_player: AnimationPlayer
|
||||||
|
|
||||||
@export_group("Entities")
|
@export_group("Entities")
|
||||||
enum EntityType { HUMANOID, ANIMAL }
|
enum EntityType { FARMER, CITIZEN_WALKER, CITIZEN_SITTER, CAT, CROW, FOX, GOAT, RACOON, WAGYU }
|
||||||
@export var entity_type: EntityType = EntityType.HUMANOID
|
@export var entity_type: EntityType = EntityType.FARMER
|
||||||
@export var entity_name: String = ""
|
@export var entity_name: String = ""
|
||||||
@export var allowed_biomes: Array[String] = []
|
@export var allowed_biomes: Array[String] = []
|
||||||
@export_range(0.0, 100.0, 0.1) var spawn_uniqueness: float = 1.0
|
@export_range(0.0, 100.0, 0.1) var spawn_uniqueness: float = 1.0
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
[node name="AiCat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_85o24")]
|
[node name="AiCat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_85o24")]
|
||||||
anim_player = NodePath("Cat_rig/AnimationPlayer")
|
anim_player = NodePath("Cat_rig/AnimationPlayer")
|
||||||
entity_type = 1
|
entity_type = 3
|
||||||
entity_name = "Cat"
|
entity_name = "Cat"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
[node name="AiCrow" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_tx3nx")]
|
[node name="AiCrow" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_tx3nx")]
|
||||||
anim_player = NodePath("Crow_rig/AnimationPlayer")
|
anim_player = NodePath("Crow_rig/AnimationPlayer")
|
||||||
|
entity_type = 4
|
||||||
|
entity_name = "Crow"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("WaitTrainState")
|
initial_state = NodePath("WaitTrainState")
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
[node name="AiFox" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_m3efo")]
|
[node name="AiFox" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_m3efo")]
|
||||||
anim_player = NodePath("Fox_rig/AnimationPlayer")
|
anim_player = NodePath("Fox_rig/AnimationPlayer")
|
||||||
|
entity_type = 5
|
||||||
|
entity_name = "Fox"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("IdleState")
|
initial_state = NodePath("IdleState")
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
[node name="AiGoat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_f7hhh")]
|
[node name="AiGoat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_f7hhh")]
|
||||||
anim_player = NodePath("Goat_rig/AnimationPlayer")
|
anim_player = NodePath("Goat_rig/AnimationPlayer")
|
||||||
|
entity_type = 6
|
||||||
|
entity_name = "Goat"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("IdleState")
|
initial_state = NodePath("IdleState")
|
||||||
@@ -26,7 +28,7 @@ exit_on_action_finished = true
|
|||||||
|
|
||||||
[node name="Goat_rig" parent="." index="3" unique_id=1336829719 instance=ExtResource("2_oxwbf")]
|
[node name="Goat_rig" parent="." index="3" unique_id=1336829719 instance=ExtResource("2_oxwbf")]
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="Goat_rig/Rig_Goat" parent_id_path=PackedInt32Array(1336829719, 1896192446) index="0" unique_id=1573667924]
|
[node name="Skeleton3D" parent="Goat_rig/Rig_Goat" parent_id_path=PackedInt32Array(1336829719, 123281310) index="0" unique_id=1526518923]
|
||||||
bones/1/position = Vector3(-8.352713e-09, 0.36986786, 0.8951362)
|
bones/1/position = Vector3(-8.352713e-09, 0.36986786, 0.8951362)
|
||||||
bones/1/rotation = Quaternion(0.1276911, -0.695482, -0.12769035, 0.69548184)
|
bones/1/rotation = Quaternion(0.1276911, -0.695482, -0.12769035, 0.69548184)
|
||||||
bones/2/rotation = Quaternion(-8.7811394e-08, -9.458198e-08, -0.5904155, 0.80709946)
|
bones/2/rotation = Quaternion(-8.7811394e-08, -9.458198e-08, -0.5904155, 0.80709946)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://bdqeshcwwnyc4" path="res://core/ai/agents/human/ai_citizen.tscn" id="1_cduuu"]
|
[ext_resource type="PackedScene" uid="uid://bdqeshcwwnyc4" path="res://core/ai/agents/human/ai_citizen.tscn" id="1_cduuu"]
|
||||||
|
|
||||||
[node name="AiCitizenSitter" unique_id=1228675528 instance=ExtResource("1_cduuu")]
|
[node name="AiCitizenSitter" unique_id=1228675528 instance=ExtResource("1_cduuu")]
|
||||||
|
entity_type = 2
|
||||||
entity_name = "CitizenSitter"
|
entity_name = "CitizenSitter"
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 1142246531) index="0" unique_id=928995817]
|
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 1142246531) index="0" unique_id=928995817]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_8d0tj"]
|
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_8d0tj"]
|
||||||
|
|
||||||
[node name="AiCitizenWalker" unique_id=1228675528 instance=ExtResource("1_dms8s")]
|
[node name="AiCitizenWalker" unique_id=1228675528 instance=ExtResource("1_dms8s")]
|
||||||
|
entity_type = 1
|
||||||
entity_name = "CitizenWalker"
|
entity_name = "CitizenWalker"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="4_2oda6"]
|
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="4_2oda6"]
|
||||||
|
|
||||||
[node name="AiFarmer" unique_id=1228675528 instance=ExtResource("1_l2y7m")]
|
[node name="AiFarmer" unique_id=1228675528 instance=ExtResource("1_l2y7m")]
|
||||||
|
entity_type = 0
|
||||||
entity_name = "Farmer"
|
entity_name = "Farmer"
|
||||||
allowed_biomes = Array[String](["countryside"])
|
allowed_biomes = Array[String](["countryside"])
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
[node name="AiRacoon" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_seif5")]
|
[node name="AiRacoon" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_seif5")]
|
||||||
anim_player = NodePath("Raccoon_rig/AnimationPlayer")
|
anim_player = NodePath("Raccoon_rig/AnimationPlayer")
|
||||||
|
entity_type = 7
|
||||||
|
entity_name = "Racoon"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
initial_state = NodePath("IdleState")
|
initial_state = NodePath("IdleState")
|
||||||
@@ -26,7 +28,7 @@ exit_on_action_finished = true
|
|||||||
|
|
||||||
[node name="Raccoon_rig" parent="." index="3" unique_id=338211330 instance=ExtResource("2_obtl0")]
|
[node name="Raccoon_rig" parent="." index="3" unique_id=338211330 instance=ExtResource("2_obtl0")]
|
||||||
|
|
||||||
[node name="Skeleton3D" parent="Raccoon_rig/Rig_Raccoon" parent_id_path=PackedInt32Array(338211330, 1484615769) index="0" unique_id=689430915]
|
[node name="Skeleton3D" parent="Raccoon_rig/Rig_Raccoon" parent_id_path=PackedInt32Array(338211330, 590893883) index="0" unique_id=1830599374]
|
||||||
bones/1/position = Vector3(2.0224038e-08, 0.20926544, 0.2908604)
|
bones/1/position = Vector3(2.0224038e-08, 0.20926544, 0.2908604)
|
||||||
bones/1/rotation = Quaternion(0.12769087, -0.6954821, -0.12769023, 0.69548184)
|
bones/1/rotation = Quaternion(0.12769087, -0.6954821, -0.12769023, 0.69548184)
|
||||||
bones/1/scale = Vector3(1, 0.99999994, 0.99999994)
|
bones/1/scale = Vector3(1, 0.99999994, 0.99999994)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
[node name="AiWagyu" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_01jto")]
|
[node name="AiWagyu" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_01jto")]
|
||||||
anim_player = NodePath("Wagyu_rig/AnimationPlayer")
|
anim_player = NodePath("Wagyu_rig/AnimationPlayer")
|
||||||
entity_type = 1
|
entity_type = 8
|
||||||
entity_name = "Wagyu"
|
entity_name = "Wagyu"
|
||||||
|
|
||||||
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
|
||||||
|
|||||||
@@ -4,11 +4,6 @@ extends Node3D
|
|||||||
const CHUNK_TYPE_BIOME: int = 0
|
const CHUNK_TYPE_BIOME: int = 0
|
||||||
const CHUNK_TYPE_STRAIGHT_TRACK: int = 1
|
const CHUNK_TYPE_STRAIGHT_TRACK: int = 1
|
||||||
const CHUNK_TYPE_CURVED_TRACK: int = 2
|
const CHUNK_TYPE_CURVED_TRACK: int = 2
|
||||||
const ENTITY_TYPE_HUMANOID: int = 0
|
|
||||||
const ENTITY_TYPE_ANIMAL: int = 1
|
|
||||||
const ENTITY_SPAWN_ANY: int = 0
|
|
||||||
const ENTITY_SPAWN_HUMANOID_ONLY: int = 1
|
|
||||||
const ENTITY_SPAWN_ANIMAL_ONLY: int = 2
|
|
||||||
|
|
||||||
const CHUNK_GENERATION_FRAME_BUDGET_USEC: int = 1000 #2 ms/frame to generate chunks
|
const CHUNK_GENERATION_FRAME_BUDGET_USEC: int = 1000 #2 ms/frame to generate chunks
|
||||||
const CHUNK_CLEANUP_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per cleanup
|
const CHUNK_CLEANUP_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per cleanup
|
||||||
@@ -922,11 +917,10 @@ func _spawn_entities_for_chunk(root: Node, biome_name: String) -> void:
|
|||||||
|
|
||||||
func _get_spawn_point_type_filter(spawn_point: Node) -> int:
|
func _get_spawn_point_type_filter(spawn_point: Node) -> int:
|
||||||
if "allowed_type" in spawn_point:
|
if "allowed_type" in spawn_point:
|
||||||
match spawn_point.allowed_type:
|
if spawn_point.allowed_type == 0:
|
||||||
ENTITY_SPAWN_HUMANOID_ONLY:
|
return -1
|
||||||
return ENTITY_TYPE_HUMANOID
|
else:
|
||||||
ENTITY_SPAWN_ANIMAL_ONLY:
|
return spawn_point.allowed_type - 1
|
||||||
return ENTITY_TYPE_ANIMAL
|
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
func _pick_compatible_entity(biome_name: String, type_filter: int) -> PackedScene:
|
func _pick_compatible_entity(biome_name: String, type_filter: int) -> PackedScene:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
extends Marker3D
|
extends Marker3D
|
||||||
class_name EntitySpawnPoint
|
class_name EntitySpawnPoint
|
||||||
|
|
||||||
enum AllowedType { ANY, HUMANOID_ONLY, ANIMAL_ONLY }
|
enum AllowedType { ANY, FARMER, CITIZEN_WALKER, CITIZEN_SITTER, CAT, CROW, FOX, GOAT, RACOON, WAGYU }
|
||||||
|
|
||||||
@export var allowed_type: AllowedType = AllowedType.ANY
|
@export var allowed_type: AllowedType = AllowedType.ANY
|
||||||
@export_range(0.0, 1.0, 0.01) var spawn_chance: float = 1.0
|
@export_range(0.0, 1.0, 0.01) var spawn_chance: float = 1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user