{"id":15010132,"url":"https://github.com/f4th4n/gen_game","last_synced_at":"2025-04-09T18:07:59.571Z","repository":{"id":154630977,"uuid":"410184207","full_name":"f4th4n/gen_game","owner":"f4th4n","description":"Distributed game server, written in Elixir","archived":false,"fork":false,"pushed_at":"2024-04-08T11:37:18.000Z","size":2789,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-13T21:51:23.713Z","etag":null,"topics":["distributed-systems","elixir","game","game-development"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f4th4n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-09-25T05:25:43.000Z","updated_at":"2024-04-19T13:51:25.289Z","dependencies_parsed_at":"2023-10-24T14:38:43.520Z","dependency_job_id":"ed2b663f-502d-499f-aeb2-6804949a4248","html_url":"https://github.com/f4th4n/gen_game","commit_stats":null,"previous_names":["f4th4n/gen_game"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f4th4n%2Fgen_game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f4th4n%2Fgen_game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f4th4n%2Fgen_game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f4th4n%2Fgen_game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f4th4n","download_url":"https://codeload.github.com/f4th4n/gen_game/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248084305,"owners_count":21045124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distributed-systems","elixir","game","game-development"],"created_at":"2024-09-24T19:30:36.244Z","updated_at":"2025-04-09T18:07:59.541Z","avatar_url":"https://github.com/f4th4n.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\".github/logo.png?raw=true\" width=\"180\"\u003e\n\n[![Hex.pm](https://img.shields.io/hexpm/v/gen_game.svg)](https://hex.pm/packages/gen_game) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/gen_game)\n\n# GenGame\n\n[Read website documentation](https://gengame.rbs8.com)\n\nGenGame is realtime and distributed game server, runs on Erlang VM.\n\nWhether you're building a social network game, MMORPG, or TCG, GenGame helps you create a robust backend game server, offering clients for popular game platforms. It's also extensible with Elixir/Erlang or any HTTP server.\n\n## Features\n\n- **Users** - Register/login new users.\n- **Relay Multiplayer** - Sending a message or event in the match.\n- **Server Authoritative** - Execute custom logic using Elixir/Erlang or any programming language via HTTP server.\n- **Matchmaker** - Let players finding fair match with expressive query.\n\n## Getting Started\n\nLet's discover **GenGame** in less than 5 minutes.\n\nThere are two ways to get GenGame up and running: using Docker or building it from source. We recommend using Docker, as it's easier to manage. Building from source is intended for those who want to develop GenGame further or are interested in understanding how it works under the hood.\n\n### Using Docker (Recommended)\n\nFirst, create a file `docker-compose.yml`.\n\n```yaml\nservices:\n  gen_game:\n    container_name: gen_game\n    image: f4th4n/gen_game:latest\n    environment:\n      DATABASE_URL: ecto://postgres:postgres@postgres/gen_game_prod\n    depends_on:\n      - postgres\n    ports:\n      - 4000:4000\n\n  postgres:\n    container_name: postgres\n    image: postgres:14-alpine\n    healthcheck:\n      test: \"pg_isready -U postgres\"\n    volumes:\n      - postgres:/var/lib/postgresql/data\n    environment:\n      PSQL_HISTFILE: /root/log/.psql_history\n      POSTGRES_PASSWORD: postgres\n      POSTGRES_DB: gen_game_prod\n    ports:\n      - 5433:5432\n\nvolumes:\n  postgres:\n```\n\nThen run the command:\n\n```bash\ndocker compose up\n```\n\nTest by visiting http://localhost:4000/, if you see response below then congratulation, it works:\n\n```json\n{\n  \"status\": \"ok\",\n  \"app\": \"gen_game\"\n}\n```\n\n### Build Yourself\n\nRequirements\n\n1. Elixir\n2. Erlang\n3. Postgres\n\nSteps\n\n1. Clone the \u003cu\u003e[repo](https://github.com/f4th4n/gen_game)\u003c/u\u003e\n2. Copy `.env.example` to `.env`\n3. Update `.env`, fill DATABASE_URL\n4. Run command below:\n\n```bash\nsource .env\niex --sname gen_game --cookie g3ng4m3 -S mix phx.server\n```\n\nTest by visiting http://localhost:4000/, if you see:\n\n```json\n{\n  \"status\": \"ok\",\n  \"app\": \"gen_game\"\n}\n```\n\nthen it works.\n\n## Upgrade\n\nTo update to the latest version of GenGame:\n\nIf you are using Docker, change the tag to the newer version. You can see the full list of tags at [Docker Hub](https://hub.docker.com/r/f4th4n/gen_game).\n\nIf you are building it yourself, pull the newer code from [the repository](https://github.com/f4th4n/gen_game) and then rebuild.\n\n## Client Libraries\n\n#### Unity\n\nIf you're using Unity or any C# application then you should use [gen_game_unity](https://github.com/f4th4n/gen_game_unity) to connect to GenGame server.\n\n#### JavaScript\n\nIf you're using PhaserJS, Cocos2d-x, Construct3, Telegram Game, Facebook Instant Game, or any JavaScript application then you should use [gen_game_js](https://github.com/f4th4n/gen_game_client_js) to connect to GenGame server.\n\n## Extend With Hooks\n\nYou can extend GenGame functionality beyond its capability with **hooks**. Hooks let you run your own function in between events, so you can achieve thing like server authoritative actions.\n\nServer authoritative means server doing some calculation before sending it to the client. For example, your game need to spawn an enemy or calculating damage based on player's armor.\n\nThere are 2 ways to do this.\n\n1. Using Elixir\n2. Using any other programming language\n\nSee the documentation [here](https://gengame.rbs8.com/docs/category/hooks).\n\n## Benchmark\n\nIs GenGame really fast? The main strength of GenGame is not raw speed but concurrent connection. They can handle ~20k concurrent connection with 2 CPU 4 GB memory easily. You can read the whole article how we did this [here](https://medium.com/p/c4e68ae2dc4e).\n\n\u003cimg src=\".github/benchmark.webp?raw=true\"  height=\"250\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff4th4n%2Fgen_game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff4th4n%2Fgen_game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff4th4n%2Fgen_game/lists"}