Need advice on actions before joining a room
-
I want to allow a player to create an account and login. The player will be able to unlock character classes and I want to make these available before the payer enters a room (battle).
Is there a way to achieve this before a room is made or should I just make a "lobby room" to handle this? Any tips on transferring data from the lobby room to the "battle" room? For example the chosen character class and what characters a player is allowed to choose from?
I've also not decided on any database tech yet so any advice here would be welcome.
-
Hi @plyoung!
You can make regular HTTP requests to achieve that.
Through
express
, you can create a route that will respond with the list of available characters, for example:app.get("/characters", (req: express.Request, res: express.Response) => { // TODO: query the database here res.json([ { id: 1, name: "Warrior", ... }, { id: 2, name: "Mage", ... }, ]); });
For the database, I'd suggest using MongoDB, which is schemaless and pretty easy to get running. You can also use a SQL database such as MySQL and use Sequelize which has a nice abstraction layer.
Cheers!