Code Monkey home page Code Monkey logo

haunted-chronicles's Introduction

Haunted Chronicles

A small project to discover online multiplayer games.

Future Updates

  • Improve the UDP connection (see issue #47).
  • Add better graphics, such as a manor environment and ghosts and hunters skins for players.
  • Launch the game on the ISCSC remote server (see issue #48).

GAME :

Python Module Dependencies

  • pygame
  • shapely

Launch

Server Launch

python3 server.py or make server

Client

python3 client.py <Server_IP> <Server_Port> or make client SERVER=<Server_IP> PORT=<Server_Port>

Formatted messages :

Main messages :

Client connection :
  • sends CONNECT <Username> END and receives CONNECTED <Username> <Screen_Size> WALLS <Walls_List> STATE <Players_List> END as a connection confirmation and to setup the state of the game locally.
Client inputs :
  • sends INPUT <Username> <Input> END and receives STATE <Players_List> END to update the state of the game on the server, and then locally. <Input> can be LEFT, RIGHT, UP, DOWN for movements ; RED, BLUE, ǸEUTRAL for teams ; READY to set player ready for game start ; and . for none.
Client disconnection :
  • sends DISCONNECT <Username> END and receives DISCONNECTED <Username> END as a confirmation before quitting the game.

Others :

  • Client sends periodically PING <clock_time> END and receives the same message to estimate the ping with the server.
  • When the game has started, the ̀STATE <Player_List> becomes STATE <Player_List> SHADES <Shades_List> to communicate to each client the things they can see or not.
  • To recognize if the game is currently played or if players are in the lobby, the server sends LOBBY <Ready_Players_List> END if the server is in a LOBBY state, which allow clients to display players which are ready to launch the game. It sends GAME <Time> END if the server is ingame, <Time> being the remaining time for seekers to hunt.
  • To identify transition states, the server sends either TRANSITION_GAME_LOBBY <Message> END or TRANSITION_LOBBY_GAME <Message> END to respectively inform clients the server is in a transition state from GAME to LOBBY, or LOBBY to GAME, <Message> being the text to display on clients screens : such as the remaining time before the switch and the team that has won the game.

haunted-chronicles's People

Contributors

zynoxelek avatar laudut avatar bluenz avatar

Stargazers

dolphino | atxr avatar  avatar

Watchers

 avatar

Forkers

vst11 zynoxelek

haunted-chronicles's Issues

Make a first hide and seek game playable

Make a prototype of the game playable to test main features.

How it could be done :

  • Players join the lobby, and press a key to join a team and mark as ready.
  • When all players are ready, block new connections to the game.
  • The game can start : hiders have a limited time to hide while the seekers can't move. And then they have to find and touch the hiders to defeat them.
  • The hiders win if they survive during a defined amount of time. The seekers if they find every hiders.
  • When the party's over, everyone goes back to the lobby.

Make the movements smoother

Make players be able to move diagonally.
Make the collision detector be smarter : moving you to the closest position to the obstacle when a collision is detected, rather than just blocking the whole movement.

Deploy the game on the remote server

Deploying the game on the remote server would be a great improvment from the game!
We could then had logging and scores to each player.
Or also add the possibility to host several games at once, and decide which one you want to join.

May need to use json interpreter

We may need to use json interpreter instead of our custom interpreter as the complexity of our game increase and the amount of Class to save and transmit increase.
It would also be easier to save maps in a file for instance. (Or we could do it ourselves.)

Compatibility Windows/Linux

Certain functions behave differently (notably in pygame and socket) in Windows or Linux:

  • Screen size and full screen
  • Winerror with sockets

Use real logs with python logging

Prepare real logs which will be very useful for both local debugging and distant debugging (when the server will be distant)

Will make debugging really more pleasant

中文字

Make pygame render characters other than just western one

Decrease ping

Initial Goal : Reduce player ping to make the game fluider.

First Idea : Using a UDP Connection, the game should be fluider.
Yet, the UDP connection also brought a lot of instabilities because of the DDOS some clients may inflict on the server.

Main objective : reduce ping while not making the game feel laggy.
Two ideas :

  • Reduce communications frequency, and keep last input from the player in memory to assume this input for around 3 to 5 movements. May reduce the feeling of fluidity for players tho.
  • Only send inputs when the player actually changes inputs. To be sure the new input is correctly received, we could add :
    • a 'fake TCP' to verify the new input has been taken into account.
    • We can also send a rack of messages containing the new input to try to improve the chances that the message will be correctly received.
    • We can additionnaly implement a 'safety sending' of the actual input every X loops to be sure it is correctly taken into account.
    • Combining all this changes should allow the server to receive way less messages from clients. Impact on the feeling of fluidity yet to be determined.

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.