1

ゲームを Windows に移植していますが、たとえば、同じシステム上のすべてのユーザーがデータを共有できるように、ハイスコア データをどのように保存する必要があるのか​​疑問に思っています。理想的には、ユーザー自身がデータを書き込めないようにし、データを所有するアプリケーション (この場合はゲーム) だけがデータを書き込めるようにする必要があります。純粋な技術的な詳細とは別に、ベスト プラクティスについても考えています。

Unix では、これは実行可能ファイルに set-UID ビットを設定し、実行可能ファイルと問題の共有ファイルを同じシステム ユーザー (私の場合はゲーム) に属するようにすることで実現できます。そのようなファイルを /var/lib/games に配置するベスト プラクティスもあります。

4

1 に答える 1

0

First, what you can't do:

  1. You can't let some executable change some value, but prevent the user running it from doing so.
  2. You can't make some executable run under a specific account, unless you use some sort of loader (another executable) that will ensure that.
  3. You can't use the registry to store shared data, unless your users are running as administrators (which should not be an option).

Now, what you can do:

  1. Use a database...
  2. Use the ProgramData folder ("All Users" on XP).
  3. Use some loader to keep your app running under the same user, which opens both that user's registry and AppData folder (bad idea - just mentioning as it is technically possible).

If #1 is not possible, I'd go for #2.

A good read about this topic: Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions?

于 2011-10-08T21:49:29.763 に答える