tf2stadium / helen Goto Github PK
View Code? Open in Web Editor NEWChief backend API server for TF2Stadium
Home Page: https://api.tf2stadium.com/
License: GNU General Public License v3.0
Chief backend API server for TF2Stadium
Home Page: https://api.tf2stadium.com/
License: GNU General Public License v3.0
Right now, when you're in a lobby spot and you try to join a spot in a different lobby, you'll get an error saying "Player is already in a lobby". I suggest that Helen removes the player from his original spot and lets him join the new lobby.
See Title, switching slot works proper (Get removed from old, get placed in old), however, the lobby does not remove me from other lobbies.
Users need to be timed out and removed from lobby slots if they have no active websocket connections for some period of time (2 minutes-ish?)
When clients send lobbyJoin, they tend to receive multiple redundant messages (described below) (all before the lobbyJoin response).
This includes (sometimes duplicated) copies of the lobbyData with them not in their old slot, and then (again, sometimes duplicated 2+ times) copies of the lobbyData with them in their new slot.
Interspersed are also multiple lobbyListData messages.
If possible, make it either:
name
(e.g. AsiaFortress
) and value
(asiafortress
).At the moment, the Frontend is managing the entire list of options to create a lobby (formats, maps, leagues...). Ideally, Helen should provide it instead. The exact structure of the returned JSON may vary, but check the current code we use for it:
Have a server model that would use the Rcon wrapper and have functions like verify
and setup
. Find a place to store configs, read them and execute them during setup. (the wrapper has a method ExecConfig(config string))
Sending lobbyKick
with ban=true
should return an error if the steamid
is empty or equal to the sender. In other cases, a new leader should be assigned (I suggest that if a user with role admin
or moderator
bans the lobby leader, he gets assigned as the new leader).
Right now, you only get the chat history of a lobby when you join a slot in it. What should happen is that you receive it when you join the Public Room.
Build Helen with go build -race
, execute the generated binary.
Complete data race info from the Go data race tool:
WARNING: DATA RACE
Read by goroutine 9:
runtime.mapaccess2()
/build/go/src/go-1.5.1/src/runtime/hashmap.go:320 +0x0
github.com/jinzhu/gorm.(_Scope).GetModelStruct()
/home/vibhavp/go/src/github.com/jinzhu/gorm/model_struct.go:94 +0x2f5
github.com/jinzhu/gorm.(_Scope).GetStructFields()
/home/vibhavp/go/src/github.com/jinzhu/gorm/model_struct.go:380 +0x41
github.com/jinzhu/gorm.(*Scope).GetModelStruct.func1()
/home/vibhavp/go/src/github.com/jinzhu/gorm/model_struct.go:291 +0x656c
Previous write by main goroutine:
runtime.mapassign1()
/build/go/src/go-1.5.1/src/runtime/hashmap.go:411 +0x0
github.com/jinzhu/gorm.(_Scope).GetModelStruct()
/home/vibhavp/go/src/github.com/jinzhu/gorm/model_struct.go:372 +0x1037
github.com/jinzhu/gorm.(_Scope).TableName()
/home/vibhavp/go/src/github.com/jinzhu/gorm/scope.go:282 +0x2f6
github.com/jinzhu/gorm.(_Scope).autoMigrate()
/home/vibhavp/go/src/github.com/jinzhu/gorm/scope_private.go:586 +0x52
github.com/jinzhu/gorm.(_DB).AutoMigrate()
/home/vibhavp/go/src/github.com/jinzhu/gorm/main.go:411 +0xf5
github.com/TF2Stadium/Helen/database/migrations.Do()
/home/vibhavp/go/src/github.com/TF2Stadium/Helen/database/migrations/migrations.go:13 +0x13f
main.main()
/home/vibhavp/go/src/github.com/TF2Stadium/Helen/main.go:33 +0x62
Goroutine 9 (running) created at:
github.com/jinzhu/gorm.(_Scope).GetModelStruct()
/home/vibhavp/go/src/github.com/jinzhu/gorm/model_struct.go:370 +0xfc1
github.com/jinzhu/gorm.(_Scope).TableName()
/home/vibhavp/go/src/github.com/jinzhu/gorm/scope.go:282 +0x2f6
github.com/jinzhu/gorm.(_Scope).autoMigrate()
/home/vibhavp/go/src/github.com/jinzhu/gorm/scope_private.go:586 +0x52
github.com/jinzhu/gorm.(_DB).AutoMigrate()
/home/vibhavp/go/src/github.com/jinzhu/gorm/main.go:411 +0xf5
github.com/TF2Stadium/Helen/database/migrations.Do()
/home/vibhavp/go/src/github.com/TF2Stadium/Helen/database/migrations/migrations.go:13 +0x13f
main.main()
/home/vibhavp/go/src/github.com/TF2Stadium/Helen/main.go:33 +0x62
If the player connection to the backend drops for any reason and the lobby is in the ready-up state or has already started, the Frontend will never receive those requests and it'll be impossible to retrieve the information.
Alternatively, and I think this is a better solution, send the lobby connection information in lobbyData, but only to the players, and only if the lobby has already started. That way we can avoid non-players getting the info to attack the lobby.
RoR description: "The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass and ERB."
As for golang, https://github.com/shaoshing/train looks like an all-around good system for that so I think integrating it would be a good choice. If that doesn't work, SASS compilation (and probably fingerprinting) would need to be added manually.
The current idea is to use gulp for that.
Both for the lobby leader and for a user with the administrator role, but it works on the player itself.
For example (with the wsevent wrapping):
Send: {"id":"1","data":{"id":6,"team":"blu","class":"scout","request":"lobbyJoin"}}
Receive: {id":"1","data":""{\"data\":{},\"success\":true}""}
Where as the following would be expected:
Send: {"id":"1","data":{"id":6,"team":"blu","class":"scout","request":"lobbyJoin"}}
Receive: {id":"1","data":"{"data":{},"success":true}"}
(and really, the fact that data is an object client->server but a string server->client is quite inconsistent)
If a user is spectating a lobby and is a player at the same time, the lobby gets closed and he leaves the lobby via lobbySpectatorLeave
, Helen will answer with "Player not spectating".
This creates an issue in which the lobby chat will not update if the user is in another page.
UGC + gcommer's server didn't work.
A client that sends lobbyJoin and then lobbySpectatorJoin (for the same lobby id) will receive a single lobbyData message, but then no more. This behavior can be demonstrated on the current frontend by clicking to join a lobby slot directly from the lobby list.
Possibly due to #108.
While setting up a server, we can encounter the follow errors:
passErr := s.Rcon.ChangeServerPassword(s.LobbyPassword)
kickErr := s.KickAll()
cfg, cfgErr := config.Get()
configErr := s.ExecConfig(config)
mapErr := s.Rcon.ChangeMap(s.Map)
These errors need to appropriately converted to TPError
type and sent to the user. In case of errors like mapErr
, a correct map needs to be taken by the user, and then changed.
Currently, chat history is sent via several chatReceive
on connection. I suggest creating a new request for this case that holds all those messages.
Currently, when a lobby has both a player whitelist and a password, you need to be in the whitelist and enter the correct password. It needs to be whitelist OR password.
In order to receive the role of the sender it would be useful that also the sender of the chatSend event receives the chatRecevie event. Alternative would be to send the data in the callback?
It's now at 5 mins, it could be lowered to 2-3 mins.
Currently sockets are only added to rooms after lobbyJoin messages. This is bad if the server or a client temporarily loses connection and reconnects - we should add new sockets to rooms they should belong to on connection
We need to support logging in through steam. For now, this task includes successfully logging in and retrieving the authentication token; integration with the rest of the system will come later
This might help: https://github.com/yohcop/openid-go
Both fields of region
(code
and name
) are the same.
The client should receive every message from a lobby/general chat up until a certain number on connection. That way we can show the chat history.
lobbyJoin
, make them join the PRIVATE ROOM, on lobbySpectatorJoin, make them join the PUBLIC ROOMAlso, you don't get removed from the spots you're already in, which means you can open a lobby, close it, then fill every single slot by yourself, receive lobbyReadyUp and start the lobby with one player.
We still have to implement a way that a player can change his slot in a lobby he already joined.
Currently those messages are sent strictly to the related parties (and sometimes not even then: eg if a player gets kicked by lobby leader, the kicked player doesn't get a lobbyKick message, he just gets new lobbyData without him in his slot).
It would be both more efficient to only send the changed data, and makes things significantly easier for the frontend.
Work on setting up some kind of deployment pipeline. A CI system would be ideal, but a nice build and run script would be enough for now.
The slots aren't supposed to contain player information (only filled
).
We'll use mongodb for persistent storage. You need to integrate http://labix.org/mgo with the project and write a few examples (like saving and loading player models from the database) (the player model is definitely not yet finalized so don't spend a lot of time on that - just make sure it works)
When being a player in a lobby and receiving its updates, the message sent by the server does not contain a envelop/event name?
WebSocket extract:
42["lobbyListData","{\"lobbies\":[{\"classes\":{\"demoman\":{\"blu\"[...]
LobbyData:
42["{\"classes\":{\"demoman\":{\"blu\":{\"name\":\[...]
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.