thankyou for your answer. but dont you think some article you gave something like goal oriented action planning is much like states machines? but instead of using states it has some state steps of goals that it should pass to get the goal state. state machines i think is still good because you can simply write clean code using them.
Not at all. First, contrary to FSM, there is no predefined graph of actions/states/goals in GOAP and thus you dont need to manage it. Just a set of states, goals entailed by states and actions that influence the state in some way (and fullfill the goals).
Second, and the most important is how you treat the state of an object in GOAP. In FSM states of a bot are like: idle, patroling, pursuiting target, searching for food, etc. And there are some transitions between those states. But actually all these states are not a states of a bot in reality. In reality, state of a bot is his health, his awareness of surroundings, his equipment, etc. And there are no transition between the states. This is how you treat state in GOAP. Bots state entails goals. If bot has low health, he needs to restore it, if bot is hungry, it needs to eat some food. Bot assess his state and generate goals he needs to achieve. Then he evaluates the best way (most suitable action in present moment) to fullfill his goals, to satisfy his desires, to minimize his discontent. There are numerous ways to do such evaluation. GOAP is not about A* actually, although A* is the most advanced planning technique.