Next step

Ok so I have the first BT. To remind you: Check the agent’s arrived at base status. if false the node SUCCEEDS. Yes, simply because if it would return failure or running, the sequence would fail. Then check to see if the base is on a tile which is walkable. Next node in the sequence is finding the closest path to the base AND makes the tank go there.

I do not know if I should split that up, it is actually two verbs: FIND and GO. How ever I think not – when would I want the agent to know the way to where his purpose to go is and then NOT go there? I guess if I need the agent to choose from moving to some location or help somebody first, the agent could need a path to determine if it should go or help  depending on what the overall objective is or perhaps the time it has to go to its goal. When the time comes for such choices I will break these two verbs up in terms of BT-nodes.

Finally when the tank has arrived at the location, the BT sets tank’s arrived member to true. This will make the BT fail at its first condition node – check arrived – stopping the tree from going, well, almost. It still does traverse from root to sequence to condition 1 each game loop. Making a note for future reference.

Now I will add another tank to use the BT, only this tank is going to another base located on the opposite side of the map. I have made an enum:

enum TEAM





Depending on this enum I will make the tanks go to separate goals using the same BT. I make two bases one red and one green. I make two tanks, one of them assigns the TEAM green and the other assigns it red. Then I check the teams and give them the appropriate goal vectors.

Since I am only going to add another object and assign the team and give the tanks another vector2d member “enemyBase”, I do not expect a visit to #include dependency loop from hell again. A function StateEnterInitialize() in tank could find the bases and assign the teams and positions. The function could then be called from State::enter() ( this function was copy pasted via paste bin in the previous post.).

Yes That’s enough thinking for today. I will go with this plan for now.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s