Does Deathmatch work with PUN?

Well this is confusing....

Is this simply that it is not integrated out of the box?

I'm hoping it's not too much of a stretch to simple apply the PUN Character components to an AI Agent then all remote machines will receive the usual character syncs and projectiles/weapon firing syncs and this should more or less work for PvP Coop vs Agent enemies?
 
I know this is an old thread, just wondering if anyone has made any progress on integrating Pun with the AI kit? I just purchased all the stuff needed to make the Death AI Kit work, and already digging in to see what it's going to take to make it work with my setup and Pun.
 
I know this is an old thread, just wondering if anyone has made any progress on integrating Pun with the AI kit? I just purchased all the stuff needed to make the Death AI Kit work, and already digging in to see what it's going to take to make it work with my setup and Pun.
Well I'm working on using them together.

Basically ATM just running with a script that disables ai components of not the master client, and enabling them on host migration if you are the master.

Haven't tested a lot yet, but I can confirm a basic setup of a Deathmatch AI using the Solo tree was able to attack both players over network, where the remote client is simply seeing a networked synced version of the AI enemy that the Master is the authority for.


My purpose is coop so should be ok, but I doubt it would be great for a high accuracy shooter.

It definitely needs you to extend the features but the heavy lifting is done by Deathmatch kit and pun/UCC
 
I have definitely kept this thread in mind and will report back when I have some solid gameplay in place to show the result
 
How were you able to get the remote client (not master) able to see the AI? I have a test going where I have two players that are connected using pun and an AI that is only seen on the master but can and is able to see and attack both players. If the master drops out, and the master client is transferred to the other client, then the AI will then become visible on the new master client. It seems like I am close but missing something.
 
Last edited:
Important how your ai is spawned...

Is it spawned in with PhotonNetwork.Instantiate?

And is it a scene object?

They're may be some additional stuff like getting the starting transforms and perhaps some other initial info upon spawn/scene loads, I can't remember just now.

I can't remember how exactly the setup should work, I haven't worked on it for couple months since last successful test.

The way I think of it is that the Master is controlling both his character AND the AI character.

The fact that the AI is controlled by behaviour designer is of zero consequence to the remote client....all the remote client needs is the Ultimate character synchronisation which is done for us by PUN add-on. Because the AI is just another remote character in the eyes of UCC and Pun.

Also if you're in Opsive discord PUN/Deathmatch channel I'm happy for you to DM me and I can check back what I've done.

I'm called 'vlaxep' in there too.
 
@vectorfrog seems like of you fix the ai not being spawned on the remote client then the rest should likely fall in to place.

You may have it as a Scene object and it's therefore not being 'NetworkSpawned' and then synched.

I'm not sure why it's spawning upon host migration, but definitely fix the spawning and you'll be pretty close I reckon.
 
Yes, I am using PhotonNetwork.Instantiate...right now my objects are prefabs that I have set up with Photon View components. There are a couple other requirements, like having the prefabs in the Resources folders, etc. I'm wondering if it's PhotonView related.
 
Here's where I'm at with this: I have two players join in a room over the network, and then load the scene. I then have the AI spawn in, and what's happening now is the AI for player A spawn just fine and go on to do their thing. These can see player A AND player B and attack both, however, player B cannot see them or is affected by their weapons. Player B spawns in just fine, along with their AI and these can again see both player A and player B and attack both, however, player A is unable to see these in the scene.

I'm thinking it has to do with not sending the proper commands/events through the network for each of the clients to spawn the opposing AI. I've been looking at SpawnManagerBase and it is sending an instantiation event so the clients know when to spawn other players, but for the AI, I'm not sure this would be the same since they aren't actually being "controlled" per se.
 
Ah ok that sounds like A and B are spawning their own separate AI characters not synched for whatever reason.

Guaranteed if you have ANY character spawned correctly and the PhotonView, ViewID and Ownership are set up correctly then the Master will control it as with a Player controlled character, and send the Network sync (animator, shooting, position/transform etc.)

If you have an AI in game A (Master) and an AI in B (Remote Client) that are independently moving around and shooting etc. then they are definitely not synched.

I think I've experienced 3 scenarios at different stages of success:

1. Not synched at all - A and B have independent AI character that is being controlled locally and shooting at both Players owned by A and B, but this means only PLayer A+B are synched with a local-only AI running around shooting the players

2. Double synched - I screwed it up one time such that the both Master and Remote were trying to control with AI behaviour, but the Master owned the PhotonView, and the movement was noticeably whacky and jittery, as both machines were affecting the transform.

