mirror of
https://github.com/Relintai/godot-steering-ai-framework.git
synced 2024-11-14 04:57:19 +01:00
Replace multiline comments with comment blocks
The use of multiline blocks in GDSCript for comments leaves them in the final compiled file, increasing size and potentially processing for no end-user gain.
This commit is contained in:
parent
9f945cbf85
commit
8fb4f4c51a
@ -1,7 +1,5 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
"""
|
# Wraps the ships' positions around the world border, and controls their rendering clones.
|
||||||
Wraps the ships' positions around the world border, and controls their rendering clones.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var ShipType: = preload("res://demos/pursue_vs_seek/Ship.gd")
|
onready var ShipType: = preload("res://demos/pursue_vs_seek/Ship.gd")
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends "res://demos/pursue_vs_seek/Ship.gd"
|
extends "res://demos/pursue_vs_seek/Ship.gd"
|
||||||
"""
|
# Controls the player ship's movements based on player input.
|
||||||
Controls the player ship's movements based on player input.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var agent: = GSTSteeringAgent.new()
|
onready var agent: = GSTSteeringAgent.new()
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends "res://demos/pursue_vs_seek/Ship.gd"
|
extends "res://demos/pursue_vs_seek/Ship.gd"
|
||||||
"""
|
# Represents a ship that chases after the player.
|
||||||
Represents a ship that chases after the player.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var agent: = GSTSteeringAgent.new()
|
onready var agent: = GSTSteeringAgent.new()
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
"""
|
# Draws a notched triangle based on the vertices of the ship's polygon collider.
|
||||||
Draws a notched triangle based on the vertices of the ship's polygon collider.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
export var color: = Color()
|
export var color: = Color()
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends StaticBody2D
|
extends StaticBody2D
|
||||||
"""
|
# Draws the bounding box of the static body wall.
|
||||||
Draws the bounding box of the static body wall.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var rect: Rect2
|
var rect: Rect2
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
"""
|
# Class to control the player in basic left/right up/down movement.
|
||||||
Class to control the player in basic left/right up/down movement.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var collision_shape: = $CollisionShape2D
|
onready var collision_shape: = $CollisionShape2D
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
"""
|
# Access helper class for children to access window boundaries.
|
||||||
Access helper class for children to access window boundaries.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var player: KinematicBody2D = $Player
|
onready var player: KinematicBody2D = $Player
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
"""
|
# AI agent that uses the Seek behavior to hone in on the player's location as directly as possible.
|
||||||
AI agent that uses the Seek behavior to hone in on the player's location as directly as possible.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var collision_shape: = $CollisionShape2D
|
onready var collision_shape: = $CollisionShape2D
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
"""
|
# Holds data to instantiate and configure a number of agent entities.
|
||||||
Holds data to instantiate and configure a number of agent entities.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
export(PackedScene) var Entity: PackedScene
|
export(PackedScene) var Entity: PackedScene
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
class_name GSTAgentLocation
|
class_name GSTAgentLocation
|
||||||
"""
|
# Data type to represent an agent with a location and an orientation
|
||||||
Data type to represent an agent with a location and an orientation
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var position: = Vector3.ZERO
|
var position: = Vector3.ZERO
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
extends GSTAgentLocation
|
extends GSTAgentLocation
|
||||||
class_name GSTSteeringAgent
|
class_name GSTSteeringAgent
|
||||||
"""
|
# Extended agent data type that adds velocity and speed data.
|
||||||
Extended agent data type that adds velocity and speed data.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var zero_linear_speed_threshold: = 0.01
|
var zero_linear_speed_threshold: = 0.01
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
class_name GSTSteeringBehavior
|
class_name GSTSteeringBehavior
|
||||||
"""
|
# Base class to calculate how an AI agent steers itself.
|
||||||
Base class to calculate how an AI agent steers itself.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var enabled: = true
|
var enabled: = true
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
class_name GSTTargetAcceleration
|
class_name GSTTargetAcceleration
|
||||||
"""
|
# A linear and angular amount of acceleration.
|
||||||
A linear and angular amount of acceleration.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var linear: = Vector3.ZERO
|
var linear: = Vector3.ZERO
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
class_name Utils
|
class_name Utils
|
||||||
"""
|
# Useful math and utility functions to complement Godot's own.
|
||||||
Useful math and utility functions to complement Godot's own.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
static func clampedv3(vector: Vector3, limit: float) -> Vector3:
|
static func clampedv3(vector: Vector3, limit: float) -> Vector3:
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
extends GSTSteeringBehavior
|
extends GSTSteeringBehavior
|
||||||
class_name GSTArrive
|
class_name GSTArrive
|
||||||
"""
|
# Calculates acceleration to take an agent to its target's location.
|
||||||
Calculates acceleration to take an agent to its target's location.
|
# The calculation will attempt to arrive with zero remaining velocity.
|
||||||
The calculation will attempt to arrive with zero remaining velocity.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var target: GSTAgentLocation
|
var target: GSTAgentLocation
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
extends GSTSteeringBehavior
|
extends GSTSteeringBehavior
|
||||||
class_name GSTBlend
|
class_name GSTBlend
|
||||||
"""
|
# Blends multiple steering behaviors into one, and returns acceleration combining all of them.
|
||||||
Blends multiple steering behaviors into one, and returns acceleration combining all of them.
|
|
||||||
|
|
||||||
Each behavior is associated with a weight - a modifier by which the result will be multiplied by,
|
# # Each behavior is associated with a weight - a modifier by which the result will be multiplied by,
|
||||||
then added to a total acceleration.
|
# then added to a total acceleration.
|
||||||
|
|
||||||
Each behavior is stored internally as a `Dictionary` with a `behavior` key with a value of type
|
# # Each behavior is stored internally as a `Dictionary` with a `behavior` key with a value of type
|
||||||
`GSTSteeringBehavior` and a `weight` key with a value of type float.
|
# `GSTSteeringBehavior` and a `weight` key with a value of type float.
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var _behaviors: = []
|
onready var _behaviors: = []
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
extends GSTPursue
|
extends GSTPursue
|
||||||
class_name GSTEvade
|
class_name GSTEvade
|
||||||
"""
|
# Calculates acceleration to take an agent away from where a target agent will be.
|
||||||
Calculates acceleration to take an agent away from where a target agent will be.
|
|
||||||
|
|
||||||
The `max_predict_time` variable represents how far ahead to calculate the intersection point.
|
# # The `max_predict_time` variable represents how far ahead to calculate the intersection point.
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
func _init(
|
func _init(
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
extends GSTMatchOrientation
|
extends GSTMatchOrientation
|
||||||
class_name GSTFace
|
class_name GSTFace
|
||||||
"""
|
# Calculates angular acceleration to rotate a target to face its target's position.
|
||||||
Calculates angular acceleration to rotate a target to face its target's position.
|
# The acceleration will attempt to arrive with zero remaining angular velocity.
|
||||||
The acceleration will attempt to arrive with zero remaining angular velocity.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void:
|
func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void:
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
extends GSTSeek
|
extends GSTSeek
|
||||||
class_name GSTFlee
|
class_name GSTFlee
|
||||||
"""
|
# Calculates acceleration to take an agent directly away from a target agent.
|
||||||
Calculates acceleration to take an agent directly away from a target agent.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void:
|
func _init(agent: GSTSteeringAgent, target: GSTAgentLocation).(agent, target) -> void:
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
extends GSTMatchOrientation
|
extends GSTMatchOrientation
|
||||||
class_name GSTLookWhereYouGo
|
class_name GSTLookWhereYouGo
|
||||||
"""
|
# Calculates an angular acceleration to match an agent's orientation to its direction of travel.
|
||||||
Calculates an angular acceleration to match an agent's orientation to its direction of travel.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
func _init(agent: GSTSteeringAgent).(agent, null) -> void:
|
func _init(agent: GSTSteeringAgent).(agent, null) -> void:
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
extends GSTSteeringBehavior
|
extends GSTSteeringBehavior
|
||||||
class_name GSTMatchOrientation
|
class_name GSTMatchOrientation
|
||||||
"""
|
# Calculates an angular acceleration to match an agent's orientation to its target's.
|
||||||
Calculates an angular acceleration to match an agent's orientation to its target's.
|
# The calculation will attempt to arrive with zero remaining angular velocity.
|
||||||
The calculation will attempt to arrive with zero remaining angular velocity.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var target: GSTAgentLocation
|
var target: GSTAgentLocation
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
extends GSTSteeringBehavior
|
extends GSTSteeringBehavior
|
||||||
class_name GSTPriority
|
class_name GSTPriority
|
||||||
"""
|
# Contains multiple steering behaviors and returns only the result of the first that has a non-zero
|
||||||
Contains multiple steering behaviors and returns only the result of the first that has a non-zero
|
# acceleration.
|
||||||
acceleration.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
onready var _behaviors: = []
|
onready var _behaviors: = []
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
extends GSTSteeringBehavior
|
extends GSTSteeringBehavior
|
||||||
class_name GSTPursue
|
class_name GSTPursue
|
||||||
"""
|
# Calculates acceleration to take an agent to intersect with where a target agent will be.
|
||||||
Calculates acceleration to take an agent to intersect with where a target agent will be.
|
|
||||||
|
|
||||||
The `max_predict_time` variable represents how far ahead to calculate the intersection point.
|
# # The `max_predict_time` variable represents how far ahead to calculate the intersection point.
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var target: GSTSteeringAgent
|
var target: GSTSteeringAgent
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
extends GSTSteeringBehavior
|
extends GSTSteeringBehavior
|
||||||
class_name GSTSeek
|
class_name GSTSeek
|
||||||
"""
|
# Calculates acceleration to take an agent to a target agent's position as directly as possible
|
||||||
Calculates acceleration to take an agent to a target agent's position as directly as possible
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
var target: GSTAgentLocation
|
var target: GSTAgentLocation
|
||||||
|
Loading…
Reference in New Issue
Block a user