Giter Site home page Giter Site logo

football's Introduction

FOOTBALL

This repository contains source code for a multiplayer, multi-process football game. It is multiplayer in the sense that multiple users can participate in a single game at the same time, and multi-process in the sense that the application can run multiple games concurrently. The project is written in Typescript, and is run on a node server with very few dependencies on the backend. A more in depth review of the architecture is not yet available.

RUNNING LOCALLY

Some prerequisites before running the game locally:

  • Install git and update it if you haven't already. Instructions here.
  • Install docker. Instructions here.

To get the game running locally, open your terminal / command line. Then clone this repository to get all the code, by typing in the following command:

git clone https://github.com/Dirichi/football.git

Next, cd into the directory where the code has been downloaded

cd football

Create a new file called .env and copy the contents of .example_env into it.

cp .example_env .env

Feel free to change the passwords / secrets in .example_env to your own preferences.

Then run the game using docker-compose.

docker-compose up

You should see some output on your terminal while the app compiles in preparation for running. Eventually you see something like server started at http://localhost:3000.

When you see this, open chrome and visit localhost:3000. Wait for about 5 seconds for the game to actually start and try out the direction controls to control whichever player has a blue cursor on their head!

TESTING

This project is liberally tested (lol). To run tests:

npm run test

LEARNING RESOURCES

  • Check out tutorialspoint for a Typescript tutorial.
  • Check out p5js to learn about animation on the web.
  • Checkout w3schools for a tutorial on nodejs.

football's People

Contributors

dependabot[bot] avatar dirichi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

colayue

football's Issues

Unfair advantage

When a player on the red team has no better option, they can hold on to the ball indefinitely. We need a way to tackle and collect the ball. Maybe tackling momentarily disables the opponent's ability to kickBall

No reaction to loose balls

When a pass to a teammate goes wrong (e.g. kicktimer has not been reset so they can't control the received pass), the team remains in an attacking state, but no one chases after the ball. The same happens when a shot misses the target.

Tackling

private listenForBallCollisions(): void {

Related to #81
if the ball possession service registered multiple players as simultaneously having the ball, rather than just one, things might be fairer. We might then be able to probabilistically hand over ball control from one player to another.

What's more, this might help resolve issues with loose balls(?). Unsure how though

Keeper State

Ensure that the keeper doesn't just run out of the post once an attack is on.

Kickoff bug

The ball is not returned to the center circle for kickoff if the keeper grabs it from the post right after it a goal is scored. This is because ball control is enabled even after the goal is scored, so the keeper attracts the ball and overwrites it position even after it has been moved to the center circle.

Marking

Players should mark the ball more intelligently i.e. If I'm in front of the opponent with the ball, then I mark

UI

  • Make the login and index pages less plain
    • Add headings for both
  • Show some loading text between the moment a user selects a position and the start of the game
  • Show instructions on the index page:
    Control a single player (the one with a blue dot above its head) with the following keys:
    A - shoot ball
    S- pass
    D - request for pass
    direction keys - Move / dribble ball in the corresponding direction

Passing bug

When a teammate intercepts the ball, the player that was passed to remains in the waiting state.

User Interface

Create a user interface so that people can input what kind of game they want and start the game.

InterceptionCalculator wonky

The interception calculator needs work. passes often go wrong.

It could also be used for a rewrite of the collision detection algorithms.

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.