AI Agent (DAE's 2D AI Engine)

This projects shows a AI Agent written inside DAE's 2D AI Framework. During the Gameplay programming lessons we had the challenge to learn various behaviours for an autonome agent. Our exam challenge was to create an autonome actor that is able to collect loot to heal when he got attacked by zombies, eat food when he was starving and kill zombies with the guns found.

Down here you can see the behaviour tree I used to create this AI.

m_pBehaviourTree = new BehaviorTree(pBlackboard,
		//Use Items
		new BehaviorSelector({
			new BehaviorSelector({
				new BehaviorSequence({
					new BehaviorConditional(hasGun),
					new BehaviorConditional(seesEnemy),
					new BehaviorAction(FireGun)
				}),
				new BehaviorSequence({
					new BehaviorConditional(seesEnemy),
					new BehaviorAction(ChangeToCombined)
				}),
			}),
			new BehaviorSelector({
				
				new BehaviorSequence({
					new BehaviorConditional(hasMeds),
					new BehaviorConditional(hasLowHealth),
					new BehaviorAction(UseMeds)
				}),
				new BehaviorSequence({
					new BehaviorConditional(hasFood),
					new BehaviorConditional(hasLowEnergy),
					new BehaviorAction(EatFood)
				}),
			}),
			//Items
			new BehaviorSequence({
				new BehaviorConditional(hasInventorySpace),
				new BehaviorConditional(foundItems),
					new BehaviorSelector({
						new BehaviorSequence({
							new BehaviorConditional(itemAsTarget),
							new BehaviorConditional(inRadiusOfItem),
							new BehaviorAction(GrabItem)
						}),
						new BehaviorSequence({
							new BehaviorConditional(itemAsTarget),
							new BehaviorAction(ChangeToSeek)				
						}),
						new BehaviorAction(SetItemTarget)
					}),
			}),
			//Houses
			new BehaviorSelector({
				new BehaviorSequence({
					new BehaviorConditional(foundHouses),
					new BehaviorConditional(houseAsTarget),
						new BehaviorAction(ChangeToSeek)
				}),
				new BehaviorSequence({
					new BehaviorConditional(foundHouses),
					new BehaviorSelector({
						new BehaviorSequence({
							new BehaviorConditional(isInsideHouse),
							new BehaviorAction(MoveOutside)
						}),
						new BehaviorSequence({
							new BehaviorConditional(isNotSeen),
							new BehaviorAction(SetHouseAsTarget)
						})
					})
				})
			}),
			new BehaviorAction(ChangeToEightMovement)
		})		
	);