server | v3 switch to v4  

Extending Lite

Persistency is currently not covered in the SDKs we provide. None of our applications saves any data. Every game and application is different and on a high performance server solution, you probably want to control this aspect yourself.

You are free to use any of the many professional solutions developed in C#. As example, take a look at:

  • NHibernate: Mature, open source object-relational mapper for the .NET framework
  • Couchbase: Distributed key-value database management system
  • CSharp-SQLite: SQL database in a local file
  • Lightspeed: High performance .NET domain modeling and O/R mapping framework

Trigger Game-Logic In Intervals

If you want your server application to execute some logic in intervals, add this as method into LiteGame and schedule a message for the room. By using a message, the method call will be in sequence with any operations (avoiding threading issues).

In the Lite Lobby Application's LiteLobbyRoom.cs we used this code:

    /// <summary>Schedules a broadcast of all changes.</summary>
    private void SchedulePublishChanges()
    {
        var message = new RoomMessage((byte)LobbyMessageCode.PublishChangeList);
        this.schedule = this.ScheduleMessage(message, LobbySettings.Default.LobbyUpdateIntervalMs);
    }

    /// <summary>Initializes a new instance of the LiteLobbyRoom class.</summary>
    public LiteLobbyRoom(string lobbyName)
        : base(lobbyName)
    {
        this.roomList = new Hashtable();
        this.changedRoomList = new Hashtable();

        // schedule sending the change list
        this.SchedulePublishChanges();
    }

    /// <summary>Sends the change list to all users in the lobby and then clears it.</summary>
    private void PublishChangeList()
    {
        //do something in intervals...

        //schedule the next call!
        this.SchedulePublishChanges();
    }

As you can see, at the end of PublishChangeList the next call is scheduled explicitly.

ドキュメントのトップへ戻る