Udpated the engine and removed the now c++ classes.

This commit is contained in:
Relintai 2023-01-13 23:03:12 +01:00
parent eaa2475279
commit 02caaf685a
10 changed files with 5 additions and 355 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "voxelman": {"master": "65485930a20f65844d496b4ba47dec5b6ed70b91"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "983090d21a08ebed30a5ce06681269819ab12e48"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "terraman": {"master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f"}, "pandemonium_engine": {"master": "4b09cb47ab00a2fa63dbab46bc932e3c19309e53"}}
{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "voxelman": {"master": "65485930a20f65844d496b4ba47dec5b6ed70b91"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "983090d21a08ebed30a5ce06681269819ab12e48"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "terraman": {"master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f"}, "pandemonium_engine": {"master": "56296172cc6e387bf1d49ae9cf07fc596603a531"}}

View File

@ -1,10 +0,0 @@
extends Reference
class_name GSAIAgentLocation
# Represents an agent with only a location and an orientation.
# @category - Base types
# The agent's position in space.
var position : Vector3 = Vector3.ZERO
# The agent's orientation on its Y axis rotation.
var orientation : float = 0.0

View File

@ -1,19 +0,0 @@
class_name GSAIGroupBehavior
extends GSAISteeringBehavior
# Base type for group-based steering behaviors.
# @category - Base types
# Container to find neighbors of the agent and calculate group behavior.
var proximity : GSAIProximity
var _callback : FuncRef = funcref(self, "_report_neighbor")
func get_callback() -> FuncRef:
return _callback
# Internal callback for the behavior to define whether or not a member is
# relevant
# @tags - virtual
func _report_neighbor(_neighbor : GSAISteeringAgent) -> bool:
return false

View File

@ -1,129 +0,0 @@
class_name GSAIPath
extends Reference
# Represents a path made up of Vector3 waypoints, split into segments path
# follow behaviors can use.
# @category - Base types
# If `false`, the path loops.
var is_open : bool
# Total length of the path.
var length : float
var _segments : Array
var _nearest_point_on_segment : Vector3
var _nearest_point_on_path : Vector3
func initialize(waypoints : Array, _is_open : bool = false) -> void:
self.is_open = _is_open
create_path(waypoints)
_nearest_point_on_segment = waypoints[0]
_nearest_point_on_path = waypoints[0]
# Creates a path from a list of waypoints.
func create_path(waypoints : Array) -> void:
if not waypoints or waypoints.size() < 2:
printerr("Waypoints cannot be null and must contain at least two (2) waypoints.")
return
_segments = []
length = 0
var current : Vector3 = waypoints.front()
var previous : Vector3
for i in range(1, waypoints.size(), 1):
previous = current
if i < waypoints.size():
current = waypoints[i]
elif is_open:
break
else:
current = waypoints[0]
var segment : GSAISegment = GSAISegment.new(previous, current)
length += segment.length
segment.cumulative_length = length
_segments.append(segment)
# Returns the distance from `agent_current_position` to the next waypoint.
func calculate_distance(agent_current_position : Vector3) -> float:
if _segments.size() == 0:
return 0.0
var smallest_distance_squared : float = INF
var nearest_segment : GSAISegment = null
for i in range(_segments.size()):
var segment: GSAISegment = _segments[i]
var distance_squared : float = _calculate_point_segment_distance_squared(segment.begin, segment.end, agent_current_position)
if distance_squared < smallest_distance_squared:
_nearest_point_on_path = _nearest_point_on_segment
smallest_distance_squared = distance_squared
nearest_segment = segment
var length_on_path : float = nearest_segment.cumulative_length - _nearest_point_on_path.distance_to(nearest_segment.end)
return length_on_path
# Calculates a target position from the path's starting point based on the `target_distance`.
func calculate_target_position(target_distance: float) -> Vector3:
if is_open:
target_distance = clamp(target_distance, 0, length)
else:
if target_distance < 0:
target_distance = length + fmod(target_distance, length)
elif target_distance > length:
target_distance = fmod(target_distance, length)
var desired_segment: GSAISegment
for i in range(_segments.size()):
var segment: GSAISegment = _segments[i]
if segment.cumulative_length >= target_distance:
desired_segment = segment
break
if not desired_segment:
desired_segment = _segments.back()
var distance := desired_segment.cumulative_length - target_distance
return (((desired_segment.begin - desired_segment.end) * (distance / desired_segment.length)) + desired_segment.end)
# Returns the position of the first point on the path.
func get_start_point() -> Vector3:
return _segments.front().begin
# Returns the position of the last point on the path.
func get_end_point() -> Vector3:
return _segments.back().end
func _calculate_point_segment_distance_squared(start: Vector3, end: Vector3, position: Vector3) -> float:
_nearest_point_on_segment = start
var start_end : Vector3 = end - start
var start_end_length_squared : float = start_end.length_squared()
if start_end_length_squared != 0:
var t = (position - start).dot(start_end) / start_end_length_squared
_nearest_point_on_segment += start_end * clamp(t, 0, 1)
return _nearest_point_on_segment.distance_squared_to(position)
# not exposed helper struct
class GSAISegment:
var begin: Vector3
var end: Vector3
var length: float
var cumulative_length: float
func _init(_begin: Vector3, _end: Vector3) -> void:
self.begin = _begin
self.end = _end
length = _begin.distance_to(_end)

View File

@ -1,29 +0,0 @@
extends GSAIAgentLocation
class_name GSAISteeringAgent
# Adds velocity, speed, and size data to `GSAIAgentLocation`.
#
# It is the character's responsibility to keep this information up to date for
# the steering toolkit to work correctly.
# @category - Base types
# The amount of velocity to be considered effectively not moving.
var zero_linear_speed_threshold : float = 0.01
# The maximum speed at which the agent can move.
var linear_speed_max : float = 0.0
# The maximum amount of acceleration that any behavior can apply to the agent.
var linear_acceleration_max : float = 0.0
# The maximum amount of angular speed at which the agent can rotate.
var angular_speed_max : float = 0.0
# The maximum amount of angular acceleration that any behavior can apply to an
# agent.
var angular_acceleration_max : float = 0.0
# Current velocity of the agent.
var linear_velocity : Vector3 = Vector3.ZERO
# Current angular velocity of the agent.
var angular_velocity : float = 0.0
# The radius of the sphere that approximates the agent's size in space.
var bounding_radius : float = 0.0
# Used internally by group behaviors and proximities to mark the agent as already
# considered.
var is_tagged : bool = false

View File

@ -1,26 +0,0 @@
extends Reference
class_name GSAISteeringBehavior
# Base class for all steering behaviors.
#
# Steering behaviors calculate the linear and the angular acceleration to be
# to the agent that owns them.
#
# The `calculate_steering` function is the entry point for all behaviors.
# Individual steering behaviors encapsulate the steering logic.
# @category - Base types
# If `false`, all calculations return zero amounts of acceleration.
var is_enabled : bool = true
# The AI agent on which the steering behavior bases its calculations.
var agent : GSAISteeringAgent
# Sets the `acceleration` with the behavior's desired amount of acceleration.
func calculate_steering(acceleration: GSAITargetAcceleration) -> void:
if is_enabled:
call("_calculate_steering", acceleration)
else:
acceleration.set_zero()
func _calculate_steering(acceleration: GSAITargetAcceleration) -> void:
acceleration.set_zero()

View File

@ -1,31 +0,0 @@
extends Reference
class_name GSAITargetAcceleration
# A desired linear and angular amount of acceleration requested by the steering
# system.
# @category - Base types
# Linear acceleration
var linear : Vector3 = Vector3.ZERO
# Angular acceleration
var angular : float = 0.0
# Sets the linear and angular components to 0.
func set_zero() -> void:
linear.x = 0.0
linear.y = 0.0
linear.z = 0.0
angular = 0.0
# Adds `accel`'s components, multiplied by `scalar`, to this one.
func add_scaled_accel(accel: GSAITargetAcceleration, scalar: float) -> void:
linear += accel.linear * scalar
angular += accel.angular * scalar
# Returns the squared magnitude of the linear and angular components.
func get_magnitude_squared() -> float:
return linear.length_squared() + angular * angular
# Returns the magnitude of the linear and angular components.
func get_magnitude() -> float:
return sqrt(get_magnitude_squared())

View File

@ -1,40 +0,0 @@
class_name GSAIUtils
# Math and vector utility functions.
# @Category - Utilities
# Returns the `vector` with its length capped to `limit`.
static func clampedv3(vector: Vector3, limit: float) -> Vector3:
var length_squared : float = vector.length_squared()
var limit_squared : float = limit * limit
if length_squared > limit_squared:
vector *= sqrt(limit_squared / length_squared)
return vector
# Returns an angle in radians between the positive X axis and the `vector`.
#
# This assumes orientation for 3D agents that are upright and rotate
# around the Y axis.
static func vector3_to_angle(vector: Vector3) -> float:
return atan2(vector.x, vector.z)
# Returns an angle in radians between the positive X axis and the `vector`.
static func vector2_to_angle(vector: Vector2) -> float:
return atan2(vector.x, -vector.y)
# Returns a directional vector from the given orientation angle.
#
# This assumes orientation for 2D agents or 3D agents that are upright and
# rotate around the Y axis.
static func angle_to_vector2(angle: float) -> Vector2:
return Vector2(sin(-angle), cos(angle))
# Returns a vector2 with `vector`'s x and y components.
static func to_vector2(vector: Vector3) -> Vector2:
return Vector2(vector.x, vector.y)
# Returns a vector3 with `vector`'s x and y components and 0 in z.
static func to_vector3(vector: Vector2) -> Vector3:
return Vector3(vector.x, vector.y, 0)

View File

@ -1,22 +0,0 @@
extends Reference
class_name GSAIProximity
# Base container type that stores data to find the neighbors of an agent.
# @category - Proximities
# @tags - abstract
# The owning agent whose neighbors are found in the group
var agent : GSAISteeringAgent
# The agents who are part of this group and could be potential neighbors
var agents : Array = Array()
func find_neighbors(_callback: FuncRef) -> int:
return call("_find_neighbors", _callback)
# Returns a number of neighbors based on a `callback` function.
#
# `_find_neighbors` calls `callback` for each agent in the `agents` array and
# adds one to the count if its `callback` returns true.
# @tags - virtual
func _find_neighbors(_callback: FuncRef) -> int:
return 0

View File

@ -14,11 +14,6 @@ _global_script_classes=[ {
"language": @"GDScript",
"path": "res://Demos/DemoPickerUI.gd"
}, {
"base": "Reference",
"class": @"GSAIAgentLocation",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIAgentLocation.gd"
}, {
"base": "GSAISteeringBehavior",
"class": @"GSAIArrive",
"language": @"GDScript",
@ -59,11 +54,6 @@ _global_script_classes=[ {
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIFollowPath.gd"
}, {
"base": "GSAISteeringBehavior",
"class": @"GSAIGroupBehavior",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIGroupBehavior.gd"
}, {
"base": "GSAIProximity",
"class": @"GSAIInfiniteProximity",
"language": @"GDScript",
@ -89,21 +79,11 @@ _global_script_classes=[ {
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIMatchOrientation.gd"
}, {
"base": "Reference",
"class": @"GSAIPath",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIPath.gd"
}, {
"base": "GSAISteeringBehavior",
"class": @"GSAIPriority",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Behaviors/GSAIPriority.gd"
}, {
"base": "Reference",
"class": @"GSAIProximity",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Proximities/GSAIProximity.gd"
}, {
"base": "GSAISteeringBehavior",
"class": @"GSAIPursue",
"language": @"GDScript",
@ -138,35 +118,12 @@ _global_script_classes=[ {
"class": @"GSAISpecializedAgent",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/Agents/GSAISpecializedAgent.gd"
}, {
"base": "GSAIAgentLocation",
"class": @"GSAISteeringAgent",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAISteeringAgent.gd"
}, {
"base": "Reference",
"class": @"GSAISteeringBehavior",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAISteeringBehavior.gd"
}, {
"base": "Reference",
"class": @"GSAITargetAcceleration",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAITargetAcceleration.gd"
}, {
"base": "Reference",
"class": @"GSAIUtils",
"language": @"GDScript",
"path": "res://addons/com.gdquest.godot-steering-ai-framework/GSAIUtils.gd"
} ]
_global_script_class_icons={
@"GSAISeparation": "",
@"DemoPickerUI": "",
@"GSAIBlend": "",
@"GSAIEvade": "",
@"GSAIGroupBehavior": "",
@"GSAIPath": "",
@"GSAIProximity": "",
@"GSAIRadiusProximity": "",
@"GSAIFlee": "",
@"GSAIPursue": "",
@ -180,15 +137,10 @@ _global_script_class_icons={
@"GSAIArrive": "",
@"GSAIKinematicBody3DAgent": "",
@"GSAIMatchOrientation": "",
@"GSAISteeringBehavior": "",
@"GSAITargetAcceleration": "",
@"GSAIUtils": "",
@"GSAIAgentLocation": "",
@"GSAICohesion": "",
@"GSAIFollowPath": "",
@"GSAIKinematicBody2DAgent": "",
@"GSAISeek": "",
@"GSAISteeringAgent": "",
@"GSAIFace": ""
}
@ -208,6 +160,10 @@ window/size/test_height=720
window/stretch/mode="2d"
window/stretch/aspect="expand"
[editor_plugins]
enabled=PoolStringArray( "res://addons/gdc_converter/plugin.cfg" )
[input]
sf_left={