Ignored kills
Options
Hi,
I have a fast paced multiplayer game and sometimes when a client kills another client, their kill is not counted. I use player custom properties to store them but apparently sometimes it's not getting written or something.
Here is the code I use to give score to the killer: (from Sky Arena tutorials)
public static void SetCustomProperty( PhotonView view, string property, ref T offlineVariable, T value )
{
ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
properties.Add( property, value );
view.owner.SetCustomProperties( properties );
}
and I call it like this:
int m_objectiveCount = 0;
const string ObjectiveCountProperty = "ObjectiveCount";
public int ObjectiveCount
{
get
{
return Helper.GetCustomProperty(photonView, ObjectiveCountProperty, m_objectiveCount, 0);
}
set
{
Helper.SetCustomProperty(photonView, ObjectiveCountProperty, ref m_objectiveCount, value);
}
}
I have a fast paced multiplayer game and sometimes when a client kills another client, their kill is not counted. I use player custom properties to store them but apparently sometimes it's not getting written or something.
Here is the code I use to give score to the killer: (from Sky Arena tutorials)
public static void SetCustomProperty( PhotonView view, string property, ref T offlineVariable, T value )
{
ExitGames.Client.Photon.Hashtable properties = new ExitGames.Client.Photon.Hashtable();
properties.Add( property, value );
view.owner.SetCustomProperties( properties );
}
and I call it like this:
int m_objectiveCount = 0;
const string ObjectiveCountProperty = "ObjectiveCount";
public int ObjectiveCount
{
get
{
return Helper.GetCustomProperty(photonView, ObjectiveCountProperty, m_objectiveCount, 0);
}
set
{
Helper.SetCustomProperty(photonView, ObjectiveCountProperty, ref m_objectiveCount, value);
}
}
0
Comments
-
Same problem discussed already.
I found this e.g. http://forum.photonengine.com/discussion/comment/25622
Make sure that you update health for given player always on same client (probably on owner). Or you can run in race condition.0 -
There is no health or any variable to get into race condition. In my game each player gets killed with one shot. Problem is, sometimes killer doesn't get points when he kills someone, as demonstrated with code earlier.0
-
It does not matter, health or scores. It's true for any value. Change it on single client only0