Recommendations for elixir backend and c++ desktop frontend

Hi Elixir community,

I’ve looked at several ways of communicating between an elixir backend + Unreal Engine server and a C++ front end for games. In particular, trying to create a prototype in Unreal Engine.

Looked at grpc, thrift, json + rest and flatbuffers + zeromq.

  • GRPC doesn’t have a production level elixir client/server and Windows c++ grpc is ridiculously hard to build.
  • Thrift has a production level elixir client / server, but I had trouble adding the library to the game project. This is one of the leading choices.
  • Json + rest is a standard, but there’s no schema to validate and upgrade versions.
  • Flatbuffer exists as eflatbuffers and zeromq is a production level service.It has schema! However, one is required to write a custom rpc interface.
  • Others…

Here’s an example service.

dobydigital248 days ago (Edited 4 times)

  1. Use to get information about the player (I’m assuming you’re already doing this)
  1. Then call the API described here to verify the user is legit (if your game requires a user to have purchased the game, or obtained a key from you some other way)
  1. You should now be confident in your game client that your user is valid (and owns the copy of the game if you decided to do #2). You should be able to pass the same ITCHIO_API_KEY environment variable to the server, and have the server also perform #1 & #2 again so it can also trust the player is legit. The key is valid until ITCHIO_API_KEY_EXPIRES_AT environment variable so you should be able to auth using that key until it expires. I don’t yet know how long that timeframe is though.
  1. The player launches the game and sends the env variable to the backend as a service.
  2. The backend server sends back a token to the player with a valid username + a crypto token.
  3. The player uses the token to request a list of servers.
  4. The Backend sends a list of servers and metadata like amount of players etc.
  5. The player uses the token to join a server.

What do you recommend?

1 Like

What I’ve done multiple times in the past (though with erlang instead of elixir) is just use my own size/id-prefixed (in that order, size then type) TCP/UDP protocol, it is so stupid-simple with how easy the BEAM makes it that I’ve never really thought to do otherwise if I control both sides, especially if you can just map it straight to C structs (versioning is handled by just making a new ID tag, etc…). ^.^

If you want something more compressed and simple gzipping does not work well enough for you then I’d pick flatbuffers probably, if it has an erlang/elixir backend that?

Icecreamcohen mentioned using bert over http/2.

It’s an interesting idea.

He was also confused at writing a custom protocol. He recommends to not write a custom protocol.

Do you know how difficult it is write a phoenix plug that takes either json or bert or flatbuffers and responds?

References: - Plug for protocol buffers