Skip to content

Instantly share code, notes, and snippets.

@pjc0247
Last active September 14, 2015 11:41
Show Gist options
  • Save pjc0247/13a108d6de40b9bfc4af to your computer and use it in GitHub Desktop.
Save pjc0247/13a108d6de40b9bfc4af to your computer and use it in GitHub Desktop.

Merona.Go.cs

__Merona.Go__는 서버 프로그래머가 아닌 클라이언트 프로그래머에게 친숙한 인터페이스를 제공하기 위한 확장입니다.
클라이언트의 게임 오브젝트와 1:1 매칭되는 서버 오브젝트 개념이 제공되며, 서버-클라이언트간의 쉬운 동기화를 위해 클라이언트용 라이브러리 또한 제공됩니다.

  • Unity3D
using Merona.Go.Unity3d;

class Player : MonoBehaviour {
  void Awake() {
    Meronaize(this);
  }
}
  • cocos2d-x
#include <merona_go.h>

using merona::go::cocos2d_x;

class Player : CCLayer {
  bool initialize() {
    /* ... */
    meronarize(this);
    /* ...*/
  }
};
  • MeronaServer
class Player : ServerObject {
  // 아래의 이벤트는 자동 동기화됩니다.
  public void OnMouseDown(Point pt) {
  }
  public void OnKeyboardDown(Key key) {
    // 아래 움직임은 자동으로 동기화됩니다.
    this.x += 1;
  }
  
  // (필요하다면) update 메소드를 구현해 서버 프레임마다
  // 호출 받을 수 있습니다.
  public void Update(float dt) {
  }
}

Meronarize Configs

Merona 서버와 Merona.Go 간에 자동으로 동기화되는 데이터는 모두 네트워크 자원이며, 효율적인 사용을 위해 선택적인 기능만 켜고 끌 수 있습니다.

  • Inputs
    • mouse
    • keyboard
  • Position
  • Instance Vars

AutoSync Handler

각 게임 혹은 엔진마다 좌표 체계 등 자동 동기화되는 값의 단위는 다를 수 있으며, 이를 위해 자동 동기화 단계에 훅으로 끼어들어 처리할 수 있는 메소드를 제공합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment