2017-05-12 17 views
3

マルチユーザーをA-フレームに組み込むためのオプションは何ですか?A-Frameでマルチユーザを行うには?

以下は、私は黒の球は、各プレイヤーを表現したいサンプルコードです:

<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> 
 

 
<a-scene> 
 
    <a-sphere id="player" color="black"></a-sphere> 
 

 
    <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box> 
 
    <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere> 
 
    <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder> 
 
    <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane> 
 
    <a-sky color="#ECECEC"></a-sky> 
 
</a-scene>

答えて

3

マルチユーザーはまだコミュニティとして肉付けされており、チームが実験を続けています。ネットワーク物理学はうまく実装する必要があり、ゲーム業界からWebに移植できるいくつかの方法があります。書き込みの時点での初期オプションはいくつかあります。

https://github.com/haydenjameslee/networked-aframe - WebRTCとサーバーを使用するHayden Leeによるネットワーク化されたAフレーム。ここでは、始めるためにリミックスすることができますグリッチです:https://glitch.com/~networked-aframe

<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.min.js"></script> 
 
<script src="easyrtc/easyrtc.js"></script> 
 
<script src="https://unpkg.com/networked-aframe/dist/networked-aframe.min.js"></script> 
 
<script> 
 
    function onConnect() { 
 
    NAF.entities.createAvatar('#avatar-template', '0 1.6 0', '0 0 0'); 
 
    } 
 
</script> 
 

 
<a-scene network-scene> 
 
    <a-assets> 
 
    <script id="avatar-template" type="text/html"> 
 
     <a-sphere color="black"></a-sphere> 
 
    </script> 
 
    </a-assets> 
 

 
    <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box> 
 
    <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere> 
 
    <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder> 
 
    <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane> 
 
    <a-sky color="#ECECEC"></a-sky> 
 
</a-scene>

別のオプションは、リアルタイムのマルチプレイヤーゲームサーバ、http://lance.gg/です。これは、ゲームロジックが実行される拡張可能なNode.JSベースのサーバーと、クライアントのゲーム状態をサーバーのゲーム状態と同期させるクライアント側のライブラリを提供します。ランスは、接続された各クライアントにスムーズなビジュアルエクスペリエンスを提供するために、効率的なネットワーキング手法、位置補間と外挿、ユーザ入力調整、シャドウオブジェクト、物理学と擬似物理移動、ネットワークスパイクの自動処理を実装しています。

古いオプションはhttps://github.com/ngokevin/kframe/tree/master/components/firebaseです - Firebaseのリアルタイムデータベースサーバーを使用するFirebaseコンポーネントで、独自のサーバーをホストする必要はありません。

関連する問題