Nitramite Poker Pocket back end server was developed to run Texas Hold'em games. It's powering Nitramite Poker Pocket game. This back end is pretty lightweight and can run thousands of rooms easily.
Original reason I shared this code here was that I wanted to find someone who wants to create Virtual Reality front end with Unity or any other game development platform. Time has passed so much that I gave up and will no longer develop this further. I also changed license to MIT allowing anyone build anything top of this, but don't expect help from me since I have moved to other things long time ago. I may however sometimes check this repository out to update dependencies.
Here's list of different front end clients. You may want to take a look at them to see what it's all about.
- Sample Web UI: https://pokerpocket.nitramite.com/
- Sample Web UI source code: https://github.com/norkator/Poker-Pocket-Web-Client
- Android client: https://play.google.com/store/apps/details?id=com.nitramite.pokerpocket
- Android client source code: https://github.com/norkator/poker-pocket-android
- Web UI React version: https://github.com/linus2code/poker-pocket-react-client (created by linus2code)
- Download handRanks.dat file
from: https://github.com/christophschmalhofer/poker/blob/master/XPokerEval/XPokerEval.TwoPlusTwo/HandRanks.dat
and place it under/src/app
folder. - Get database platform PostgreSQL https://www.postgresql.org/
- You can also change database to something else, see:
- config.js has some configurations you may want to change.
- create
.env
file with following contents and provide database connection properties.
DB_DIALECT=postgres
DB_USER=database_user
DB_HOST=database_host
DB_DATABASE=PokerPocket
DB_PASSWORD=database_password
DB_PORT=5432
SERVER_CMD_PASSWORD=anypasswd
- Run
npm install
- Run
npm run dev
on development environment (uses nodemon) - Backend is now running.
- Open https://pokerpocket.nitramite.com/ and use connection switch set as
dev
to open connection to localhost web socket.
Optional: If you need created user to play automatically, go to browser console and type:
To create front end, it's essential to know how communication works.
Data transmission itself is build on top of web sockets and every message moves with specific key
name.
I try explain steps in simple way:
- New connection comes from front end.
- Web socket is created and
connectionId
is generated which is basically integer with auto increment. Also webSocket library generatessocketKey
which is also returned and used for verification of requests from front end. - After step 2. front end asks rooms via
getRooms
orgetSpectateRooms
key which is then answered by same key name but result having array of rooms. - Front end renders rooms or spectating rooms and then click is handled by sending
selectRoom
orselectSpectateRoom
key to back end. - User is then appended to selected room and back end will send room parameters with key
roomParams
to render view according to state of room. - All the other actions like calling, raising, folding, getting stats, login, creating account is only a matter of key and parameters needed to call that specific action. I fill more details later but everything is visible at code how to do it.
.gitignore is ignoring HandRanks.dat which is huge file
Before this project used MySQL NodeJS package but
it's now changed to Sequelize to support multiple database platforms.
See https://github.com/sequelize/sequelize for different connectors.
This back end come by default with pg
and pg-hstore
for Postgres.
- Martin K. - Initial work - norkator
- Commits
- Created React version of Web UI
MIT