Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all 8947 articles
Browse latest View live

Strange Crash report On Windows Store

$
0
0
Hello guys :) i am having this error on windows store. it makes application to crash. does anyone knows what is the problem ?

$10_ExitGames::Client::Photon::SocketUdpNetFxCore.OnConnected 0x47
$23_Windows::Foundation::AsyncActionCompletedHandler__Impl::Vtbl.Invoke__STUB 0x43

Avoiding specific players in matchmaking

$
0
0
My company is developing a social virtual reality application. Providing a safe and friendly environment for our users is paramount, and therefore we need to give our users the ability to report/block people that are harassing them. Once a user has blocked someone else, I would like to be able to have the matchmaking system avoid that person. Is there any way to achieve this with the current Photon feature set, and if not, does this sound like something that could potentially be added to Photon in the future?

How to assign slots to players?

$
0
0
Hi!

I'm building a game where I have some slots for each room. When a player joins a room, the first available slot will be assigned to him/her. And when a player leaves, that slot becomes available for another player.
I couldn't find any way to do this right from Photon, but maybe I'm missing something.
How do you guys think this can be implemented using Photon?

Thank you

Problem with PUN rally example package - Vehicle prediction way off

$
0
0
I purchased the PUN Rally package from the asset store, and have had a thorough look at the code and scenes, and managed to get two vehicles racing next to each other fine with good prediction and synchronisation.

I am connecting to the Photon Cloud server in AU, as this is the closest to me, I get around 25ms ping.


I have now tried to convert the project to use Randomation Vehicle Physics, which is another vehicle physics package. I have left pretty much most of the code intact, and just made the neccessary changes.

All works fine and both my vehicles are networked with the new physics package, but when I have two vehicles racing next to each other at higher speeds, what each client sees is incorrect.

If you look at this image...


The client window on the left sees his car (left car), ahead of the client on the right.
Yet the client on the right sees his car, ahead of the client on the left.

Is there any reason why I would be having this problem with the new vehicle physics package? I have my rigidboy set to interpolate, and I set remote vehicles to kinematic as the document instructs.

Is there something else that could be contributing to this issue?

Thanks

Sending Data to Server/Client

$
0
0
Hi everyone,
Our group is a newly created group and just start learning about PUN. We want to create a Playing Card game like Poker, where 4 player connect to a room to play. Now we want to know the cards each player have, so that we can apply algorithm to each player. Currently we are using Photon Cloud to develop and test, but from what we saw, Photon Cloud is use for connecting player to Photon server and communicating between players, and the data is sent from client to Photon server. Since we are using Photon cloud, we don't know what the content of the data sent from the client to the server is. To know the card of each players, should we hosted a Photon server of our own so that we know what the cards of each player are? Or should we make a Master client for each game to gather data and apply algorithm automatically?
Any help is appreciated.

add photonNetwork in script

$
0
0
Hello all

Please i need help

