Code Monkey home page Code Monkey logo

glcd's People

Contributors

cantsin avatar captdeaf avatar johansson avatar nulltone avatar pharaun avatar timkettering avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

glcd's Issues

Chat commands

Add a chat command which takes, as data, { message: "..." }, and bounces it to all connected players.

This is close to the "wall" command, but in theory, "wall" will be used for lower, system-level communication. "chat" will be used for actual chatting.

Player State saving

When a player disconnects, they may be at a very different position from player start.

When player sends "connected" command, send them a player state for themselves that will set their state to the last saved state for said player, using command "setPlayerState"

This will also need a bit of work on glc-client side.

Making incoming messages type safe.

Every "Message" from a client is of the following JSON structure:

{
client: string,
data: json blob,
command: string,
name: string
}

Currently, "Message" is defined as a catch-all map to interface. Instead, ensure all incoming messages on glcd-server match the above structure, and respond with error if it differs. json.Unmarshal should be able to do a lot of this for you.

Add and save "name" to GLCClient structure

client is "ip:port:ip-username", but glc-client will also send a "name" field with only the name. This is likely to be separate from username in the future.

Add "name" to the GLCClient structure, and save it back to it.

Player Store and Player Authentication

Don't allow unauthenticated players to do anything other than heartbeat or use the command "playerAuthenticate".

Write "playerAuthenticate" command, which takes user+pass in the data.

Use a mongo table, "users", which contains user information.

{
user: string
password: string
}

Pick a strong hashing algorithm for the password, and include any other information needed (such as salt) in the json object.

playerList command

Add a command, "playerList", which returns a list of names and client ids of all glcd.Clients. "Who's Online?"

Saving and loading player state on restart

On a clean start, glcd doesn't have any player state. But if we send serverRestart, it can take a long time before it gets all player state up to date. Save playerstates to a temporary file, and pass the filename to glcd as an argument to load player state into.

docker configuration setup

Currently our home grown restart script looks like this:

GOPATH="$HOME/go"
GOBIN="$GOPATH/bin"

pkill -f "$GOBIN/nsq"
cd $HOME/nsq

exec 1> "$HOME/nsq/stdout"
exec 2> "$HOME/nsq/stderr"

"$GOBIN/nsqlookupd" -http-address="0.0.0.0:4161" -tcp-address="0.0.0.0:4160" &
"$GOBIN/nsqd" -http-address="0.0.0.0:4151" -tcp-address="0.0.0.0:4150" -lookupd-tcp-address="127.0.0.1:4160" -max-heartbeat-interval=30s &
"$GOBIN/nsqadmin" -lookupd-http-address="0.0.0.0:4161" &

Make this work in docker.

MOTD and on connect

Add a configurable, cosmetic option to glcd.config: [server] with "name" and "motd".

On connect, send, as "message" commands:

"Welcome to <configure'd name>"
"GameLostCrash Server"
""
"There are currently players connected"

Add a command "setMOTD" which overrides the configured MOTD. Whenever the server receives "connected" command, send the MOTD string.

More modular command lookup

Right now, command lookup is just a series of if (command == "..."), etc.

Create a directory containing multiple .go files that will do the actual handling of the commands, to make it more modular, and replace the if (...) checks with a map[string]:func(...) or similar, as you prefer.

glcdbot.go and bot3server

Create a glcdbot.go interface which connects to glcd as a player (without ever sending playerState or connected).

Then using glcdbot.go, create a bridge for bot3server and glcd, so when your bot receives a chat command, it passes that on to bot3server and bounces bot3server's responses back as chat messages as well.

Restart

Add a "serverRestart" command which causes glcd to shut down and relaunch itself.

Add a config option: [server] admins = comma,separated,names

Only admin are allowed to issue serverRestart.

glc-client should notify on clean exit

When a client exits, its player state hangs around until its hearbeat times out. Add a "playerQuit" command which immediately clears the sender's state and informs everyone else of "playerGone".

Mongo error checking

Not much error checking and stability is performed with accesses to+from mongo. Make it solid. Make it safe.

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.