advice on stuff i might need

i'm currently making a behaviour tree to use for AI that co-insides with my Astar pathfing project and i was wonder if i am going about designing my framework for it

i've started working on a behaviour.cpp and header that will link up with my world class and AI agent class, just wanted some feed back on my current thought process and if there is any function/states or anything that would help with my design before i start hard coding, this is not my final design just a very rough outline just wanted some advice etc.

its a bit of code so feel free to just ignore this post just thought i check with multiple sources to find the most "optimal design"

Behaviour.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _BEHAVIOUR_H_
#define _BEHAVIOUR_H_

#include "TheWorld.h"

//apparently AI have seem intelligant for me to pass so gotta give them some attitude!

class Behaviour : public TheWorld
{
public:

	Behaviour();
	~Behaviour();

	void Update();
	void Draw(); // not needed for this assignment but perhaps could find a use for it in later projects..
	void Init();
	void Distance_To_Blue();// no refence to halo at all... 
	void Distance_To_Red();
	void Collision_Friendly();// if friendly find another route?>
	void Collision_Enemy(); //if enemy both red and blue respawn and if red has ball drop on the spot 
	void Movement(); // just speed etc.. might have power ups if some one scores a point or something 
	void Obstacle(); // players might be obstacles or i might add something to the map 
	void Penalties(); //Add a refer who gives out random penalties if he touches either team, making a team memember respawn at differant speeds 1,3,5 seconds etc.
	void Run(); // provides the check to see if function success,failed or running
	
	bool bRunning;
	bool bSuccess;
	bool bFailed;

	enum eSTATE_TYPES
	{
		eRESPAWN_STATE,
		eMOVE_STATE,
		eATTEMPT_SCORE_STATE,
		eATTACK_STATE,
		eGAME_ON_STATE,
		eRUNNING_STATE,
		eSUCCESS_STATE,
		eFAILED_STATE,

		eTOTAL_STATES, // Must Be Last Element in Enum?
	};

	void ChangeState( eSTATE_TYPES eType );

private:

	eSTATE_TYPES m_eCurrentState;
	eSTATE_TYPES m_ePreviousState;
};

#endif 


Behaviour.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "Behaviour.h"
//not much here at the moment will decide what method i will implement once i do some googles >.<
Behaviour::Behaviour()
{

}
Behaviour::~Behaviour()
{

}
void Behaviour::Update()
{
	//performs checks on all behaviours will update each player accordingly 
}
void Behaviour::Draw()
{
	//not needed i think but can stay here as a prototype function for use in other projects perhaps?
}
void Behaviour::Init()
{
	//load up behaviours possible add some random in here to mix up their choices or use a fsm /facepalm this is a fsm moron
}
void Behaviour::Distance_To_Blue()
{
	//calulates the distance from a red player to a blue player
	//ie can he see the other player....range should be short gotta pretend that they cant see the ENTIRE WOLRD
}
void Behaviour::Distance_To_Red()
{
	//calulates the distance from a blue player to a Red player
}
void Behaviour::Collision_Friendly()
{
	// Collision between team mates
	//kinda like the two guys in the world cup who split each others heads on going for a header on the same team.....
}
void Behaviour::Collision_Enemy()
{
	//KILL EM ALL
}
void Behaviour::Movement()
{
	//provides movement to players 
	//person with the ball moves..faster or slower? 
	//stamina for all players..ball has a weight ..meaning carrier gets tired? 
	//dont get to advanced for now, but no harm in thinking about it! 
}
void Behaviour::Obstacle()
{
	//cost of paths should probally go here...? 
}
void Behaviour::Penalties()
{
	//if ball carrier is hit drops ball,unable to move and is spawned somewhere else randomly 
}
void Behaviour::Run() // check to see if the behaviour did something
{
	if(bRunning)//add more functionality to this, to easy otherwise and in brogramming if its easy,its WRONG
	{
		m_eCurrentState =  eRUNNING_STATE;//is this right?
	}
	else if(bSuccess)
	{
		m_eCurrentState =  eSUCCESS_STATE;//is this right?
	}
	else if(bFailed)
	{
		m_eCurrentState = eFAILED_STATE;//is this right?
	}
}


//random thought process
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
I_AM_ALIVE bool 
I_Am_Red bool  
I_Am_Blue bool  
No_Possesion bool 

{
	am i red or blue? 
	if red i am attacking 
	if blue i am defending
	//what other checks would i need for this basic behaviour.
	//need to work on my behaviour class look up how to use lists 
	//if i am red i am Attacking
	//if i am blue i am defending so....
	//get this checked to see if i'm on the right (path)...
	CurrentState = GAME_ON;
	
	if(I_Am_Red == true && No_Possesion == true)
	{
	   CurrentState = Move;
	   move to ball via A*
	   m_FoundGoal == false; 
	   m_AvoidEnemy == true; //need to exspand on this 
	   Can i see enemy? 
	   Range/eyesight 
	}
	else(I_Am_Red == true && No_Possesion == false)
	{
		//means i am the bomb
		//Head to goal
		CurrentState = Attempt_Score; 
		m_FoundGoal == true; 
		if(m_FoundGoal == true)
		{
			m_AvoidEnemy == true;
			m_GoalCell = Destination(); 
		}
	}
	if(I_Am_Blue == true && No_Possesion == true)
	{
	   CurrentState = Move;
	   move to ball via A*
	   Intercept all Red player if on route to ball? 
	}
	else(I_Am_Blue == true && No_Possesion == false)
	{
		CurrentState = Attack; 
		//means i am the bomb defuser 
		//Head to goal
		
		m_AttackTarget = RedPlayer with ball 
		if(m_SuccesfulHit)
		{
			EnemyTeamPoints -- 1;
			RESPAWN STATE = true ;//means the red player will respawn randomly on his half of the field 			
		}
	}
}
Topic archived. No new replies allowed.