galaxyyao / TouhouGrave

Another version of Touhou Spring(https://github.com/galaxyyao/Touhou-Spring), with some adjustment in rules
3 stars 0 forks source link

Implement card artwork image streaming remotely #60

Open zeroyao opened 11 years ago

zeroyao commented 11 years ago

For convenience, large data files like card's artwork images need to be streamed from other source other than the main code repository. One of the common approaches is to setup a server for the purpose and downloading images from it.

Basically, we make two Git repositories work together: one is the main code repository and the other is data repository.

My design as follow:

  1. Create a new Git repository on Github. Upload all our images onto it, in usual SCC way;
  2. We can add the data repository to the main repository as git-subrepo. For the moment, it is already sufficient to use for development; (The following designs are for dynamic content streaming feature we would possibly ship in our final release)
  3. Synchronize the data repository regularly on our web server (possibly need a dedicated server after release because huge traffic will incur);
  4. At the client program side, we maintain a folder of "content cache";
  5. When the client program launches, it sends the following information to the content server:
    • The git revision hash on which the client program is built;
    • The hash of each file in the content folder.
      1. The content server application shall receive this information, and:
    • Decide the right file (target) to be streamed according to the git revision hash (pull the files in the data repository no-newer than the client revision);
    • Decide whether the target needs to be streamed by comparing the file hash sent by client and the file hash computed from target.
    • Send back a list of file URLs for client to stream;
      1. Client streams all the files in the URL list returned by server using the normal web requests.

With this approach our game can ship without all the images in the distribute package. They can be dynamically streamed from our dedicated content server.

zeroyao commented 11 years ago

Should solve https://github.com/galaxyyao/TouhouGrave/issues/59 perfectly.