It is a django based website which displays the Counter-Strike servers which are running within the LAN.
Different domains/frameworks which I used within the project are:
- Valve Protocols
- Python Sockets
- Python Concurrency
- Django
- Bootstrap
- JSON encoding
This is the core part of my App which handles the Server Queries over different IPs.
All running game servers can be queried using UDP/IP packets. The packet format and protocols are described here. I used python struct for parsing the binary data obtained over UDP.
- To initialise a connection, we have to send a A2S_INFO query packet to the listening port(27015).
- The server replies with details like Map Name, Game, Players, Max Players, Password Protection ...
- For obtaining the details of each player, we have to send a A2S_PLAYER query packet again. It will reply with score, time and name of each player.
- A2S_RULES is another query type for obtaining more information but has a lot of issues.
- All the bot names and with some predefined suffix. The list is available here. I implemented this check to ensure that no game with a BOT has a contribution to the LeaderBoard.
- To prevent regenerating the exact same web-page I have used cache_page redirective in django
The scan module is also available as a stand-alone python library in PYPI here. You can create your own python library/app by following this easy to understand blog.
- Install Python2, Django==1.7.8 and mysql-python (preferably in a virtual env).
- Create a new DB in mysql and a new user having full access to that DB.
- Copy LPapp/configuration.py.sample to LPapp/configuration.py provide the DB and user details.
- Run ./manage.py migrate.
- Run ./manage.py runserver
- Run by using python manage.py runserver --noreload --insecure ip:port