Module: Pathfinding

Defined in:
docs/4_Systems_003_Map_Engine.rb

Defined Under Namespace

Modules: TagsWeight, Target Classes: Cursor, Request

Constant Summary collapse

OPERATION_PER_FRAME =

Amount of node to calculate in one frame (OPTIMISATION)

150
OPERATION_PER_REQUEST =

Amount of node by requests in one frame (OPTIMISATION)

50
COST_RELOAD =

Cost of the reload

15
COST_WATCH =

Cost of the watch

9
COST_WAIT =

Cost of the wait

1
OBSTACLE_DETECTION_RANGE =

Obstacle detection range

9
TRY_COUNT =

Amount of try count

5
TRY_DELAY =

Number of frame before two path search when the first one fail

60
PATH_DIRS =

Directions to check

[1, 2, 3, 4]
WAITING_ROUTE =

Move route when waiting for a new path

RPG::MoveRoute.new
TAGS_WEIGHT =

Weight of the tags, the higher is the cost, the more the path will avoid it

{GameData::SystemTags::Road => 2, GameData::SystemTags::TSand => 4, GameData::SystemTags::SwampBorder => 20, GameData::SystemTags::DeepSwamp => 30, GameData::SystemTags::MachBike => 1000, GameData::SystemTags::TGrass => 20}
DEFAULT_SAVE =

Default save state

[]
PRESET_COMMANDS =

Method giving a preset command (the 5 first move commands)

Array.new(5) { |i| RPG::MoveCommand.new(i) }.method(:[])

Class Method Summary collapse

Class Method Details

.add_request(character, target, tries, tags) ⇒ Boolean

Add the request to the system list and start looking for path

Parameters:

  • character (Game_Character)

    the character looking for a path

  • target (Game_Character, Array<Integer>)

    character or coords to reach

  • tries (Integer)

    the number of tries before giving up the path research. :infinity for infinite try count.

  • tags (Symbol)

    the name of the Pathfinding::TagsWeight constant to use to calcultate the node weight

Returns:

  • (Boolean)

    if the request is successfully submitted



3504
3505
# File 'docs/4_Systems_003_Map_Engine.rb', line 3504

def self.add_request(character, target, tries, tags)
end

.clear

CLear all the requests



3512
3513
# File 'docs/4_Systems_003_Map_Engine.rb', line 3512

def self.clear
end

.debug=(value)

Enable or disable the debug mode

Parameters:

  • value (Boolean)

    if debug must be enabled



3531
3532
# File 'docs/4_Systems_003_Map_Engine.rb', line 3531

def self.debug=(value)
end

.debug_add(from, cursor, path)

Add a path to display

Parameters:

  • from (Game_Character)

    the character who follow the path

  • cursor (Cursor)

    the cursor used to calculate the path

  • path (Array<Integer>)

    the list of moveroute command



3544
3545
# File 'docs/4_Systems_003_Map_Engine.rb', line 3544

def self.debug_add(from, cursor, path)
end

.debug_clear(from = nil)

Clear the pathfinding debug data

Parameters:

  • from (Integer, nil) (defaults to: nil)

    the id of the caracter to clear, if nil, clear all



3535
3536
# File 'docs/4_Systems_003_Map_Engine.rb', line 3535

def self.debug_clear(from = nil)
end

.debug_update

Update the pathfinding display debug



3538
3539
# File 'docs/4_Systems_003_Map_Engine.rb', line 3538

def self.debug_update
end

.load

Load the data from the Game State



3526
3527
# File 'docs/4_Systems_003_Map_Engine.rb', line 3526

def self.load
end

.operation_per_frame=(value)

Set the number of operation per frame. By default it’s 150, be careful with the performance issues.

Parameters:

  • value (Integer)

    the new amount of operation allowed per frame



3516
3517
# File 'docs/4_Systems_003_Map_Engine.rb', line 3516

def self.operation_per_frame=(value)
end

.remove_request(character) ⇒ Boolean

Remove the request from the system list and return true if the request has been popped out.

Parameters:

Returns:

  • (Boolean)

    if the request has been popped out



3509
3510
# File 'docs/4_Systems_003_Map_Engine.rb', line 3509

def self.remove_request(character)
end

.saveArray<Pathfinding::Request>

Create an savable array of the current requests

Returns:



3523
3524
# File 'docs/4_Systems_003_Map_Engine.rb', line 3523

def self.save
end

.update

Update the pathfinding system



3519
3520
# File 'docs/4_Systems_003_Map_Engine.rb', line 3519

def self.update
end