Code Monkey home page Code Monkey logo

sdl2-network-pong's Introduction

sdl2-network-pong

A SDL2 implementation of the classic Pong game with a simple network support.

Contains a single mode where two human players can play againts each other.

Contains a single scene.

Features

This Pong implementation contains the following features.

  • A support for TCP and UDP transport protocol.
  • Each launched game instance acts either as a server or client.
  • Each game lasts until either player receives the 10th point.
  • Both paddles are controlled by human players.
  • Ball velocity is increased on each hit with a paddle.
  • Ball movement is being stopped for ~1 second after each reset.
  • Ball direction is randomized from four different direction after each reset.
  • Paddles are returned to their default position after each reset.

External Dependencies

This implementation has external dependencies on the following libraries:

  • SDL2
  • SDL2net

Compilation

Easiest way to compile the code is to use the provided Makefile.

Makefile may require some modifications based on the compilation environment.

Usage

Game startup syntax is as following.

pong.exe [transport-protocol] [host]

An example to start a TCP server.

$ pong.exe tcp

An example to start a TCP client and connect to a localhost.

$ pong.exe tcp localhost

Notes

There are some major notes and bugs in the current implementation:

  • Implementation uses remote lag as the latency compensation mechanism.
  • Implementation has some minor timing problems (shown as jittering) at the start.
  • Implementation does not include reliability control for UDP.

Screenshots

alt text

sdl2-network-pong's People

Contributors

toivjon avatar

Stargazers

catsocks avatar

Watchers

James Cloos avatar  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.