Add photon network, and if item have spawn dont spawn again item, beacause have much loot after ;(

help me please



-----------------------------------------------------------------------------------------------------------------------



using System.Collections;
using UnityEngine;

public class RandomTimeSpawner : MonoBehaviour {

//Spawn this object
public GameObject spawnObject;

public float maxTime = 5;
public float minTime = 2;

//current time
private float time;

//The time to spawn the object
private float spawnTime;

void Start(){
SetRandomTime();
time = minTime;
}

void FixedUpdate(){

//Counts up
time += Time.deltaTime;

//Check if its the right time to spawn the object
if(time >= spawnTime){
SpawnObject();
SetRandomTime();
}

}


//Spawns the object and resets the time
void SpawnObject(){
time = 0;
Instantiate (spawnObject, transform.position, spawnObject.transform.rotation);
}

//Sets the random time between minTime and maxTime
void SetRandomTime(){
spawnTime = Random.Range(minTime, maxTime);
}

}

Destroying synced projectiles

$
0
0
I didn't know what category to put this in but I have more of a network theory question, rather than any errors or code problems.

If you have a fast moving projectile such as a rocket or missile, and you are syncing this projectile on all of the clients with the position and rotation from the client who fired the projectile. How would you then send out a message to destroy this projectile when it hits the target without everyone seeing it get destroyed before it hits the target.

Unless I'm thinking about things incorrectly, if you do any sort of smoothing at all with the projectile syncing, the projectile wont be at the latest position when the destroy call comes through. It will still be interpolating to the new position it received. With slow moving projectiles I guess this wouldn't be an issue, but with fast moving projectiles, other clients will see the projectile destroyed far away from the actual position it was destroyed at. How would someone handle a situation like this to make sure that the object is actually seen exploding at the right location. This seems like a problem any game with projectiles would have to deal with, and yet I can't find much information on it.

SetActive

$
0
0
Hi everyone! For my game, I need to stream when the gun is active or not. I have a script which active the gun when we pick it but I don't know how to do to make the clients seeing it when it activates. Does someone has any idea how to do?

Thank you!

room oriented server - private hosting

$
0
0
Hi, I've been going over a lot of tutorials regarding implementing rooms on the server side but they all seem to be referring to the photon networking cloud/region, is there any existing library and/or a tutorial regarding creating rooms on a self hosted server ?

Thanks.

How do I instantiate if I don't have a prefab in resources folder?

$
0
0
As thread states, I don't have a prefab in resources folder, instead, I load my gameobject in the game using unity instantiation. I instantiate different prefabs in correct positions and hierarchy into a player (imagine a robot, being made of 4 wheels, a chasis, and 2 plasma rifles).
Since I do have serialization that handles this for me, and the robot is created at runtime and later serialized, I do not have "PREFAB", I just have a gameobject that is made of prefabs, thus I can't put it in resources folder or anything like that.

Can someone help me with what I can do here?

RPC to specific players

$
0
0
Hi all :)
Why there is no overload for the RPC method that supports players as target actors?
We can post data to all, the masterClient or one specific player.
There should be an overload for playerS as well.

Is there a specific reason for that? Or with other words, can I just create my own overload in the meanwhile.. will it work properly?

Greetings.

Instantiating rigidbody error

$
0
0
Hi there,

I have what I feel should be a very simple question. I'm trying to instantiate a rigidbody by calling PhotonNetwork.Instantiate, but when I try to add it to this script it comes up with the error: No overload method for PhotonNetwork.Instantiate takes ‘3’ arguments. How can I edit this script so that it will still work in the same way and instantiate the object across the network?




using UnityEngine;
using System.Collections;

public class Shoot : MonoBehaviour {

public Rigidbody projectile;

public float speed = 20;



// Use this for initialization
void Start () {

}

// Update is called once per frame
void OnMouseDown() {

audio.Play();

{
Rigidbody instantiatedProjectile = PhotonNetwork.Instantiate(projectile,
transform.position,
transform.rotation)
as Rigidbody;

instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0,speed));

}
}
}

Scoping problems with RPC

$
0
0
Hi! I'm somewhat new to PUN and Unity so hopefully I am making some kind of beginner mistake.

void Update(){
if(launch == true){
Debug.Log("launched");
myPhotonView.RPC("ChangeScene", PhotonTargets.All);
}
//myPhotonView.RPC("ChangeScene", PhotonTargets.All);
}

When I run the code above, I can see launched in the console but I get "NullReferenceException: Object reference not set to an instance of an object" on this line: myPhotonView.RPC("ChangeScene", PhotonTargets.All);

When I run it with that line commented out and the line that's outside the if statement uncommented, there is no null reference exception and the method executes. Is there a mistake in the above code, or is this a bug in Photon? Any help at all is much appreciated. I can post the full code or error messages if anyone think it's necessary.

Also, this is less important, but myPhotonView is null in any methods I create that aren't regular monobehaviour methods like Start or Update even though I set it as a global variable and filled it in Start before I try to access it. This seems like it might be tied to the other problems I'm having.



Photonnetwork.LoadLevel

$
0
0
I use Photonnetwork.LoadLevel to load the new scene. However, since the Application.LoadLevel is obsolete, is there any new implementation for Photonnetwork.Loadlevel such as Photonnetwork.LoadScene? By the way, there are different type of Loadlevel in application and SceneManager, such as LoadLevelAsync, or LoadSceneAsync. Does Photon have that kind of support?
Thanks

OnPhotonSerializeView() Vector3s looking like Vector4s

$
0
0
Hello,

I'm having problems passing a Vector3 through photon. Essentially we are sending a Vector3, followed by a Float through OnSerliezeView. On the receive end we are getting a Vector4 and thus having a casting issue because we are expecting a Vector3.

We have since moved the Float to before the Vector3 send as denoted below and it seems like it is working fine now.

if (stream.isWriting)
{
stream.SendNext(colliders.localRotation.eulerAngles.y);
stream.SendNext(carRigidbody.position);
stream.SendNext(carRigidbody.velocity);
stream.SendNext(new Vector3(carRigidbody.rotation.eulerAngles.x, carRigidbody.rotation.eulerAngles.y, carRigidbody.rotation.eulerAngles.z));

}
else
{
PacketInfo packet;
packet.mTime = info.timestamp;
packet.mDriftAngle = (float)stream.ReceiveNext();
packet.mPosition = (Vector3)stream.ReceiveNext();
packet.mVelocity= (Vector3)stream.ReceiveNext();
Vector3 EulerAngles = (Vector3)stream.ReceiveNext();

packet.mRotation = Quaternion.EulerAngles(EulerAngles);

PhotonNetwork.time is not synchronized

$
0
0
I faced strange behavior:

PhotonNetwork.time is synchronized in proper way in Editor/Standalone build, but
when I run it under iOS devices PhotonNetwork.time is different from sever timestamps dramatically (millions)

What can cause this problem?

I am using PhotonServer on standalone machine and free PUN from asset store...

On iOS I got negative values.

Server time double: -1155847.248
Server time ms: -1155847248

Server time that I got via RPC is: 3137684
PhotonNetwork.FetchServerTimestamp() - does not help...

Very strange that it reproducible on iOS actual device only (not in editor/nor standalone build for win/mac)

BTW, in editor I got following:

Server time double: 3139752.208 (using PhotonNetwork.time)
Server time ms: -1155215088 (using PhotonNetwork.networkingPeer.ServerTimeInMilliSeconds)


I think the problem is near....

Somehow on iOS the following line in getter produce NEGATIVE value:

public static double time
{
...
return ((double)(uint)networkingPeer.ServerTimeInMilliSeconds) / 1000.0f;
...
}

Sending multiple VR rotation data to one masterclient

$
0
0
Hi there,

I'm developing a game where one user is able to follow multiple VR users on a screen (basically streaming their view).

Right now i'm instantiating a camera for each client connected to the game, however i cant receive any data from the stream. Also as i'm planning to use it as a master/slave approach only the MasterClient is interested in the data stream.

I.e. Master connects and creates a room, then for each player connecting spawn a "slave" with a camera that receives the rotation data of the VR headset and apply's it to a camera which only the master client is able to see.

Any tips on how one would implement such an application?

Buffered RPC For Specific Client

$
0
0
Hi, I am using Photon Networking and I need some help with sending a buffered RPC to a specific client. I know I can send an RPC to one client by using “PhotonPlayer.Find (id)” as a photon target in the RPC call. But how will I go about buffering this, so that the player receives it when they get online?

PUN not joining lobby on Android

$
0
0
I am using free PUN and Unity 5.3.5f1, my build on PC work perfectly, but when I make build on Android, the event OnJoinedLobby() doesn't work. In PhotonServerSettings I have my appId, protocol UDP, auto-join lobby and enable lobby stats enabled.

poker multiplayer game get freeze on masterclient side

$
0
0
multiplayer poker game get freeze when 5 or 6 round runs.i have got few coroutines.wanna know what is the reason for this? is there any method to stop this? and master player have to wait until minimum two players to join to begin the game..i have used yield return wait until co routine for that. comments will be appreciate.thank you.
Viewing all 8947 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>