GithubHelp home page GithubHelp logo

fl0rek / projekttin Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 1.0 11.58 MB

Projekt na przedmiot TIN realizowany w 4 osobowym zespole.

CMake 1.99% C++ 71.82% C 20.55% QMake 2.62% Shell 0.66% Python 0.36% Lua 2.01%

projekttin's People

Contributors

asobolewski avatar fl0rek avatar izaya0 avatar sbe avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

asobolewski

projekttin's Issues

Connecting to server

Client should provide libnet with user provided session key and request association.

In case of failure appropriate error message needs to be displayed to user.

Request resync on internal error

Game needs to notify ClientAPP on stdout if provided move leads to invalid internal state and request whole game state resynchronisation.

Processing client association message

Server needs to appropriately answer client association messages namely:

In case of viewer:

  • Prepare and send them current game state
  • Add viewer as associated with viewer role

Player:

  • Add player as associated with player role
  • Start game if all players have connected

Serializing supported class investigation

Library needs to support serialising and deserialising c++ classes.
This could be done with either dedicated library (boost::serialize for example) or by adding serialize and deserialize methods to appropriate classes.
I would suggest latter as it enables exploiting tlv structure to it's full potential.

Viewer mode initialisation - GameAPP

Client needs to be able to start GameAPP attaching its stdin/stdout to pipes to enable communication with it.
Seeding GameAPP with game state received from server is also needed.

Sending chat message

Client needs to provide functionality for a chat client to send message to server via libnet

Graceful reconnect

Library needs to enable as seamless reconnection as possible.
If connection can be reestablished all buffered messaged must be retransmitted and cannot be lost.

Add client-server association

Function
attach(server_ip) -> error_code
needs to perform handshake with server using key provided for user (and server key on the other side).

I suggest sending encrypted helo message and performing symmetric key negotiation.

Synchronising game state

Client needs to enable game to request state synchronisation (in case game detects internal state inconsistency) or manually synchronising game state (e.g. on connect)

Saving mesage

Server needs to save every received message (possibly marking it as invalid) and every sent message.

Receiving chat message

Client needs to handle receiving chat message from server and forward it to chat client

Sending message to all associated instances

library needs to enable functionality

enque(tlv message) -> void

that broadcasts message to all associated instances.

Function should return immediately and send message in background. In case of error appropriate message should be locally sent.

Building tlv structure manually

Library needs to provide easy to use interaface to build tlv buffer

proposed methods:
void init() add(tag t, size_t length, byte[] value) TLV get()

std::list like interface

Proposed structure:
`c++
class TLV {

TLV const * const next_sibling;

TLV const * const first_child

};`

So everything has structure:
image

Enable setting library in client mode

There needs to be single method of signature:

attach(server_ip) -> error_code

that internally connects to server, performs all necessary handshakes and marks it as associated instance (from now on messages sent using enque are sent there).

Function should return once associations finishes successfully or error occurs.

Receiving game message

Client needs to support receiving game messages and correctly forwarding it to game instance.

Processing chat message

Valid chat message needs to be checked against throttling policies and either rejected silently or broadcasted to all associated viewers.

Accept game progress

Game needs to accept game progress provided on stdin changing internal state accordingly.

Displaying errors

ChatAPP needs to provide way for displaying error messages sent on stdin

Waiting for specific tag

libnet should enable functionality akin to

wait_for_tag(tag t) -> tlv

that blocks until appropriate tag is received

Processing game message

Server needs to first check with locally running game instance whether proposed game message is valid and either reject it notifying sender or apply it on locally running game instance and broadcast it to all associated clients.

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.