Giter Club home page Giter Club logo

snake-extended's Introduction

Project description

Project name

Snake multiplayer (snake-extended)

List of group members

Joren Štekeļs, registration no.: js21283

Brief description of the program (what the program does)

The program is a classic snake game. Both individual games and a game for two through a computer network, which was implemented in a P2P model. Communication is implemented with "websockets" library and game functionality is implemented with using the "pygame" library.

The object of the snake game is to get as big a snake as possible by collecting foods that are placed on the field of play. The game ends if the snake touches the body of any snake.

Prerequisites

In order to play with a remote ip and you do not have a personal public IP address you need to set up NAT port forwarding for the port you are going to use for local server. The should be than on the remote side.

Instructions on how to run your program

Get the source code repository, for example by cloning it from the github repository.

$ git clone https://github.com/jorenchik/snake-extended
$ cd ./snake-extended

Create a virtual Python environment (optional).

$ python -m venv venv

Activate python virtual environment.

Linux/Unix:

$ source ./venv/bin/activate

Windows:

$ source .\venv\Scripts\activate 

Install "poetry" to get the necessary packages.

$ python -m pip install poetry 
$ python -m poetry install 

Alternatively, required packages can be obtained from "requirements.txt".

$ pip install -r requirements.txt

Run the program in single player mode.

$ python snakext/app.py

To run the program in 2-player mode, the following arguments must be specified: sockets, local server port (optional). For example, let's connect to a socket localhost:54323 starting the local server on port 54322.

$ python snakext/app.py localhost:54323 --local-port 54322

The default port is 54321. So:

$ python snakext/app.py 192.168.8.3

This would connect to 192.178.8.3:54321 and start the server on port 54321.

Screenshots showing the program in action

Single player mode

Game Started Game in progress

Two player mode. Joining is done at first. If it is successful a handshake is performed and the game begins similar to single player mode.

Starting a two-player game Two Player Game Process

Link to the project's GitHub (Gitlab, etc.) repository

The project repository can be found here.

snake-extended's People

Contributors

jorenchik 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.