About implementing an algorithm

Greetings, I am new here so my apologies if I posted this in the wrong section..

I am currently studying this algorithm which is A* pathfinding algorithm..

My question if I am going to apply this in rpgmaker.. where should I start?

Here is a good simulator of A* algorithm(what I am trying to implement is the one with bi-directional)

http://qiao.github.io/PathFinding.js/visual/

Thanks in Advance!
Hello there! 

There are lots of ways, but for example: You could write the algorithm in a module and then include the module in Game_CharacterBase, or just write the methods that you need in that class. Once the algorithm has found the path and you have all the nodes with its parents, you'll have to "reconstruct the path" by getting the direction of each node, first relatively to the character you want to move and then to the node where the character has moved, so you can create a MoveRoute (see help file).

That is pretty much where you should start, if you have some concise questions, let me know.

Cheers.
Hello there! 

There are lots of ways, but for example: You could write the algorithm in a module and then include the module in Game_CharacterBase, or just write the methods that you need in that class. Once the algorithm has found the path and you have all the nodes with its parents, you'll have to "reconstruct the path" by getting the direction of each node, first relatively to the character you want to move and then to the node where the character has moved, so you can create a MoveRoute (see help file).

That is pretty much where you should start, if you have some concise questions, let me know.

Cheers.
I see tnx 😮 btw another question sir.. is there a way to make the actor(our main character) automatically move to an enemy? or an npc move to another npc?
Game_Character has this built in method:

#-------------------------------------------------------------------------- # * Move Toward Character #-------------------------------------------------------------------------- def move_toward_character(character) sx = distance_x_from(character.x) sy = distance_y_from(character.y) if sx.abs > sy.abs move_straight(sx > 0 ? 4 : 6) move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0 elsif sy != 0 move_straight(sy > 0 ? 8 : 2) move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0 end endBut as you can see, it literally "moves it toward" the target, no pathfinding is performed. Once you have implemented your pathfinding, you will be able to move characters to any node on the map, and consequently to any character on the map (if you use the x & y of said character as the target node).
Game_Character has this built in method:

#-------------------------------------------------------------------------- # * Move Toward Character #-------------------------------------------------------------------------- def move_toward_character(character) sx = distance_x_from(character.x) sy = distance_y_from(character.y) if sx.abs > sy.abs move_straight(sx > 0 ? 4 : 6) move_straight(sy > 0 ? 8 : 2) if !@move_succeed && sy != 0 elsif sy != 0 move_straight(sy > 0 ? 8 : 2) move_straight(sx > 0 ? 4 : 6) if !@move_succeed && sx != 0 end endBut as you can see, it literally "moves it toward" the target, no pathfinding is performed. Once you have implemented your pathfinding, you will be able to move characters to any node on the map, and consequently to any character on the map (if you use the x & y of said character as the target node).
tnx for that.. atm I tried put a follower. My problem is that, it can follow me north,east and west.. but if I go south it blocks my way D:
You mean en event follower? Because default followers from Ace got the "through" variable set to true and thus they don't block your way. If it is an event, make it "through" by checking that option in the event's Option section.
You mean en event follower? Because default followers from Ace got the "through" variable set to true and thus they don't block your way. If it is an event, make it "through" by checking that option in the event's Option section.
ohh I see.. it worked.. but I think now I want them to follow my back.. guess I little more research

also is it possible to do this

1. Walk to a certain location

2. A random npc will approach another npc

3. A battle window will commence.

Thank you.
yes, via events that is possible... you'd probably use a touch triggered event to do that...
I tried this

1. Approach npcA (with player touch) so that he will go to a certain location

2. NpcA(with the exact location of the another npc) doesn't move at all.

Also I did put a battle processing event on npcB.

NpcB also have event trigger.

where did I do wrong?
You will only use 1 event to control those two "NPC"...


You will probably use the first touch event to do it


[Event]


Set move route of NPC 1 (do not wait)


Set move route of NPC 2 (wait)


Battle Processing
You will only use 1 event to control those two "NPC"...

You will probably use the first touch event to do it

[Event]

Set move route of NPC 1 (do not wait)

Set move route of NPC 2 (wait)

Battle Processing
cool it worked!

btw I just noticed that in this script.. I should use game_player if I want the enemies or npc go to me...

or put the coordinates manually for the npc to meet..

my question.. if I want it to be npc to npc I should add some code to the script?

(I am referring to pathfinding A* by jet)
well, I never used that script... but whenever you wanna address an event script-wise it would be


$game_map.events[id]


where ID is the ID of the event
well, I never used that script... but whenever you wanna address an event script-wise it would be

$game_map.events[id]

where ID is the ID of the event
ohhh gonna try that OO.. tnx alot

edit:

tnx for the help Shana I fixed it 😀

Original thread: https://forums.rpgmakerweb.com/threads/about-implementing-an-algorithm.23289/