3. Synched correctly - The AI character should be owned solely by the Master, controlled by Behaviour DEsigner with whatever other behaviour (ie. Deathmatch AI and CHaracter Layers). Imagine this character is either a MasterPlayer controlled or MasterAI controlled UCC Character..... As long as it has all the correct PUN components and UCC components, and the PhotonView and ownership is all correct, it will work because being AI or Player controlled makes no difference to the PUN synch.

I know this may not help much but it still sounds like the issue is in the initial spawning of the AI character and possibly related to the ViewID.

Any errors relating to PhotonVIew or ViewID?
 
Are your A and B player characters synched in both remote and master client? ie. Movement/Shooting/Animation
 
No errors regarding the viewID's. I've looked at the PhotonView component while the game is running, and I can see assigned viewID's, but for each AI, isMine is true. I'm assuming it's the same for the remote client.

My players are correctly synched. They are able to see and interact with each other.

edit: I should add that the players are able to shoot at and do damage to the AI they can and cannot see. Obviously it is pretty hard to hit something that is invisible, but when I am able to accomplish it, I can hit player B's AI even though I can't see them.
 
Last edited:
So now, even though player A cannot see player B's AI, they are in the scene hierarchy for player A. They have assigned viewID's and correctly state isMine = false;

I'm really not doing much more than having the AI prefabs set up with the PhotonView component, and then using basically the PhotonNetwork.Instantiate method to instantiate both the AI and the local player. I'm not sure if this is the correct approach as it is a bit different than the way the instantiation occurs in the SpawnManagerBase. In there, the PlayerInstantiation event is being raised and then instantiation occurs after that.

Player A is still unable to 'see' the AI spawned by player B but can fully interact with it, as with the AI, it can also fully interact with player A. I can tell this by looking at the objects in the hierarchy view during runtime. Player B AI will have the name of the actual prefab, where the local AI objects (player A) have been given their screen names.
 
Last edited:
I think I've got it. I added the Pun Transform monitor component to the AI objects and now I am able to see both AI's for both player A and B and vice versa. The team colors and things like that don't match. Animations are still off, or not being synched properly. But, it's closer.
 
No errors regarding the viewID's. I've looked at the PhotonView component while the game is running, and I can see assigned viewID's, but for each AI, isMine is true. I'm assuming it's the same for the remote client.

My players are correctly synched. They are able to see and interact with each other.

edit: I should add that the players are able to shoot at and do damage to the AI they can and cannot see. Obviously it is pretty hard to hit something that is invisible, but when I am able to accomplish it, I can hit player B's AI even though I can't see them.
This will only be because for example in Game A (Master), Player B's shooting is being synched and therefore damaging Game A's AI, not necessarily because Game A's AI exists in Game B (It sounds like it does not exist in Game B, otherwise it would be seen)
 
I think I've got it. I added the Pun Transform monitor component to the AI objects and now I am able to see both AI's for both player A and B and vice versa. The team colors and things like that don't match. Animations are still off, or not being synched properly. But, it's closer.
Hmmm, seems like perhaps these AI aren't fully set up PUN characters yet if you are only now adding PUN componenets?

My method has been to fully prepare an AI character for both UCC and PUN functionality with no bias as to whether it is Player controlled or AI controlled.

So using the Opsive character manager to first create and ticking the box that it is an AI character, then using the PUN-Addon manager to add PUN components.

I would definitely make sure that all the same things are occurring for the AI characters that occur within SpawnManagerBase....

The only thing to be aware of is that I'm pretty sure that SpawnManagerBase does not use PhotonNetwork.Instantiate, but rahter GameObject.Instantiate and then performs all of the ViewId and Photon ID stuff manually to have greater control over it.

I still haven't had a chance to check over my set up, but will let you know if I find anything else once I do.

---
If there are hierarchy AI objects that are either disabled or enabled from the other Game but can't be seen, then you need to figure out why they are not visible.

Are they disabled? Have incorrect skin settings? InvisibleShadowCaster/PerspectiveMonitor settings making the skin invisible? Are they at some far away transform?

----
What is your scene set up? Are you using one of the Demo scenes to create this? I would advise against this because particularly with Deathmatch AI kit there are other things which may affect spawning and such.

I would advise creating your own Launcher and Room creation script leading in to a simple scene that only has the basics - PunGame and what ever other components handle the Pun Spawning.
 
Treat your AI character as if it's a player controlled character, and set it up as you would but ticking the AI box.

But like I said then YOU need to add something on to that AI object that disables the AI behaviours on any remote client, as only the Master should have AI and behaviours active.
 
Top