gamelost / glcd Goto Github PK
View Code? Open in Web Editor NEWglc server daemon for world state.
License: Other
glc server daemon for world state.
License: Other
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.
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.
"ping" triggers a message back to individual client.
"wall" bounces a message to every client.
Add "playerMessage" command to send a message to a specific player, using client id
We should have proper logging mechanisms so we don't have to comment out logging.
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.
When a player disconnects from glcd, nobody else is aware of it, the player just sits
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.
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.
supervisor trees are a concept taken from erlang; basically, they decentralize the app and allow the app to crash and recover. see https://github.com/thejerf/suture for a go implementation. thoughts?
Add a command, "playerList", which returns a list of names and client ids of all glcd.Clients. "Who's Online?"
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.
we need this for docker. cl params should override whatever is in the config.
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.
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.
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.
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.
I sent a test data "hi" and it crashed the server, should make it at least attempting to resist such errors.
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.
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".
Not much error checking and stability is performed with accesses to+from mongo. Make it solid. Make it safe.
nsqd is crashing, yikes!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.