Giter VIP home page Giter VIP logo

tic-tac-toe's Introduction

Tic-Tac-Toe

This is a global, real-time multiplayer Tic-Tac-Toe game written in Deno. It persists game states in a Deno KV store, and synchronizes game state between clients using the watch() feature of Deno KV.

Features

  • Real-time multiplayer game
  • Persistent game state and coordination using Deno KV
  • Uses GitHub OAuth for authentication

This project is hosted on Deno Deploy:

  • Served from 35 edge locations around the world
  • Scales automatically
  • Data is a globally distributed Deno KV store with no setup required
  • Code is deployed automatically when pushed to GitHub
  • Automatic HTTPS (even for custom domains)
  • Free for most hobby use cases

Example

You can try out the game at https://tic-tac-toe-game.deno.dev

Screenshot

Development

To develop locally, you must create a GitHub OAuth application and set the following environment variables in a .env file:

GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...

You can create a GitHub OAuth application at https://github.com/settings/applications/new. Set the callback URL to http://localhost:8000/auth/oauth2callback.

You can then start the local development server:

deno task start

tic-tac-toe's People

Contributors

losfair avatar lucacasonato avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tic-tac-toe's Issues

Unacceptable Latency

I built a turn-based game where the game loop is basically a kv.watch() loop, using this (and a chat app) as inspiration. The latency is just as bad; up to several seconds for a single turn.

If this is the best multiplayer game demo for Deno, multiplayer with Deno is a dead end.

error: The source code is invalid, as it does not match the expected hash in the lock file.

I'm new to the world of fresh and deno...I have looked all over deno and Fresh's documentation, used the --help tag....and I have found no documentation on how to proceed. I've searched for hours for the solution. Perhaps I have spend another few hours figuring it out...but I've been cramming so much new stuff into my head with fresh and deno that it's hard to want to keep searching for answers to all the errors. Anyways thanks for making this project freely available. I hope to get it running to test out DenoKV and authentication. Cheers

What is the purpose of import_map.json?

I'm just playing around with the project (thanks for putting it out) and I came across import_map.json. It seems a little redundant if there's already the deno.json, which in this case is importing the import map. Just wondering if there's something in the code which requires this configuration, if it's some kind of best practices, or something else?

Why not take import_map.json:

{
  "imports": {
    "๐Ÿ› ๏ธ/": "./utils/",
    "๐Ÿ๏ธ/": "./islands/",
    "๐Ÿงฑ/": "./components/",

    "$fresh/": "https://deno.land/x/[email protected]/",
    "preact": "https://esm.sh/[email protected]",
    "preact/": "https://esm.sh/[email protected]/",
    "preact-render-to-string": "https://esm.sh/*[email protected]",
    "@preact/signals": "https://esm.sh/*@preact/[email protected]",
    "@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
    "twind": "https://esm.sh/[email protected]",
    "twind/": "https://esm.sh/[email protected]/",
    "$std/": "https://deno.land/[email protected]/"
  }
}

and pop it into to deno.json such that it deno.json looks like:

{
  "tasks": {
    "start": "deno run -A --unstable --watch=static/,routes/ dev.ts"
  },
  "imports": {
    "๐Ÿ› ๏ธ/": "./utils/",
    "๐Ÿ๏ธ/": "./islands/",
    "๐Ÿงฑ/": "./components/",

    "$fresh/": "https://deno.land/x/[email protected]/",
    "preact": "https://esm.sh/[email protected]",
    "preact/": "https://esm.sh/[email protected]/",
    "preact-render-to-string": "https://esm.sh/*[email protected]",
    "@preact/signals": "https://esm.sh/*@preact/[email protected]",
    "@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
    "twind": "https://esm.sh/[email protected]",
    "twind/": "https://esm.sh/[email protected]/",
    "$std/": "https://deno.land/[email protected]/"
  }
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.