0
\$\begingroup\$

I'm a little confused on when it's needed to bring in Mongo or MySQL in a web browser multiplayer card game.

Here's my plan so far: I'm using React, Node.js, Express, and Socket.io. I'm having the user enter a username and creating a randomly generated room code that other players can type in and join with. This username and room code (upon create and join) is sent to my socket in the backend, where the game logic will exist (creating game, starting game, managing turns, etc.) and a Player object will be created (containing username and room code)

I'm confused about how all the different rooms will be managed though. Is it sufficient to just store an array of rooms and array of Players in my backend code?

I'm getting kind of lost on how the backend should be managed, especially because since cards are hidden, I need all the game logic in the backend too. I'm not planning on having users login and have accounts or anything either.

\$\endgroup\$
2
  • 4
    \$\begingroup\$ If it's a simple game and all the data fits in memory, there's a single server, and you don't care if the data is lost if the server application restarts, then you don't need a database. Databases are mainly for persisting data. \$\endgroup\$ Commented Feb 2, 2024 at 23:08
  • 1
    \$\begingroup\$ @ggorlen that looks like something you could post as an Answer below. I'd upvote it. \$\endgroup\$ Commented Feb 3, 2024 at 2:14

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.