0

私は現在、Android用のゲームを構築しています。ゲーム自体は、Google の月着陸船と同じアーキテクチャを使用して動作します。また、Bluetooth API と Bluetooth チャット アプリについても調べました。Bluetoothを使用して2つのデバイスでプレイできるようにゲームを作成したいと思います。

私は卓球スタイルのゲームを作っています。だから私はボールと2つのパドルを持っています。各プレイヤーに 1 つ。ゲームの更新とサーフェスビューへのリダリングにスレッドを使用しています。現在、このスレッドを使用して、パドルの位置を他のデバイスに送信しています。ゲームは 50 fps で実行されます。これは、Bluetooth経由で50回の書き込みを行うことを意味します。この方法は機能しますが、大きな遅延があります...

Bluetooth のパフォーマンスを向上させるにはどうすればよいですか? どのタイプの入力ストリームと出力ストリームを使用する必要がありますか?

敬具

4

1 に答える 1

0

You shouldn't rely on the connection to be good, expect variable delays.

You need some kind of time synchronization, and timestamp certain events so that even when the other side is to late, it can calculate where the ball should be at that moment, and the game stays in sync.

As I understand it, the minimum you should send/timestamp is the pallet position while it hits the ball and/or the outgoing vector of the ball, from then on the other device can calculate on its own what will happen until he hits the ball en does the same. Any pallet updates from then on are supplementary.

于 2011-02-24T19:42:00.450 に答える