任何的方法来实现在AS3确定性物理学?确定性、物理学、来实现、方法

2023-09-08 14:09:10 作者:繁华落尽、如梦无痕

这似乎是Box2D的对ActionScript 3的不确定性,这意味着,在多人游戏wheere物理起着决定谁赢/输了重要的作用的情况下,其结果将是为每个用户不同的,如果他们的microprocesors来自不同的技术(英特尔和AMD为例)。

It seems like Box2D for actionscript 3 is not deterministic, it means, in the event of a multiplayer game wheere physics plays an important role in determining who wins/loses, the results would be different for each user if their microprocesors are from different technologies (intel and amd for example).

那么,有没有一种方法来实现在AS3确定性物理学?在此之前实现?

So, is there a way to implement deterministic physics in AS3?, was this achieved before?.

感谢。

推荐答案

我曾经有过这个问题。

我们使用的Havok引擎的冲击波董事模拟逼真的2玩家的3D台球游戏。

We used Havok engine in Shockwave Director to simulate a realistic 2-player 3D pool game.

这是最好的在服务器的准确性和安全性上进行处理。但是,我无法承受任何服务器端的物理处理,以及客户端处理了不同的结果,为不同的客户,即使启动参数都是一样的。

This is best be processed on the server for both accuracy and security. However, I was not able to afford any server-side physics processing, and client-side processing gave different results for different clients even when starting parameters were the same.

我们的情况下是不适用于任何多人游戏100%,但可以适用。这是一个回合制游戏中,每个玩家发一击,球被Havok的处理,双方球员必须看到同样的最终结果。

Our case is not 100% applicable to any multiplayer game but can be adapted. It was a turn-based game, each player made a strike, balls were processed by Havok and both players would have to see the same final result.

所以,我们做了以下内容:

So, we did the following:

在一个球员,是有轮到他是领先的球员。他进行了罢工。他的锋线数据(打击力量,提示的位置和旋转)被发送到服务器和从服务器到第二个玩家。 在这两名球员做本地模拟。它们都具有相同的打击数据这样的结果将是近似相同。 引线球员的仿真停止后,他将最后球位置到服务器和服务器将它们发送到所述第二播放器。一旦第二个玩家模拟已经停了,他调整使用从领奏的数据最终球的位置。这看起来像球已经停止,然后跳进稍微不同的位置。

总的来说,这并不看的太顺利,但它会确保每个回合玩家一开始会看到相同的播放配置。

Overall this doesnt' look too smooth but it will ensure that on start of each turn players will see identical playing configuration.

应用这种方法更通用的一种多人游戏(如,持续的行动,没有转弯,超过2个玩家)的类似的事情可以做:

Applying this method to a more generic kind of multiplayer games (like, continuous actions with no turns, more than 2 players) the similar thing can be done:

选择(可能是随机的,也许基于类似的延迟等一些特定的数据),一个领先的球员。 在收集来自所有玩家的所有行为数据,在本地运行的模拟。 从时间到时间,使领奏的数据快照,并通过服务器更新发送给其他玩家。其他球员必须根据接收到的数据(改变物体的位置以及他们的角度,冲动等),更多的时候执行快照将产生较平滑的模拟调整他们的模拟,但会增加流量。