同步器插件
Syncker is a multi-node rendering system that makes it easy to create an immersive system or a large-scale visualization wall on a computer cluster synchronized over the network in real-time.Syncker 是一个多节点渲染系统,可以轻松地在通过网络实时同步的计算机集群上创建沉浸式系统或大型可视化墙。
THIS IS NOT A MULTIPLAYER SOLUTION!这不是多人游戏解决方案!
To create a multiplayer application, currently a third-party solution should be used.要创建多人应用程序,目前应使用第三方解决方案。
Simply connect multiple computers into one high-resolution seamless display using LAN. And it does not matter if these computers are running on Windows and Linux at the same time, as Syncker works even across different platforms. Moreover, created virtual environments can have any monitor configuration, since all viewports are fully configurable and multi-monitor grids on Slave computers are supported.只需使用 LAN 将多台计算机连接到一台高分辨率无缝显示器即可。这些计算机是否同时在 Windows 和 Linux 上运行并不重要,因为 Syncker 甚至可以跨不同平台运行。此外,创建的虚拟环境可以具有任何监视器配置,因为所有视口都是完全可配置的,并且支持 Slave 计算机上的多监视器网格。
Moreover, Syncker offers you a flexible customization of the whole synchronization process, based on custom user messages. Instead of sending the whole bunch of transformation data for objects that can only be rotated or sending huge amounts of transformation data for all parts of complex objects, when their positions can be determined using just a handful of simple parameters, you can send a single quaternion or a set of parameters.此外,Syncker 根据 自定义用户消息,为您提供整个同步过程的灵活自定义。当仅使用少量简单参数即可确定它们的位置时,您可以发送单个四元数,而不是为只能旋转的对象发送大量变换数据或为复杂对象的所有部分发送大量变换数据或一组参数。
See Also也可以看看#
- The Running Syncker for a custom project article for more details on Syncker initialization and synchronization code.这为自定义项目运行 Syncker有关 Syncker 初始化和同步代码的更多详细信息,请参阅文章。
- The Syncker-specific options article for more details on Syncker command-line options and console commands.这Syncker 特定选项有关 Syncker 命令行选项和控制台命令的更多详细信息,请参阅文章。
- The article on SpiderVision Plugin for more details on the setup of multi-monitor Slave configurations.关于SpiderVision Plugin的文章详细介绍了多监视器Slave配置的设置。
Syncker API:
- The Manager interface article for more details on managing Syncker via code (C++, C#, UnigineScript).有关通过代码(C++、C#、UnigineScript)管理 Syncker 的更多详细信息,请参阅 Manager 接口文章。
- The Master interface article for more details on managing Syncker Master via code (C++, C#, UnigineScript).有关通过代码(C++、C#、UnigineScript)管理 Syncker Master 的更多详细信息,请参阅 Master 接口文章。
- The Slave interface article for more details on managing Syncker Slave via code (C++, C#, UnigineScript).有关通过代码(C++、C#、UnigineScript)管理 Syncker Slave 的更多详细信息,请参阅 Slave 接口文章。
Structure and Principles结构和原理#
Syncker allows you to render a world across different computers synchronized over LAN. These computers can be of two types:Syncker 允许您在 LAN 上同步的不同计算机上渲染世界。这些计算机可以有两种类型:
Master |
Master application is an application running on the main computer. In addition to rendering, it also performs animations and calculations of physics, and controls Slave applications.Master 应用程序是在主计算机上运行的应用程序。除了渲染,它还执行动画和物理计算,并控制 Slave 应用程序。 The main computer should have the most advanced hardware configuration, as it performs most calculations.主计算机应该具有最先进的硬件配置,因为它执行大多数计算。
All other applications are synchronized with Master.所有其他应用程序都与 Master 同步。 |
---|---|
Slave |
Slave applications are all other applications running on computers connected over the network. There can be an unlimited number of Slave applications connected to one Master (as long as the network bandwidth allows). The purpose of such applications is to render all nodes that are seen in their viewports.Slave 应用程序是在通过网络连接的计算机上运行的所有其他应用程序。可以有无限数量的 Slave 应用程序连接到一个 Master(只要网络带宽允许)。此类应用程序的目的是渲染在其视口中看到的所有节点。
Configuration of Slave is set up to fit the configuration of monitors.Slave 的配置设置为适合监视器配置. |
Launching Order启动订单#
The order of launching Master and Slave applications does not matter: you can launch several Slave apps, then Master, and then the remaining Slave apps — synchronization will start automatically. Master starts the session as soon as all Slave apps are connected.启动 Master 和 Slave 应用程序的顺序无关紧要:您可以启动多个 Slave 应用程序,然后是 Master 应用程序,然后是其余的 Slave 应用程序——同步将自动开始。一旦连接了所有 Slave 应用程序,Master 就会启动会话。
In case only Master is present (-sync_count 1) and connection of additional Slave applications on the fly is enabled (-sync_allow_extra_slaves 1), the session starts immediately and lasts forever (until Master is on).如果仅存在 Master (-sync_count 1) 并且启用了其他 Slave 应用程序的动态连接 (-sync_allow_extra_slaves 1),则会话会立即开始并永远持续(直到 Master 开启)。
Synchronization同步#
Syncker works in Asynchronous mode providing synchronization between the channels by means of reconstruction using the data of previous frames. In asynchronous mode all computers draw their own frames, each with its own frame rate. So, in this mode we synchronize time.Syncker 工作在 异步模式下,通过使用前一帧的数据重建,提供通道之间的同步。在异步模式下,所有计算机都绘制自己的帧,每个帧都有自己的帧速率。所以,在这种模式下,我们同步时间。
In case there are a lot of Slave applications used, resulting in significant growth of the network load, it is recommended to try and reduce load by enabling broadcast or multicast addressing modes. If changing the addressing mode does not solve the problem, you are recommended to adjust send rate, interpolation/extrapolation parameters.如果使用了很多 Slave 应用程序,导致网络负载显着增长,建议尝试通过启用 broadcast 或 multicast 寻址模式来减少负载。如果改变寻址方式不能解决问题,建议调整发送速率、插值/外插参数。
UNIGINE Syncker uses Interpolated Snapshots (IS) to tackle with the problem of lost packets between Master and Slave. It works by taking two old, but known positions and interpolating the object between them. It is accomplished by having a buffer of received positions and rotations, along with the time they represent. We usually take our current local time minus some predefined amount — interpolation period (40 ms by default), then go into our buffer, find the two indices that are just before and just after this time and interpolate.UNIGINE Syncker 使用内插快照(IS) 来解决 Master 和 Slave 之间丢失数据包的问题。它的工作原理是取两个旧的但已知的位置并在它们之间插入对象。它是通过接收位置和旋转以及它们代表的时间的缓冲区来实现的。我们通常将当前本地时间减去一些预定义的时间——插值周期(默认为 40 ms),然后进入我们的缓冲区,找到这个时间之前和之后的两个索引并进行插值。
If we don't have a received position and rotation for the time we're looking for, the extrapolation (guessing) is used. It also has a limited time — extrapolation period (200 ms by default). If the extrapolation period is over but there are still no packets received, all objects will freeze.如果我们在寻找的时间内没有收到位置和旋转,则使用外推法(猜测)。它还有一个有限的时间——外推周期(默认为 200 ms)。如果外推期结束但仍未收到数据包,则所有对象都将冻结。
In most cases, this method provides a very accurate representation of the world to each Slave, as in general only already known positions of remote objects are rendered and in rare cases the system will try to extrapolate (guess) where an object is. This, however, comes at a cost, as we always render 40 ms (interpolation period) behind current time, so that new packets have time to arrive with data.在大多数情况下,此方法为每个 Slave 提供了非常准确的世界表示,因为通常只渲染远程对象的已知位置,并且在极少数情况下,系统会尝试推断(猜测)对象的位置。然而,这是有代价的,因为我们总是在当前时间之后渲染 40 ms(插值周期),以便新数据包有时间与数据一起到达。
Two-Way Communication双向通信#
Slave is not silent, it can send messages to Master, it can even control Master as well as other Slave applications (e.g., run the profiler on all computers or shutdown all applications) by sending the sync command.Slave 不是静默的,它可以向 Master 发送消息,它甚至可以通过发送 sync 命令来控制 Master 以及其他 Slave 应用程序(例如,在所有计算机上运行分析器或关闭所有应用程序)。
For sending and receiving messages between Master and Slave, Syncker uses a single UDP socket with the following five technologies:为了在 Master 和 Slave 之间发送和接收消息,Syncker 使用具有以下五种技术的单个 UDP 套接字:
- Reliable — guarantees packet delivery using the so-called acknowledge packets. When Master sends a message, Slave reports that the message is received. In case Slave does not reply in a certain period of time, Master tries to re-send the message.Reliable — 使用所谓的确认数据包保证数据包传送。当Master发送消息时,Slave报告收到消息。如果 Slave 在一定时间内没有回复,Master 会尝试重新发送消息。
- Sequenced — guarantees that all packets are received in the right order, finding all duplicates. Each packet has a number and until Slave receives the packet, Master shall not send next ones to it (with greater numbers).Sequenced — 保证所有数据包都以正确的顺序接收,找到所有重复项。每个数据包都有一个编号,并且在 Slave 接收到数据包之前,Master 不会向它发送下一个(具有更大的数字)。
- Merged — small messages are combined into a greater one instead of sending them all one right after the other (send a single 100-bytes packet rather than sending 10 packets 10-bytes each). This makes sending acknowledge packets to the sender simpler and faster.Merged — 小消息被组合成一个更大的消息,而不是一个接一个地发送它们(发送一个 100 字节的数据包,而不是发送 10 个 10 字节的数据包)。这使得向发送方发送确认数据包更简单、更快捷。
- Fragmented — a large message exceeding the MTU size (Maximum Transmission Unit), shall be split into several packets having the MTU size. This ensures delivery of all packets protecting Slave from buffer overflow caused by a single large packet.Fragmented — 超过 MTU 大小 (Maximum Transmission Unit) 的大消息应拆分为多个具有 MTU 大小的数据包。这确保了保护 Slave 免受单个大数据包引起的缓冲区溢出的所有数据包的传递。
- Compressed — all messages are compressed using the LZ4 algorithm before sending. This reduced network load, but slightly increases the load on the computer itself.Compressed — 所有消息在发送前都使用 LZ4 算法进行压缩。这减少了网络负载,但稍微增加了计算机本身的负载。
So, here's how the packets are delivered:所以,这里是数据包的传递方式:
- During the frame up to the Data Sync Point, Master prepares messages for sending and places them to a queue. This "big message" is compressed, split into parts according to the MTU size, wrapped into packets with the following three numbers specified for each of them: sequence number (packet group), fragment number, and total number of fragments in this sequence.在到达数据同步点的帧期间,Master 准备要发送的消息并将它们放入队列。这个“大消息”被压缩,根据 MTU 大小分成几部分,包装成数据包,为每个数据包指定以下三个数字:序列号(数据包组)、片段号和此序列中的片段总数。
- The packets are sent.数据包被发送。
- Upon receiving any of the packets, Slave changes the size of its sliding window in accordance with the number of fragments and adds the received fragment to this window.Slave 在接收到任何一个数据包后,会根据片段的数量改变其滑动窗口的大小,并将接收到的片段添加到该窗口中。
- In case of missing/lost packets, Slave adds the corresponding information on the missing part it requests to be sent again to the acknowledge packet dispatched to Master.在丢失/丢失数据包的情况下,Slave 将它请求再次发送的丢失部分的相应信息添加到分派给 Master 的确认数据包中。
Delivery Modes交付方式#
Basically, you can use the following delivery modes for sending/receiving messages:基本上,您可以使用以下交付模式来发送/接收消息:
- Reliable — Reliable and sequenced mode, enabled by default. All packets shall be delivered to the recipient in the exact order they were sent.Reliable — 可靠且有序的模式,默认启用。所有数据包都应按照它们被发送的确切顺序传送给接收者。
-
Unreliable — Pure UDP. Packets may be lost, duplicated, or received in an order that differs from the one they were sent. Packets are not compressed, fragmented, or merged. Everything is sent "as is". This mode is the fastest one as it requires no additional time for processing. You can use this mode for sending timestamped auxiliary data (e.g., for interpolation) having the size close to MTU. Unreliable — 纯 UDP。数据包可能会丢失、复制或接收顺序与发送顺序不同。数据包不会被压缩、碎片化或合并。一切都按“原样”发送。这种模式是最快的,因为它不需要额外的处理时间。您可以使用此模式发送大小接近 MTU 的带时间戳的辅助数据(例如,用于插值)。
Example: sending 10 times a second positions of 10 aircrafts with the information on the current time, status of flaps, slats, ailerons, landing gears, etc.示例:每秒 10 次发送 10 架飞机的位置信息,包括当前时间、襟翼、缝翼、副翼、起落架等的状态。
-
Sequenced — Packets may be lost, but never duplicated, they arrive in the exact order they were sent. This mode can be used for sending auxiliary data having the size close to MTU.Sequenced — Packets may be lost, but never duplicated, they arrive in the exact order they were sent. This mode can be used for sending auxiliary data having the size close to MTU.
Example: sending each frame positions of 10 aircrafts with the information on the status of flaps, slats, ailerons, landing gears, etc.Example: sending each frame positions of 10 aircrafts with the information on the status of flaps, slats, ailerons, landing gears, etc.
Sequenced — Packets may be lost, but never duplicated, they arrive in the exact order they were sent. This mode can be used for sending auxiliary data having the size close to MTU.Example: sending each frame positions of 10 aircrafts with the information on the status of flaps, slats, ailerons, landing gears, etc.Sequenced — Packets may be lost, but never duplicated, they arrive in the exact order they were sent. This mode can be used for sending auxiliary data having the size close to MTU.Sequenced — 数据包可能会丢失,但不会被复制,它们按照发送的确切顺序到达。此模式可用于发送大小接近 MTU的辅助数据。
Example: sending each frame positions of 10 aircrafts with the information on the status of flaps, slats, ailerons, landing gears, etc.示例:每帧发送10架飞机的位置信息,包括襟翼、缝翼、副翼、起落架等状态信息。
Multiple systems may use the Syncker's network simultaneously (e.g. IG and a user's App application). For convenience, all messages are sent and received via named channels. If the specified channel does not exist, it shall be created.多个系统可以同时使用 Syncker 的网络(例如 IG 和用户的 App 应用程序)。为方便起见,所有消息都通过命名通道发送和接收。如果指定的通道不存在,则应创建它。
Addressing Modes寻址模式#
The following addressing modes for communication are available:可以使用以下通信寻址模式:
Depending on your project's requirements, you can choose the one that fits best: ensures the lowest possible load, or provides additional features like easy testing on a single PC or communication between hosts from different subnets using different ports.根据您的项目要求,您可以选择最适合的一个:确保尽可能低的负载,或提供附加功能,例如在单台 PC 上轻松测试或使用不同端口的来自不同子网的主机之间的通信。
Network Load网络负载#
Summarizing the information from the table above as related to the network traffic load:总结上表中与网络流量负载相关的信息:
- The Multicast mode generates the minimum network traffic, as compared to other modes, thus creating the least load on the router and wi-fi.与其他模式相比,Multicast 模式产生的网络流量最小,从而在路由器和 wi-fi 上产生最少的负载。
- The Broadcast mode can be more consuming, because the packets are sent to all network PCs, including those that are not Slave (if any). If you don't have any other PCs in your network except for Slave ones, then the traffic amount will be the same as in the Multicast mode.Broadcast 模式可能更消耗,因为数据包被发送到所有网络 PC,包括那些不是 Slave(如果有)。如果您的网络中除了 Slave 之外没有任何其他 PC,那么流量将与 Multicast 模式相同。
- The Unicast mode generates amount of network traffic that can be calculated as Multicast * number of Slave PCs.Unicast 模式产生的网络流量可以计算为Multicast * Slave PC 的数量。
To further optimize the traffic load, you can increase the time intervals for packets sending:为了进一步优化流量负载,您可以增加发送数据包的时间间隔:
//On the Master
master->setSendRate(15.0f); // send packets 15 times per second
//Both on the Master and all Slaves
syncker->setInterpolationPeriod(0.1f); // 100 ms delay
In this example, packets will be sent only 15 times per second, thus the lag will make 100 ms.在此示例中,数据包每秒仅发送 15 次,因此延迟将达到 100 毫秒。
To avoid visual jittering, the following condition must be fulfilled:为避免视觉抖动,必须满足以下条件:
interpolation period > (1 / send rate)
Consequently, reducing the lag (interpolation period) requires increasing the send rate, which will affect the network load:因此,减少滞后(插值周期)需要增加发送速率,这会影响网络负载:
//On the Master
master->setSendRate(30.0f); // send packets 30 times per second
//Both on the Master and all Slaves
syncker->setInterpolationPeriod(0.05f); // 50 ms delay
Multiple Cameras and Multi-Monitor Slaves多摄像头和多显示器从站#
Syncker allows synchronizing views from multiple cameras. There are two types of cameras:Syncker 允许同步来自多个摄像机的视图。有两种类型的相机:
-
Main master camera — a single camera that corresponds to the main viewer's position. The screen configuration determines viewports relative to this camera.主主摄像头— 对应于主观察者位置的单个摄像头。这屏幕配置确定相对于该相机的视口。
Example: a camera in the plane's cockpit, corresponding the pilot's point of view.示例:飞机驾驶舱内的摄像头,对应飞行员的视角。
-
Auxiliary camera — an additional camera (static or dynamic) that can be set anywhere in the scene. You can have as many cameras of this type as necessary.辅助相机— 可以设置在场景中任何位置的附加相机(静态或动态)。您可以根据需要拥有尽可能多的此类相机。
Example: a ground-based surveillance camera or a thermal imaging camera mounted on the plane's wing.例如:安装在飞机机翼上的地面监控摄像头或热成像摄像头。
By default, the main master camera is used. You can create auxiliary cameras and specify their viewports to be displayed by selected Slave apps. Such cameras are synchronized automatically.默认情况下,使用主主摄像头。您可以创建辅助摄像机并指定它们的视口以由选定的 Slave 应用程序显示。这样的相机是自动同步的。
Syncker offers you an extreme flexibility of viewport configuration. You can use up to 6 monitors on a single Slave, each having it own viewport assigned. For this purpose, you should use the Wall preset of the SpiderVision Plugin.Syncker 为您提供了极大的视口配置灵活性。您最多可以在单个 Slave 上使用 6 监视器,每个监视器都分配了自己的视口。为此,您应该使用 SpiderVision Plugin 插件的 Wall 预设。
Screen Configurations屏幕配置#
To configure screens/projections, the SpiderVision plugin should be added to your project for both master and slaves. The order of plugins in the list matters — SpiderVision must be specified before Syncker:要配置屏幕/投影,应该将 SpiderVision 插件 should be added to your project for both master and slaves. 添加到您的主项目和从项目中。列表中插件的顺序很重要,SpiderVision 必须在 Syncker之前指定:
-extern_plugin UnigineSpiderVision,UnigineSyncker
The setup window opens on pressing the F10 button on any PC (master or slave) to configure the rendering of all viewports.设置窗口打开按F10按钮在任何PC上(主或从)配置所有视图的渲染。
Screen configuration for Syncker has to meet the following requirements:Syncker 的屏幕配置必须满足以下要求:
- Each display in the configuration should correspond to one of the monitors/projectors.配置中的每个显示器都应对应于其中一台显示器/投影仪。
- Position and orientation of each display/projector must be relative to the main master camera. The closer the monitor is to the viewer, the higher is the FOV value.每个显示器/投影仪的位置和方向必须相对于主摄像头.监视器离观看者越近,FOV 值就越高。
Two types of configuration can be used:可以使用两种类型的配置:
-
A multi-monitor setup formed by displays, where each Slave renders its viewport on the corresponding monitor (or several monitors).多显示器设置由显示,其中每个 Slave 在相应的监视器(或多个监视器)上呈现其视口。
Projection and modelview matrices are automatically calculated on the basis of the viewer's position.投影和模型视图矩阵是根据观察者的位置自动计算的。The following picture shows the screen configuration for the multi-monitor setup, where each Slave renders its viewport to a single monitor.下图显示了多显示器设置的屏幕配置,其中每个 Slave 将其视口渲染到单个显示器。
Screen Configuration (the left picture) for Multi-Monitor Setup (the right picture)多显示器设置(右图)的屏幕配置(左图) -
A multi-projector setup formed by projectors, where each Slave renders its viewport via the corresponding projector. By default, the projectors display images as seen from the viewer's position.由以下人员组成的多投影仪设置投影仪,其中每个 Slave 通过相应的投影仪呈现其视口。默认情况下,投影仪显示从观看者位置看到的图像。
Projector Configuration (the left picture) for Multi-Projector Setup (the right picture)多投影仪设置(右图)的投影仪配置(左图)Projection and modelview matrices are automatically calculated on the basis of the viewer's position.投影和模型视图矩阵是根据观察者的位置自动计算的。
Syncker Pipeline同步器管道#
Basically Syncker has 4 states:基本上 Syncker 有 4 个状态:
- Wait for connections — waiting until all Slave PCs are connected.Wait for connections — 等待所有 Slave PC 连接。
- Starting... — MTU calculation and startup synchronization of all hosts.Starting... — 所有主机的 MTU 计算和启动同步。
- Session Started — the session is started.Session Started — 会话开始。
- Session Finished — the session is over, all Slave PCs are disconnected.Session Finished — 会话结束,所有 Slave PC 断开连接。
Let us consider Syncker running using broadcast addressing with Master and a single Slave:让我们考虑使用带有 Master 和单个 Slave 的广播寻址运行的 Syncker:
- After being launched, Master opens the port (-sync_port), and starts listening to it. Syncker status is switched to "Wait for connections".启动后,Master 打开端口(-sync_port),并开始侦听它。 Syncker 状态切换到 "Wait for connections"。
- Slave gets the list of all available network adapters (Wifi, Ethernet), finds a broadcast address for each of them, and periodically sends connection request packets (broadcast mode). The Syncker status is "Wait for connections".Slave 获取所有可用网络适配器(Wifi, Ethernet) 的列表,为每一个找到一个广播地址,并定期发送连接请求包(broadcast 模式)。 Syncker 状态为 "Wait for connections"。
- Master receives the connection request packet, registers Slave and sends a connection response packet (unicast mode), where it indicates the currently loaded world. When all Slave PCs are connected, the Syncker status is switched to "Starting..." and Master sends projection settings to all of them.Master接收连接请求包,注册Slave并发送连接响应包(unicast方式),表示当前加载的世界。当所有 Slave PC 都连接时,Syncker 状态切换为 "Starting...",Master 将投影设置发送给所有这些 PC。
- As soon as Slave receives the confirmation from Master the status is switched to "Starting..." and starts loading the world from Master.一旦 Slave 收到来自 Master 的确认,状态就会切换到 "Starting..." 并开始从 Master 加载世界。
- While the Syncker status remains "Starting...", both Master and Slave are trying to find the maximum possible MTU value (currently limited to 1432 bytes).当 Syncker 状态保持为 "Starting..." 时,Master 和 Slave 都试图找到最大可能的 MTU 值(当前限制为 1432 字节)。
- Upon completion Slave sends a message to Master that it is ready to continue. After receiving such messages from all Slave PCs (and finding an MTU for each Slave), Master changes the status to "Session Started" notifying all hosts.完成后,Slave 向 Master 发送一条消息,表示它已准备好继续。在收到来自所有 Slave PC 的此类消息(并为每个 Slave 找到一个 MTU)后,Master 将状态更改为 "Session Started",通知所有主机。
- The session has started, everything is ready for work.会议已经开始,一切准备就绪。
Using Syncker使用同步器#
Simple Synchronized Demonstration简单的同步演示#
Suppose, you have prepared a "static" project (meaning that no new objects are created in it and no existing ones are deleted or moved) with some cinematics. This corresponds to the majority of archviz projects or various types of demonstrations.假设您准备了一个带有一些过场动画的“静态”项目(意味着没有在其中创建新对象,也没有删除或移动现有对象)。这对应于大多数 archviz 项目或各种类型的演示。
Suppose, you'd like to demonstrate this project using the Wall system. Syncker should do the job here, but there is nothing in your project about it, not a single line of code! Well, you don't need it, simply use a special system script that launches Syncker! That's all you should do, as the only thing moving during the cinematic sequence is the camera (which is synchronized automatically) with all other objects being static (no need to sync them).假设您想使用 Wall 系统来演示此项目。 Syncker 应该在这里完成这项工作,但是您的项目中没有关于它的任何内容,没有一行代码!好吧,您不需要它,只需使用启动 Syncker 的特殊系统脚本即可!这就是您应该做的所有事情,因为在过场动画过程中唯一移动的是相机(自动同步)与所有其他静态对象(无需同步)。
This is the simplest mode, you don't have to know IP addresses or ports neither do you have to write any code. All you need to know is:这是最简单的模式,您不必知道 IP 地址或端口,也不必编写任何代码。您只需要知道:
- Who shall be Master.谁是Master。
- What is the number of Slave PCs.Slave PC 的数量是多少。
Then you simply do the following:然后您只需执行以下操作:
-
Run the Master application substituting the System Runtime Script with the special one (core/systems/syncker/unigine.cpp) and providing necessary startup command-line options to define it as Master and set the total number of host computers:运行 Master 应用程序替换系统运行时脚本使用特殊的(core/systems/syncker/unigine.cpp)并提供必要的启动命令行选项将其定义为 Master 并设置主机的总数:
<your_app> -sync_init 1 -extern_plugin "UnigineSyncker" -sync_master 1 -sync_count 2
-sync_count here sets the total number of computers (Slave PCs + Master). In this simplest case -sync_count 2 — means a single Master and a single Slave.-sync_count 此处设置计算机总数(Slave PCs + Master)。在这个最简单的情况下,-sync_count 2 — 表示单个 Master 和单个 Slave。
-
Run each Slave application using the same system script and indicating that the host is Slave (not Master):使用相同的系统脚本运行每个 Slave 应用程序并指示主机是 Slave(不是 Master):
<your_app> -sync_init 1 -extern_plugin "UnigineSyncker" -sync_master 0
That's it! Run Master and Slave(s) in any order (it doesn't matter). Slave shall automatically find Master in the network and connect to it.就是这样!以任何顺序运行 Master 和 Slave(s)(没关系)。 Slave 会自动在网络中找到 Master 并连接到它。
Basic Workflow基本工作流程#
The basic workflow is as follows:基本工作流程如下:
- Implement Syncker logic for your Master and Slave applications (you can use the same application on both Master and Slave sides).为您的 Master 和 Slave 应用程序实现 Syncker 逻辑(您可以在 Master 和 Slave 侧使用相同的应用程序)。
-
Prepare your environment.准备您的环境。
It is recommended to use a 100 Mb LAN. Otherwise, you may experience network lags (see Troubleshooting section).建议使用 100 Mb LAN。否则,您可能会遇到网络延迟(请参阅故障排除部分)。
All applications you use must have access to all Unigine files and project data. So, you should copy your project to all computers. If some nodes are missing in the world file on a local computer, they will not be rendered.您使用的所有应用程序都必须有权访问所有 Unigine 文件和项目数据。因此,您应该将项目复制到所有计算机。如果本地计算机上的世界文件中缺少某些节点,则不会渲染它们。
-
Run the Master application.运行 Master 应用程序。
To run a Master application provide necessary startup command-line options, e.g.:要运行 Master 应用程序,请提供必要的启动命令行选项,例如:
<your_app> -extern_plugin UnigineSpiderVision,UnigineSyncker -sync_init 1 -sync_master 1 -computer_name <computer_name> -sync_count <number_of_hosts>
The order of launching Master and Slave applications does not matter.启动 Master 和 Slave 应用程序的顺序无关紧要。 -
Run a Slave application.运行 Slave 应用程序。
To run a Slave application provide necessary startup command-line options, e.g.:要运行 Slave 应用程序,请提供必要的启动命令行选项,例如:
<your_app> -extern_plugin UnigineSpiderVision,UnigineSyncker -sync_init 1 -sync_master 0 -computer_name <computer_name>
If you want to configure projections and displays, you should use the SpiderVision plugin.如果您想配置投影和显示,您应该使用 SpiderVision 插件。
The order of plugins in the list matters: SpiderVision must be specified before Syncker.列表中插件的顺序很重要:SpiderVision 必须在 Syncker 之前指定。 - Set up screen/projection configuration. This step is performed when all Syncker hosts are successfully connected and working.设置屏幕/投影配置.当所有 Syncker 主机都成功连接并工作时执行此步骤。
Debug Window调试窗口#
Syncker's debug window enables you to monitor the hierarchy of objects at run time. The whole hierarchy means all objects (not only the ones registered in the Editor) including objects in cache, internal structure of node references, etc. When a node is selected, all necessary debug information is displayed. This information is updated each frame.Syncker 的调试窗口使您能够在运行时监视对象的层次结构。整个层次结构是指所有对象(不仅是编辑器中注册的对象),包括缓存中的对象,内部结构节点引用等。选择节点后,将显示所有必要的调试信息。该信息每帧更新一次。
The Search option allows you to find any node by its name or ID (on Master or Slave), so a faulty node can be found quickly.Search 选项允许您通过名称或 ID(在 Master 或 Slave 上)查找任何节点,因此可以快速找到故障节点。
To open the debug window, run the syncker_debug console command from Master or Slave as follows:要打开调试窗口,请从 Master 或 Slave 运行 syncker_debug 控制台命令,如下所示:
syncker_debug 1
The debug window can also be opened via the System Menu:调试窗口也可以通过 System Menu 打开:
- Open the System Menu by pressing Esc.按 Esc 打开 System Menu。
-
Enable the Show debug window option:启用 Show debug window 选项:
The debug window will open:调试窗口将打开:
Troubleshooting故障排除#
Slave Cannot Connect to Master从站无法连接到主站#
The console shall look like this:控制台应如下所示:
Slave periodically sends broadcast messages when trying to find Master that responds, but there's no reply. Messages do not reach Master.Slave 在尝试找到响应的 Master 时会定期发送广播消息,但没有回复。消息未到达 Master。
Solutions:解决方案:
- Make sure that the port used by Slave for sending/receiving messages (Slave UDP port) is not blocked by the firewall on Master. Try disabling firewalls on Master and all Slave PCs.确保 Slave 用于发送/接收消息 (Slave UDP port) 的端口未被 Master 上的防火墙阻止。尝试禁用 Master 和所有 Slave PC 上的防火墙。
- Make sure that broadcast/multicast messages are not blocked by the router/switch. It is unlikely, but still possible.确保广播/多播消息未被路由器/交换机阻止。这不太可能,但仍有可能。
-
Try to explicitly specify Master's IP address via the sync_master_address command, for example:尝试通过 sync_master_address 命令明确指定 Master 的 IP 地址,例如:
-sync_master_address 192.168.0.1
In this case Slave shall skip the phase of searching for Master via broadcast messages and use unicast mode for direct connection.在这种情况下,Slave 将跳过通过广播消息搜索 Master 的阶段并使用单播模式用于直接连接。
- Make sure that Master really waits for new connections. Check the sync_count value, is it greater than 1?确保 Master 真的在等待新的连接。检查sync_count值,是否大于1?
Master Cannot Reply to SlaveMaster无法回复Slave#
In this case the console shall look like this:在这种情况下,控制台应如下所示:
Connection requests from Slave were received by Master, the connection was opened and the session was started, but connection response did not reach Slave.Master 收到来自 Slave 的连接请求,打开连接并启动会话,但连接响应未到达 Slave。
Solutions:解决方案:
- Make sure that the port used by Slave for sending/receiving messages (Slave UDP port) is not blocked by the firewall. Try disabling firewalls on Master and all Slave PCs.确保 Slave 用于发送/接收消息的端口 (Slave UDP port) 未被防火墙阻止。尝试禁用 Master 和所有 Slave PC 上的防火墙。
- Make sure that broadcast/multicast messages are not blocked by the router/switch. It is unlikely, but still possible.确保路由器/交换机没有阻止 broadcast/multicast 消息。这不太可能,但仍有可能。
-
Try using a unicast connection:尝试使用单播连接:
-sync_method unicast
-
Check that the broadcast address found is valid, try setting up a broadcast channel for all hosts:检查找到的广播地址是否有效,尝试为所有主机设置广播通道:
-sync_broadcast_address 255.255.255.255
- Try setting another multicast address on the Master and Slave PCs via the sync_multicast_address command.尝试通过 sync_multicast_address 命令在 Master 和 Slave PC 上设置另一个多播地址。
- Check IP/port of the Slave connected to Master. Is this the right Slave, or maybe there is another instance of Slave looking for Master on the same port? Try changing port number on Master and Slave (e.g., -sync_port 25100) and restart applications.检查连接到 Master 的 Slave 的 IP/端口。这是正确的 Slave,还是 Slave 的另一个实例在同一端口上寻找 Master?尝试更改 Master 和 Slave(例如 -sync_port 25100)上的端口号并重新启动应用程序。
Network Latency网络延迟#
If the network latency is too large despite 1Gb bandwidth or higher, it can be caused by a 100 Mb or 10 Mb device connected to a network. Data exchange rate will drop down to the maximum rate supported by such device, slowing down Syncker connection speed.如果在 1Gb 带宽或更高的情况下网络延迟太大,则可能是由连接到网络的 100 Mb 或 10 Mb 设备引起的。数据交换速率将下降到此类设备支持的最大速率,从而减慢 Syncker 连接速度。
- Some 100 Mb or 10 Mb devices can have a working network interface when they are turned off.某些 100 Mb 或 10 Mb 设备在关闭时可以有一个工作网络接口。
- It is also possible that when turned off, 1 Gb devices have a network interface working at 100 Mb rate, which slows down connection in the LAN.也有可能在关闭时,1 Gb 设备的网络接口以 100 Mb 的速率工作,这会减慢 LAN 中的连接速度。
Integration with the Microprofile tool enables you to monitor performance, detect bottlenecks, and eliminate them.与 Microprofile 工具的集成使您能够监控性能、检测瓶颈并消除它们。
Useful Tool有用的工具#
If you have a source SDK, you can use a simple and useful tool to monitor the network messages exchange speed. It is server.usc found in source/tools/Interpreter/scripts/network/.如果您有源 SDK,您可以使用一个简单而有用的工具来监控网络消息交换速度。它是在 source/tools/Interpreter/scripts/network/ 中找到的 server.usc。
Problem Devices问题设备#
Testing and operation revealed that the Syncker plugin may have issues when used with the following equipment:测试运行发现Syncker插件在与以下设备配合使用时可能存在问题:
- 3COM OfficeConnect Switch 5
- D-Link DES-1005D
If any issues arise, try switching to other equipment.如果出现任何问题,请尝试切换到其他设备。