简体   繁体   English

光子Unity网络

[英]Photon Unity Networking

I have a game that contains more than 5000 cubes. 我有一个包含5000多个立方体的游戏。 Once a user creates a room, cubes are created (new arrangement every time the game is played). 用户创建房间后,将创建多维数据集(每次玩游戏时都要重新布置)。 I would like to be able to transfer a position list (vector3 list) of the created cubes to the server so whoever joins the same room will run a function that will instantiate cubes and arrange them based on the list on the server. 我希望能够将创建的多维数据集的位置列表(vector3列表)传输到服务器,因此,加入同一房间的任何人都将运行一个函数,该函数将实例化多维数据集并根据服务器上的列表进行排列。

If the cubes are going to be static you can do below way to avoid sync of those many positions initially. 如果多维数据集将是静态的,则可以按照以下方式进行操作,以避免最初同步多个位置。

When creating a room, create a random value for seed and save it in room properties.the random value can be tick count for instace. 创建房间时,请为种子创建一个随机值并将其保存在房间属性中。该随机值可以是实例的滴答计数。 With this seed you can create the positions of the cubes completely local. 使用此种子,您可以在完全本地的位置创建多维数据集的位置。

On giving more details i will update my answer. 在提供更多细节时,我将更新我的答案。

For the current case, as you need same setup for newly joined players, instantiate with buffered flag in master. 对于当前情况,由于您需要为新加入的播放器设置相同的设置,因此请使用master中的缓冲标志实例化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM