Hi guys! I’ve been thinking about making a multiplayer(I think 50-150 concurrent players per server) web game as a side project, similar to currently popular .io games. Initially I wanted to do it with Node.js due to my experience with it and ecosystem maturity, but now thinking to implement it in Elixir, as I’ve been learning it for some time and haven’t used for any serious project. The server will need to handle calculations like players bounding, velocity, acceleration and simple gravity. I’ve read that elixir is not very good for high CPU computations and I couldn’t find any physics libraries. Would it be too much to calculate all this in elixir? Or it would be a better idea to do it through NIFs or it is very slow?
The server will need to handle calculations like players bounding, velocity, acceleration and simple gravity.
I think elixir/erlang would be able to calculate that. But something more involved would require using a NIF probably.
I would model each player as a process (maybe a gen_statem) that would keep all information about itself (its position, current velocity and acceleration, life-cycle status). Gravity could probably be expressed as some callback functions acting on these processes’ states called after each process action.
I think it’ll mostly be simple arithmetics, so erlang should do fine.
btw, I think the miniclips’ ios app for agar.io used erlang on the backend, but c++ for the original browser version. Don’t remember how I learned this, but after a little bit of googling I found these “proofs”:
Not to put too fine a point on it, but I recommend that you try it in Elixir, run some timing tests, then optimize with a NIF if you find performance lags.