Giter Site home page Giter Site logo

codacas's Introduction

codacas

Re-implementation of the codacas space war game, illustrating use of Scala with Java NIO, and actors.

Background

This was a popular multi-user game played on the Control Data hardware at Temple University in the early 80s.

Environment

This rendition is setup as a Play 2.3 (typesafe-activator) project. Currently, there is no web-based interaction with the Game and Player actors (but this is planned). The intention is to expand the game to use scala.js on the front-end, and have it connect to the backend using websockets. This will allow streaming of game related events back to the browser in realtime.

Server setup

Currently, the way I've been starting the game server is to run the org.costine.codacas.system.Codacas application with two named parameters -port and -interval.

The -port parameter is the number of milliseconds that the universe will be updated.

For example: org.costine.codacas.system.Codacas -port 2001 -interval 100

That starts the game, and listens on TCP port 2001, and updates the game state every tenth of a second.

I've been loading the application in intellij, and running the class there. Eventually, once this becomes a real Play app, the game engine will be started as a background job.

Another easy way to run the server:

$ play dist

This creates target/universal/codacasng-1.0.zip. Unzip that file somewhere. Then:

$ cd codacasng-1.0/lib
$ java -cp $(echo *.jar|sed 's/ /:/g') org.costine.codacas.system.Codacas -port 2100 -interval 100

"Client" setup

To connect to the game, I currently use netcat (nc) on my MAC (OSX) as follows in a bash script called "codacas":

#!/bin/bash
clear
save_state=$(stty -g)
stty raw -echo
nc localhost 2001
rc=$?
stty "$save_state"
if [ $rc -ne 0 ]
then
        echo
        echo "Game down for maintenance, try again later."
        sleep 5
fi

You can replace the "nc" with telnet, and that should work as well.

codacas's People

Contributors

bmc avatar rcostine avatar

Watchers

 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.