- JavaScript 74.4%
- HTML 16.8%
- CSS 8.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| public | ||
| .gitignore | ||
| index.js | ||
| package.json | ||
| README.md | ||
2squares
Simple JavaScript two-player "game" to hone my WebSockets and interact.js skills
This is a simple node.js "game" that I wrote in order to familiarize myself with WebSockets programming in node.js, as well as the interact.js framework for draggable user interfaces. It is a "game" in a very loose sense that Wittgenstein would probably barely acknowledge as the weird distant cousin in the family resemblance referred to by the word. The first person to navigate to the URL (localhost:8080 by default) automatically becomes Player 1, and the second becomes Player 2. Each player can only manipulate their own square, and each should see the other player's square move in something vaguely resembling real time.
That's it. There's no gameplay, no scoring, just the very basics of a two-player gamelike application. It would probably not be too difficult to take this as a starting point and progress to a simple Pong-like game. There are also multiple issues: different screen sizes aren't really accounted for, so if one player is on a computer and the other is on a phone, each may see the other player's square move in unusual ways. There's no attempt to account for network failure; once you're disconnected, that's it. The only way to reset the game is to restart the node application. I wasn't going for polished; I just wanted to learn the basics. Nevertheless, I think I succeeded, and I feel comfortable moving from here to more serious multi-person interactive web applications.