Giter VIP home page Giter VIP logo

jaxankey / virtual-game-table Goto Github PK

View Code? Open in Web Editor NEW
53.0 0.0 11.0 29.11 MB

A general-purpose, browser-based game table for casual games and rapid board game development.

License: GNU General Public License v3.0

JavaScript 96.56% HTML 3.00% Shell 0.10% Batchfile 0.05% Python 0.29%
board-game-table tabletop-gaming strategy-game go-game cards-game checkers-game chess-game virtual-tables virtual-tabletop poker-game

virtual-game-table's Introduction

Virtual Game Table

Aaron Clowning Billy at poker

Virtual Game Table is a general-purpose, online, multiplayer, browser-based board game table, aimed at online game nights and rapid game development. No rules will be hard coded, so you can play however you like. The goal is to provide an intuitive, synchronized game table in everyone's browser, and an engine that accelerates the creation of new games. Virtual Game Table has been extensively Dad tested and Dad approved™.

Starting and testing a server

This program runs directly from the source code (see Releases) so no compiling or binaries are required, other than downloading / installing Node.js. This server has been tested on Linux & Windows, but should work on OSX as well.

Linux

  1. Install Node.js: For me, this meant running the command sudo apt install nodejs, but you can also download the binaries, unpack them in a convenient folder, add the binary path to .profile (with a line like PATH=$PATH:/path/to/node/bin) then log out & back in.
  2. From a console in the Virtual-Game-Table folder, run start-server-linux from the terminal. You can optionally specify a game and port, e.g., start-server-linux poker 37000.

Windows

  1. Install Node.js: Download the appropriate windows installer and run it.
  2. Double-click start-server-windows.bat and optionally type the game name and port when prompted.

You can also launch a server directly with a command similar to node server.js cards 37777. A successfully booted server should declare something like listening on port 37777 after initializing. At this point, you can test the server by opening a few browser windows side-by-side and typing in the address localhost:37777. Things moving around in one window should also move around in the other. Push a few buttons, click a few things, see what happens.

Note this is the perfect use of the Amazon Web Services "Always Free" tier, combined with DuckDNS. I may write a tutorial on setting this up at some point, given enough interest.

A Minimal Game

To give a sense of how the engine works, here is the minimal code required to make the most basic checkers game (see games/minimal/game.js):

// Master list of all images with identifiers. 
VGT.images = { paths: {
  hand          : 'images/hands/hand.png',             // Required for player hands
  fist          : 'images/hands/fist.png',             // Required for player hands
  board         : 'images/checkers/board.png',         // Checkered board
  checker_black : 'images/checkers/checker_black.png', // Black checker
  king_black    : 'images/checkers/king_black.png',    // Black king
  checker_red   : 'images/checkers/checker_red.png',   // Red checker
  king_red      : 'images/checkers/king_red.png',      // Red king
}}

// Create the Game instance
var game = new VGT.Game();

// Add the game board to layer 0, and allow only the manager to move it
game.add_piece({layer:0, teams:['Manager']}, 'board');

// Add some checkers with a king symbol on the back to layer 1
game.add_pieces(12, {layer:1}, ['checker_red',   'king_red'  ])
game.add_pieces(12, {layer:1}, ['checker_black', 'king_black'])

// Define the function that is called when someone clicks the 'new game' button.
// The file 'setup-standard.txt' was created by manually setting things up in the
// browser and then pushing the 'save' button.
function new_game() { game.load_state_from_server('setup-standard.txt') }

A more complicated version of this, including a snap grid, is in the games/checkers folder. Even for the more complicated games (poker, e.g.), writing the code takes far less time than making / finding the images.

Games

The games I have coded thus far include some basics:

  • checkers: Checkers & board (double-click pieces to king them)
  • chess: Chess pieces & board
  • cards: A standard deck of cards with 8 private viewing zones
  • poker: Same as cards, but with poker chips on the table and related functionality

and some more complicated systems:

  • puerto-rico: Puerto Rico (can't publish images, but you can find / scan them)

Controls

You can do most things with the mouse and "shift" button, but it is well worth your time to learn the keyboard shortcuts; they make navigation and manipulation very smooth and fast.

Controls

Roadmap

  • arkham-horror: Arkham Horror base set (can't publish images, but you can find / scan them)
  • pandemic: Pandemic base set plus some other stuff.
  • Go: Stones and a board
  • Chess clock object for timed games

Each of these games illustrate the functionalities built into the workhorse code in common/engine.js and server.js. So, if you're interested in writing your own games, I recommend interacting with these examples to see what's possible, then looking at the game.js code for each to see how things are actually implemented. In particular, I would monkey with minimal/game.js first, since it's by far the simplest! Then check out checkers, chess, and (quite complex) poker or puerto-rico.

Known issues

  • Firefox on Linux has horrible rendering speed that can grind to a halt, likely due to the webGL context being immediately lost for some reason, or the browser thinking things are not hardware accelerated. Recommend using chrome on Linux. Firefox works great on Windows.
  • Looks distorted on phones, not that this is intended for phones (yet?)

Here to Help

Feel free to pester me ([email protected]) if something isn't clear. I will likely be a bit slow to respond, but I believe in this project and will gladly update the comments in the code or help out within reason. At some point a larger documentation should occur, but only if this gets popular. For now, learn by example: play with the existing games and check the code to see how different features are implemented.

Things I will never do:

  • Hard-code any rules or anti-cheat measures. You will always be able to look at your oponent's hidden pieces or move them around when they are taking a poo.
  • Convince my friends and family that the games I personally invent are worth playing.

More to come...

virtual-game-table's People

Contributors

jaxankey 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

virtual-game-table's Issues

Installation issues with git clone

Hi! Here are some issues I encountered on installing this. When I git cloned, I got an error message as follows. (See https://github.com/jaxankey/Virtual-Game-Table/tree/master/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build)

git clone https://github.com/jaxankey/Virtual-Game-Table.git
Cloning into 'Virtual-Game-Table'...
remote: Enumerating objects: 201, done.
remote: Counting objects: 100% (201/201), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 2625 (delta 108), reused 142 (delta 57), pack-reused 2424
Receiving objects: 100% (2625/2625), 22.97 MiB | 735.00 KiB/s, done.
Resolving deltas: 100% (905/905), done.
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/bufferutil/bufferutil.lastbuildstate'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/bufferutil/bufferutil.lastbuildstate'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/bufferutil/bufferutil.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/bufferutil/bufferutil.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/bufferutil/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/bufferutil/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/bufferutil/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/bufferutil/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/bufferutil/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/bufferutil/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/bufferutil/vc110.pdb'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/bufferutil/vc110.pdb'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/validation/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/validation/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/validation/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/validation/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/validation/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/validation/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/validation/validation.lastbuildstate'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/validation/validation.lastbuildstate'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/validation/validation.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/validation/validation.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj/validation/vc110.pdb'
  'node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/release/obj/validation/vc110.pdb'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/bufferutil/bufferutil.lastbuildstate'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/bufferutil/bufferutil.lastbuildstate'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/bufferutil/bufferutil.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/bufferutil/bufferutil.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/bufferutil/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/bufferutil/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/bufferutil/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/bufferutil/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/bufferutil/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/bufferutil/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/bufferutil/vc110.pdb'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/bufferutil/vc110.pdb'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/validation/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/validation/cl.command.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/validation/CL.read.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/validation/CL.read.1.tlog'
python 3.8.3
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/validation/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/validation/CL.write.1.tlog'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/validation/validation.lastbuildstate'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/validation/validation.lastbuildstate'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/validation/validation.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/validation/validation.unsuccessfulbuild'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/Release/obj/validation/vc110.pdb'
  'node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build/release/obj/validation/vc110.pdb'

Is there actually a need to keep your node_modules folder in version control (and thus on GitHub), rather than having users install dependencies with e.g. npm install? Which is what I am about to try.

To do so I am making up that the required node version is 14.5.0 - please could you add to the README the required node version?

I am able to run the server on MacOSX by running ./start-server-linux after running npm install, though I did not try to do so before running npm install.

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.