0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ブラウザで遊べる日替わりゲームを4本作って分かったこと(日替わりシード・時間制限の設計)

0
Posted at

はじめに

インディー開発者のChaozi(チャオズ)です。ブラウザで動く小さなゲームを4本作っているので、設計で工夫した点をまとめます。作者本人による紹介を含みます。

1. 毎日変わるパズルを「サーバーレス」で出す(日替わりシード)

日替わりゲームの基本は、日付から決定的に問題を選ぶことです。日付文字列(例: 2026-10-22)をハッシュしてシードにし、問題リストのインデックスを決めれば、全員が同じ問題を遊べます。バックエンドなしでも成立します。

function dailyIndex(dateStr, n) {
  let h = 2166136261;
  for (const c of dateStr) { h ^= c.charCodeAt(0); h = Math.imul(h, 16777619); }
  return (h >>> 0) % n;
}

2. 作ったゲーム

  • Farflung - 毎日1問の地理パズル: https://farflunggame.fun/
  • Daily Red - レッド(ポケモン)の固定チームに挑む毎日のバトル。ラインナップは毎日更新: https://daily-red.app/
  • 2 Minute Drill - NFLの残り2分での逆転を狙う戦略ゲーム: https://2mindrillgame.org/
  • Noillirk - 「みんなが一番多く答えそうなこと」を当てるマルチプレイのパーティーゲーム(7問 x 15秒): https://noillirk.pro/

3. 制限時間つきゲームの実装メモ

Noillirkのように15秒の制限がある場合、クライアントの時計に頼らず、サーバー側の開始時刻を基準に残り時間を計算すると、プレイヤー間のずれを抑えられます。

おわりに

どれも無料で遊べます。フィードバックや不具合報告をいただけると嬉しいです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?