Coder Social home page Coder Social logo

balldropgame's Introduction

Ball Drop Game

A game to demonstrate TCP sockets

This is a multiplayer game in which players collaborate to keep a ball from hitting the ground. Each player has a paddle, and can bound the ball off her paddle. When the ball bounces off your paddle, you get a point. Only the first bounce counts, though; subsequent bounces don't get you points. But if the ball bounces off another player's paddle then back to yours, you score again. You can keep scoring forever by bouncing the ball back and forth.

Here's a video of the game in action.

The game is a networked application. Players log in by making a TCP socket connection to the IP address of the computer on which the game is running. For example, if the game is running on a computer with the IP address 192.168.0.2, then you'd make a connection to 192.168.0.2 port 8080, and you'd be connected.

The simplest connection you can make to the game is via a command line interface, using telnet, like so:

$ telnet 192.168.0.2 8080

The game itself, BallDropServer, is written in Processing, so you'll need to download the Processing IDE in order to run it.

Clients

The game clients can be written in any programming environment, and for any hardware you wish, as long as your environment can connect to a network and make a TCP socket connection. I've written clients for a few platforms below:

Communication Protocol

When a client connects to the server, the server will send back a greeting and the instructions for controlling a paddle, as follows:

hi
l = left, r = right, u = up, d = down
x = exit
1 point for each time the ball hits a new paddle
(minimum 2 players)

The client can then send the following commands:

  • l - move paddle left
  • r - move right
  • u - move up
  • d - move down
  • i - toggle paddle label between name or IP address
  • n=XXXXX - set name (n= and n are the terminators. Everything between is the name
  • x - exit

Game Play

The game starts when the first new player logs in. Balls will drop from the top of the screen, and remain in play until they reach the bottom of the screen. To score the most points, bounce the ball off as many paddles as you can.

The goal is to get the highest collective score.

The game ends when five balls have dropped. When the game is over, the group's scores will be displayed.

The game in its current version does not send the player any information about the ball or the state of the other players. In order to play the game, you have to be physically present to view the screen of the computer on which the game is running.

balldropgame's People

Contributors

tigoe avatar

Watchers

 avatar

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.