You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the StateMachine for EnterMineAndDigForNugget there is the following:
//if enough gold mined, go and put it in the bank
if (pMiner->PocketsFull())
{
pMiner->ChangeState(VisitBankAndDepositGold::Instance());
}
if (pMiner->Thirsty())
{
pMiner->ChangeState(QuenchThirst::Instance());
}
Now I wonder, wouldn't it be better to return on after the lines where ChangeState is called.
Cause now for example if the miners pockets are full it would go to the bank.
But if the miner is also thirsty, then the if statement for that block is still executed.
This will change the state to QuenchThirst from the bank location.
This could lead to really unexpected behaviour.
The text was updated successfully, but these errors were encountered:
@clankill3r I think the idea here was to establish an order of precedence. If the miner is thirsty, he will most likely prefer to go get a drink instead of depositing his money, since the latter is something he could easily do later, whereas prolonged thirst may kill him (depending on the game mechanics).
https://github.com/wangchen/Programming-Game-AI-by-Example-src/blob/master/Buckland_Chapter2-State%20Machines/WestWorld1/MinerOwnedStates.cpp#L60
In the StateMachine for EnterMineAndDigForNugget there is the following:
Now I wonder, wouldn't it be better to return on after the lines where
ChangeState
is called.Cause now for example if the miners pockets are full it would go to the bank.
But if the miner is also thirsty, then the if statement for that block is still executed.
This will change the state to QuenchThirst from the bank location.
This could lead to really unexpected behaviour.
The text was updated successfully, but these errors were encountered: