[bolt-101] BoltNetwork.Instantiate windows build direct connect multiple times via bat file problem

Options
3xbs
3xbs
edited September 2015 in Photon Bolt
hi, :)

i have an problem with instantiate of the player "cube" within an exe build :'(
using UnityEngine; using System.Collections; [BoltGlobalBehaviour] public class tutorial1_NetworkCallbacks : Bolt.GlobalEventListener { public override void SceneLoadLocalDone(string map) { // instantiate cube Vector3 pos = new Vector3(Random.Range(-200,200), 20, Random.Range(-200, 200)); if(BoltNetwork.isClient) { BoltNetwork.Instantiate(BoltPrefabs.Cube, pos, Quaternion.identity); } } void Start () { } void Update () { } void OnGUI() { } }
(is from the https://doc.photonengine.com/en/bolt/current/getting-started/bolt-101-getting-started )

when i build a client version that direkt connect without buttons it will connect but
if i start the exe build over an start.bat file like this :

@echo off
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe
START client_tutorial_1.exe

BoltNetwork.Instantiate set the start position for every of the 5 client to the same position
and the rigidbody + boxcollider have fun :blush:
is there an trick to fix this ?

lg

Ben

Comments

  • I dont understand your problem, what is different when you start with a .bat file?
  • 3xbs
    3xbs
    edited September 2015
    Options
    hi Stanchion,

    sorry i want to put two pictures but i havent done it :neutral:

    the instantiate position with the bat is for all 5 clients the same position (x,y,z)

    a little video :
    https://www.dropbox.com/s/3wloe10a7x3x85w/1.mp4?dl=0

    the random range to instantiate is 200 to -200 with a spawn hight of 20,
    so they fall smooth down ( if not with the bat file startet :) )

    PS: i have written a script that display the name of the instantiatet cube
    and have addet it to the prefab of the cube

    using UnityEngine;
    using System.Collections;
    public class ben_go_name : MonoBehaviour {
    void OnGUI() {
    GUILayout.BeginArea(new Rect((float)(Screen.width - 200 - 10), 10f, 200f, (float)(Screen.height - 20)));
    if (gameObject.name.Contains("(Clone)")) {
    } else {
    GUILayout.Label("Cubename is : " + gameObject.name);
    }
    GUILayout.EndArea();
    }
    }

    now i see, that the 5 clients get the same cube.gameobject.name :neutral:

  • I still don't understand what problem you're having
  • 3xbs
    3xbs
    edited September 2015
    Options
    this : https://www.dropbox.com/s/3wloe10a7x3x85w/1.mp4?dl=0

    they spawn at the same frame and if i set a deley like this :

    using UnityEngine; using System.Collections; [BoltGlobalBehaviour] public class tutorial1_NetworkCallbacks : Bolt.GlobalEventListener { public override void SceneLoadLocalDone(string map) { // instantiate cube if(BoltNetwork.isClient) { StartCoroutine(Example()); } } void Start () { } void Update () { } void OnGUI() { } IEnumerator Example() { float timerlein = Random.Range (1.0F, 10.0F); yield return new WaitForSeconds(timerlein); Vector3 pos = new Vector3(Random.Range(-200, 200), 20, Random.Range(-200, 200)); GameObject cubespawned =BoltNetwork.Instantiate(BoltPrefabs.Cube, pos, Quaternion.identity); cubespawned.gameObject.transform.position=pos; cubespawned.gameObject.name="client_" + timerlein + "_" + Random.Range (1, 9999); } }

    it will be ignored ( but only by starting from bat file.
    the single start of the exe file will create correkt ( diffrent names ) like

    client_1.942_" + Random.Range (1, 9999);
    client_2.972_" + Random.Range (1, 9999);
    client_5.000_" + Random.Range (1, 9999);
  • I don't see how this is a problem with Bolt. The random probably ends up with the same number because you're starting them all at the same time.
  • 3xbs
    3xbs
    edited September 2015
    Options
    i dont understand it :neutral:

    'starttime' + 'random waittime' = same endtime ?

    why is random on every of the five clients the same
  • I would post this on the Unity forum or Unity answers, this doesnt really pertain to Bolt
  • 3xbs
    Options
    your right :blush:
    that is a problem of/in the base ( unity3d ) and not the Bolt

    sry for my confusion :smile: