Any tips on creating a multi-user poker site?

Hello Everyone,

Been lurking here for a while and learning quite a lot I have been building a few different sites and wanted to extend my single player Poker site to head to head players, or even a poker room.

I’ve deployed with LiveView and Fly.io.

What are your suggestions for ways to do this. Know of any blogs that talk about this? I know this is open ended but I just wanted to get a discussion started and become part of the community.

1 Like

Modules within Phoenix to get familiar with:

  • Phoenix.Presence for tracking players/commentators/watchers
  • Phoenix.Channels for bi-directional client <—> app communication which LiveView builds on top of
  • Phoenix.PubSub for pub/sub which Channels builds on top of

There’s too many “build a chat room with Phoenix LiveView” posts to list, but they should help stitch together the concepts above. There’s even a handful of “shared canvas cursor tracking” posts if you want a non-text centric example of soft real time communication using Phoenix LiveView.

At a more foundational level, dive into OTP itself e.g. from a Process to a Genserver and how it empowers you to draw a line between runtime concerns and thought concerns as expressed in this oldie but a goodie post To spawn, or not to spawn? that walks through modeling blackjack in OTP as an example.

And on the experimental fun side, OTP makes it fun to prototype novel interactions in my experience. Take a look at the interaction design of couch party games for inspiration!

2 Likes

For this kind of problem where you have “tables” or “rooms” in a game, you will often want to reach for the Dynamic Supervisor.

Docs here: DynamicSupervisor — Elixir v1.19.5

Hopefully that should serve as some inspiration for you :innocent:

1 Like

Yeah, my tip is: don’t create gambling website. At least make sure that there is no conversion between game currency and real money

2 Likes

Thanks everyone. I already started with a GenServer and Lobby for making rooms. I have a blog that I keep track of the progress. Will get into PubSub and Channels once I have the framework for the all the interactions within the room.

Feel free to check it out if anyone wants to see the progress.

It’s live if anyone want to check it out. You will need at least 2 people and one logged in person. If the host leaves the room then the room is stopped. Any questions let me know.