# How does one organize AI interactions with Local and Remote Players?

Scenario: In a first-person multiplayer game, an AI monster grabs a player. (This would be first-person player on the client's local machine, and a third-person remote player on the master and other client machines)

I'm trying to weigh the merits of different implementations of how these interactions could be organised.

In this scenario, I can think of a couple different ways of implementing but I'm not sure what assumptions they might make which could result in a problem down the line:

1. The Monster could, in its grab function, have a test IsFirstPerson and then perform the FirstPerson specific or ThirdPerson specific grab mechanics, or

2. The Monster could talk to an IGrabbable interface on the Player (remote or local), which would return whether it is FirstPerson or ThirdPerson and then perform the specific grab mechanics, or

3. The Monster could talk to an IGrabbable interface on the Player (remote or local), which would return/dictate the full details of how the Monster should grab.

(And for clarity - differences in implementation of FirstPerson or ThirdPerson would be where the hands are or headlook - in first person it would look directly into the camera, but in third person it'd look at where the eyes are; differing struggle animations, etc)

• Have you tried any of the implementations you've suggested ? Did you meet any obstacle? – TomTsagk Aug 27 at 15:24
• I'm currently implementing option 3 and haven't hit any issues yet, I suppose I will make any changes here if I do end up encountering problems. I was just looking for advice, obvious criticisms, or alternative methodologies used to organize and handle AI encounters with players in this kind of interaction. – Visulth Aug 27 at 17:22

The only thing that might be different between clients is what animation it plays, if you want it to use a different animation for first-person than for third-person. The best way to approach this will partially depend on the multiplayer framework you're using. E.g. if you're using Photon, you can (IIRC) check an IsLocalPlayer property on the Player object. Your example #2 is best, since the player object should not know or care about the implementation details of the monster grabbing it.