How to set up Team Game

jlayton75

New member
Hello! Sorry for all the questions. I have gotten the demo working great, but how do.I create a team game without your Deathmatch AI manager? There isn't any documentation over this. I created an agent and assigned him the blue layer and my player the red layer. The agent has the team tree. He attacked the player as expected. When I assigned the player the blue layer as well (the same layer as the agent), the agent still attacked the player. I would really appreciate any help I could get on this!
 

Justin

Administrator
Staff member
There are two differences between solo and team:

- The external tree used.
- The enemy layers set on the Character Layer Manager.

If you aren't using the DeathmatchAIManager (which for your own project I don't recommend that you do unless you want the exact same functionality - it wasn't meant too much for extensibility as the focus of the asset is on the behavior tree) then you'll need to make sure you set those two properties.
 

Clifford

New member
my issue is the same as this thread..
"I create a team game without your Deathmatch AI manager? There isn't any documentation over this. I created an agent and assigned him the blue layer and my player the red layer. The agent has the team tree. He attacked the player as expected. When I assigned the player the blue layer as well (the same layer as the agent), the agent still attacked the player. I would really appreciate any help I could get on this!"
 

Justin

Administrator
Staff member
Are you using the team tree? Also, did you adjust the enemy layers to match the opposing agents? The Deathmatch AI Kit does this within DeathmatchManager.SetupPlayer:

Code:
            // Set the layer of the player collider.
            player.layer = friendlyLayer;
            characterLayerManager.CharacterLayer = 1 << friendlyLayer;
            for (int i = 0; i < characterLocomotion.ColliderCount; ++i) {
                characterLocomotion.Colliders[i].gameObject.layer = friendlyLayer;
            }

            // The player should recognize the enemy layers.
            characterLayerManager.EnemyLayers = enemyLayer;
 

Clifford

New member
my issue is the same as this thread..
"I create a team game without your Deathmatch AI manager? There isn't any documentation over this. I created an agent and assigned him the blue layer and my player the red layer. The agent has the team tree. He attacked the player as expected. When I assigned the player the blue layer as well (the same layer as the agent), the agent still attacked the player. I would really appreciate any help I could get on this!"
Are you using the team tree? Also, did you adjust the enemy layers to match the opposing agents? The Deathmatch AI Kit does this within DeathmatchManager.SetupPlayer:

Code:
            // Set the layer of the player collider.
            player.layer = friendlyLayer;
            characterLayerManager.CharacterLayer = 1 << friendlyLayer;
            for (int i = 0; i < characterLocomotion.ColliderCount; ++i) {
                characterLocomotion.Colliders[i].gameObject.layer = friendlyLayer;
            }

            // The player should recognize the enemy layers.
            characterLayerManager.EnemyLayers = enemyLayer;
yes, i have used the team tree to the agents, i make a test to just two AI agent, the one is in blue team, the other is green team,
Are you using the team tree? Also, did you adjust the enemy layers to match the opposing agents? The Deathmatch AI Kit does this within DeathmatchManager.SetupPlayer:

Code:
            // Set the layer of the player collider.
            player.layer = friendlyLayer;
            characterLayerManager.CharacterLayer = 1 << friendlyLayer;
            for (int i = 0; i < characterLocomotion.ColliderCount; ++i) {
                characterLocomotion.Colliders[i].gameObject.layer = friendlyLayer;
            }

            // The player should recognize the enemy layers.
            characterLayerManager.EnemyLayers = enemyLayer;
yes im using the team tree to the two AI.Screenshot 2021-10-13 112237.png
i also have setup their layer like this.Screenshot 2021-10-13 112513.pngScreenshot 2021-10-13 112537.png
but they dont shoot each other.

can you help me.
 

Justin

Administrator
Staff member
I would start debugging this by placing a breakpoint within DeathmatchAgent.TargetInSight. When it performs the cast it should be looking for the enemy layers and if the hitcount is 0 then you know that it's a layer issue.
 

Clifford

New member
i have done the dubugging and as you say the hitcount is 0, what should i do to fix that layer issue?
 

Attachments

  • Screenshot 2021-10-14 105414.png
    Screenshot 2021-10-14 105414.png
    116.9 KB · Views: 3

Justin

Administrator
Staff member
As a test you could manually change the layer mask within the cast to -1 to see if it's specific to the layer. If that returns results then it's directly related to the layer mask.
 
Top