void SendVelocitySyncMsg(List <GameObject> robots)
    {
        if (isServer)
        {
            byte[] byteVelocities;
            SerializablePositionList robotVelocities = new SerializablePositionList();
            for (int i = 0; i < robots.Count; i++)
            {
                robotVelocities.Add(new Position(robots[i].GetComponent <RobotBehaviour>().prevVelocity));
                Debug.Log("velocity " + i + " ");
            }



            BinaryFormatter        bf2 = new BinaryFormatter();
            System.IO.MemoryStream ms2 = new System.IO.MemoryStream();
            bf2.Serialize(ms2, robotVelocities);
            byteVelocities = ms2.ToArray();
            Debug.Log(byteVelocities.Length);

            SyncVelocityMsg velocityMsg = new SyncVelocityMsg();
            velocityMsg.robotVelocities = byteVelocities;

            if (remoteConnection != null)
            {
                remoteConnection.Send(SyncVelocityMsg.msgType, velocityMsg);
            }
            else
            {
                Debug.Log("no remote connection to send to");
            }
        }
    }
    //AS SERVER ONLY
    //takes a list of robots and sends their positions to the other client
    public void SendSyncStateMsg(List <GameObject> robots, GameObject ball)
    {
        if (isServer)
        {
            SerializablePositionList robotPositions = new SerializablePositionList();
            for (int i = 0; i < robots.Count; i++)
            {
                robotPositions.Add(new Position(robots[i].transform.position));
            }
            Debug.Log(robotPositions[0].x + " y: " + robotPositions[0].y);
            byte[] bytePositions;

            BinaryFormatter        bf = new BinaryFormatter();
            System.IO.MemoryStream ms = new System.IO.MemoryStream();

            bf.Serialize(ms, robotPositions);
            bytePositions = ms.ToArray();

            //where 0 is position and 1 velocity
            SerializablePositionList ballInfo = new SerializablePositionList();
            ballInfo.Add(new Position(ball.transform.position));
            ballInfo.Add(new Position(ball.GetComponent <Ball>().PreviousVelocity));

            byte[] ballInfoBytes;

            bf.Serialize(ms, ballInfo);
            ballInfoBytes = ms.ToArray();



            SyncStateMsg syncMsg = new SyncStateMsg();
            syncMsg.robotPositions = bytePositions;
            syncMsg.ballInfo       = ballInfoBytes;

            if (remoteConnection != null)
            {
                remoteConnection.Send(SyncStateMsg.msgType, syncMsg);
                SendVelocitySyncMsg(robots);
            }
            else
            {
                Debug.Log("no remote connection to send to");
            }
        }
    }