"Action:Get moveable area", "Action:Get moveable area by UID" which could get move-able area.

"Action:Get moving path", "Action:Get moving path by UID" which could get the shortest moving path between source chess to destination chess/tile.

Get moveable areaThere are 5 parameters in this action.

Chess"Chess" is the target of moved chess instance.

Moving points and Moving costConceptTarget chess has an energy point named "moving points", and each tile has a cost called "moving cost" to reduce the energy point of chess when this chess moves on the tile.The tile is "move-able" if this chess could "stand on" with remainder moving points is equal or more then 0.

Moving costThis parameter could be a number type, or a string type. Each tile has an equal moving cost with this number value.Put "Expression:INFINITY" in this parameter to be an infinity cost. User might set the path mode to "A*" to get better performance in this case.

Cost functionMoving cost of each tile could be got by a cost function named "Condition:On cost", if this parameter is a string.There are some expressions could be used under this condition,

Expression:ChessUID, to get target chess instance

Expression:TileUID, Expression:TileX, Expression:TileY, to get the target tile

Then call "Action:Set cost" to set the moving cost of this tile. "Expression:BLOCKING" could be used in the parameter of this action for a no move-able. Tile is also no move-able if no "Action:Set cost" had been called (i.e. no moving cost had been return) under "Condition:On cost".

Cache costIf set "Cache cost" to "Yes" in property table, the "Condition:On cost"Set " will only be triggered once for each tile in a request.Set "Cache cost" to "No" if user need to reference previous tile in cost function.If Expression:PreTileUID, or ( Expression:PreTileX, Expression:PreTileY ) had been used under "Condition:On cost", remember set "Cache cost" to "Yes" usually.

Shuffle neighborsSample capxIf "Shuffle neighbors" in properties table sets to "Yes", the order of visited neighbors will be random, i.e. the order of visited nodes is not the same for each request.

GroupThe picking result will be put in a group of instance group. It is sorted by checking order.Figure below is the picked tiles of move-able area by configuration to

Moving points = 3

Cost = 1

"Shuffle neighbors" = "No"

FilterThe picking result of moving area are tiles by default. Or use a filter function "Condition:On filter" if this parameter is not equal to "", to reset or add picked instances.Use "Action:Append filter result" to add an instance by uid into picking result group, the tiles which had not been added into group will be excluded in this "Action:Get moveable area".This is an advance optional feature. See the capx at the last section.

Get moving pathThere are 5 parameters in this action.

Chess, and tile/chessThe 1st and 2nd parameters are the moving source chess and moving destination indicated by tile or chess.

Moving points and Moving costThese two parameters are the same as "Action:Get moveable area", please see previous section.The shortest path is the path which could let the chess has the maximum remainder moving point when it moves to destination.

GroupThe picking result will be put in a group of instance group like "Action:Get moveable area". User could pop this group to get moving destinations in-order and move chess to the next destination by rex_grid_move behavior.

User could set the "Force move" to "Yes" in properties table in rex_grid_move behavior, since the move-able (solid) had been determined by this "Get moving path" action.To bind the group of moving path to private group of the moving chess, user could use "Expression: PrivateGroup" in rex_ginstgroup object to get private group name.

Exact or nearestSet "Exact" combo option to "nearest" could get moving path from start tile to nearest target tile.The result of instance group would be empty if "Exact" to "" and no path found from start tile to exact target tile.Get nearest target tile UID by "Expression:NearestTileUID" after request for both Exact or Nearest modes.

Path modeSet property "Path mode" to get a shorter path or shortest path.

Get shortest pathSet property "Path mode" to

"Random": picking the shortest path randomly

"Diagonal": picking the shortest path which has the maximum changing of moving direction

"Straight": picking the shortest path which has the minimum changing of moving direction

"Line": picking the shortest path which has the minimum changing of moving angle

Get shorter pathSet property "Path mode" to

"A*", "A* -line", "A* -random": using A-star algorithm to find path, this will have the best performance. It is recommended that using these mode only when moving point is set to "Expression:INFINITY".

Start and end pointsGet tileUID or LX, LY of start and end point by these expressions

WrapSample capxSet "Wrap" in properties table to "Yes" in rex_board object will wrap the logical boundary. It will also effect the result of picking move-able area and moving path. Chess could move from left boundary to right boundary directly.

This image is the result of picking move-able area in wrapped board.

Accumulated costSample capx"Expression:UID2PathCost" could be used to get accumulated cost from start tile to a specific chess/tile in moveable area or moving path after call "Action:Get moveable area" or "Action:Get moving path". Return (-1) if this specific chess/tile is not in the last scan of request.

AdvanceSample capxThis sample capx shows how to implement the filter function and cost function to get move-able area, moving path, and the enemies in a range.

No overlap with other chessTo exclude the tiles which had chess stand on for move-able area, it need to change the picking result of move-able area. Add the tile with no chess stand on, i.e. the cell of chess is empty, the other tiles which had not been added will be excluded.

Pick enemiesThe "Action:Get moveable area" also could pick enemies in a range condition. It need to change the picking result from tiles to the enemies which stand on these tiles.

No moving across enemiesTo set the enemies to be no across, just set the cost of these tiles which had enemies to be "BLOCKING" in "Action:Set cost" under "Condition:On cost".

Flood fillSample capx"Action:Get moveable area" is using flood fill to find moveable area through "Condition:On cost". This feature also could be use for other propose, like picking neighbor chess/tile which have the same color in sample capx.

The steps of picking are -

Save target color in variable.

Call "Action:Get moveable area", sets the parameter of moving point to 1.

Compare the color of picked instance with target color -- If the color of picked instance is matched to target color, return cost to 0 by "Action:Set cost". Otherwise do nothing, the cost will be BLOCKING by default.

Finally, the matched tiles will be put into instance group by UID, then add the source tile into this group.

Move on tilemap﻿Sample capx﻿Covers all tiles (LZ=0) by string symbol, and sets the rex_board_squareTx to align the tilemap object. Then uses string symbol tile in input parameter of "Get moving path" action.Since the results in instance group are not UID of instance, user could not pick tile instances by SOL actions in instance group plugin, uses

"Condition:For each UID" and "Expression:Item" to retrieve the string symbol (Get moveable area), or

"Expression:Pop( group_name , 0)" to get string symbol in order (Get moving path)