All Projects → giongto35 → Gowog

giongto35 / Gowog

Licence: mit
Gowog, Golang based Web multiplayer Online Game

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Gowog

Gideros
Gideros Release version
Stars: ✭ 442 (+489.33%)
Mutual labels:  game, game-2d
Lantern
(DEPRECATED, SEE README)
Stars: ✭ 12 (-84%)
Mutual labels:  game, game-2d
Iogrid
Multiplayer game engine/framework built using SocketCluster and Phaser
Stars: ✭ 455 (+506.67%)
Mutual labels:  phaser, websocket
Redrunner
Red Runner, Awesome Platformer Game.
Stars: ✭ 414 (+452%)
Mutual labels:  game, game-2d
Hinterland
2D top-down shooter game
Stars: ✭ 34 (-54.67%)
Mutual labels:  game, game-2d
Phaser Ce Npm Webpack Typescript Starter Project
Project to get you started with your Phaser-CE (using the npm module) game using Typescript and Webpack for building! No hassle asset management, Google Web Font loader, live server, development vs distribution build pipeline, Electron packaging for desktop builds, and more...
Stars: ✭ 414 (+452%)
Mutual labels:  game, phaser
Much Assembly Required
Assembly programming game
Stars: ✭ 869 (+1058.67%)
Mutual labels:  game, websocket
Sulis
Turn based tactical RPG with several campaigns, written in Rust
Stars: ✭ 338 (+350.67%)
Mutual labels:  game, game-2d
Ao Server
Server for Argentum Online
Stars: ✭ 32 (-57.33%)
Mutual labels:  game, game-2d
Beaverandfairies
Stars: ✭ 14 (-81.33%)
Mutual labels:  game, game-2d
Rigelengine
A modern re-implementation of the classic DOS game Duke Nukem II
Stars: ✭ 393 (+424%)
Mutual labels:  game, game-2d
Weixin Minigame Tutorial
Flappy Bird adaptation on Wechat Minigame using PhaserJS + English Wechat Minigames Tutorial
Stars: ✭ 56 (-25.33%)
Mutual labels:  game, phaser
Websocket
simple php websocket server + demos + yii/yii2 integration + php 7 support
Stars: ✭ 363 (+384%)
Mutual labels:  game, websocket
Ebiten
A dead simple 2D game library for Go
Stars: ✭ 5,563 (+7317.33%)
Mutual labels:  game, game-2d
Phaser3 Docs
Phaser 3 Documentation and TypeScript Defs
Stars: ✭ 339 (+352%)
Mutual labels:  game, phaser
Opensc2k
OpenSC2K - An Open Source remake of Sim City 2000 by Maxis
Stars: ✭ 4,753 (+6237.33%)
Mutual labels:  game, phaser
Phaserquest
Reproduction of Mozilla's BrowserQuest using Phaser, socket.io and Node.js
Stars: ✭ 313 (+317.33%)
Mutual labels:  game, phaser
Shapez.io
shapez.io is an open source base building game inspired by factorio! Available on web & steam
Stars: ✭ 4,357 (+5709.33%)
Mutual labels:  game, game-2d
Java Game And Application
Java Games and Application with awesome source code and better algorithm
Stars: ✭ 14 (-81.33%)
Mutual labels:  game, game-2d
Tank island
Top down 2D shooter game that involves blowing up tanks
Stars: ✭ 42 (-44%)
Mutual labels:  game, game-2d

GOWOG, Open source GOlang Web-based Online Game

GOWOG is a multiplayer web game written in Golang. Thanks to Golang, the server can handle a large number of players concurrently.

screenshot

Try the game

Southeast Asia region (Vietnam, Singapore, Malaysia ...)

http://game.giongto35.com

Due to the cost of hosting. The server is hosted only on SEA.

AI Experiment on the Agent

As the server, client and messages are decoupled, it is easy to communicate with backend. Below is my AI agent written in Python that learns to interact with environment. This experiment is to find a path in a maze using neuroevolution

https://www.youtube.com/watch?v=pWbb1m91mhU

The implementation is at gowog/ai

Local

You can try the game on local by running ./run_local.sh. It will build a docker environment and run the game on port 8080.

Open the browser "localhost:8080"

Development

screenshot

The game contains two part: Server and Client. Server uses Golang and Client uses Node.JS and Phaser game engine.

Server

Install Golang https://golang.org/doc/install

Install dependencies

  • go get github.com/gorilla/websocket
  • go get github.com/golang/protobuf/protoc-gen-go
  • go get github.com/pkg/profile

Run the server. The server will listen at port 8080.

Go to gowog folder

  • go run server/cmd/server/*

Client

Install NodeJS https://nodejs.org/en/download/

Go to gowog/client folder

Install dependencies

  • npm install

Run the client. The client will listen at port 3000. env.HOST_IP is the IP of gowog server which is localhost:8080 now.

  • npm run dev -- --env.HOST_IP=localhost:8080

Open the browser "localhost:3000"

Note:

In development we run client on port 3000 and server on port 8080 separately.

In production and docker environment, the client is built and golang server will return client page on the same port 8080. Therefore, if we run docker environment, the game will start at "localhost:8080" in browser.

Communication convention

Communication packages between server and client is based on protobuf. Install protoc for protobuf generate.

Everytime you change package singature in /sertver/message.proto. Run

  • go to gowog/server

  • /generate.sh

Document

Frontend

Backend

AI

FAQ

Why we need Golang for multiplayer game?

Building a massively multiplayer game is very difficult and it's currently overlooked. You have to ensure the latency is acceptable, handle shared states concurrently and allow it to scale vertically. Golang provides a very elegant concept to handle concurrency with goroutine and channel.

Why the gameplay is so simple and frontend codebase is so unorganized?

The gameplay is mainly for demonstration purpose. My goal is to keep the game simple as current and scale number of players vertically while maintaining good latency (< 100ms). I welcome all of your ideas to make the game more scalable.

However, I'm still open to Graphic improvement and client codebase refactor. I would love to see some particles burst or glow, motion effects. Remember that different people have different perspective on how the game should look, so we need full consensus before making ui change.

Why protobuf?

To optimize package size, we need to compress it into binary. Protobuf offers fast language-neutral serialization and deserilization, so Golang server can communicate with JS client in an optimal way.

We can consider faster serilization format like Cap'n Proto or FlatBuffers.

Why the multiplayer game is not room-based (less than 20 players per game)

In my opinion, room-based is less challenging because each room is totally separated from each other and we can scale the game easier by adding more instances. This repo is to illustrate how many players the game can serve on one multi-core single machine.

And of course my ultimate goal is to make the non room-based game scale vertically by adding more instances.

Contribution guidelines

I'm looking forward to have your contribution to GOWOG, which can help the game smoother and more scalable. If you have any ideas to improve game performance, please discuss in this issue Discussion.

I also welcome frontend improvement like codebase reorganization, performance enhancement. In the case you want to improve the UI, please create an issue to show the new design so we can make an agreement on that.

As my desire is to utilize Golang concurrency paradigm to achieve smooth gaming experience with massive number of players, I will keep the gameplay simple. Player can move around and shoot each other. Any gameplay changes are not accepted.

Credits

https://github.com/gorilla/websocke/blob/master/examples/chat

https://github.com/RenaudROHLINGER/phaser-es6-webpack

https://github.com/huytd/agar.io-clone (My inspiration)

LICENSE

MIT License

Contributor

Nguyen Huu Thanh
https://www.linkedin.com/in/huuthanhnguyen/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].