Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Multiplayer, real-time, and cross platform racing game powered by PubNub

NotificationsYou must be signed in to change notification settings

chandler767/Space-Race

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiplayer racing game powered byPubNub.

Multiplayer Gaming Revenue 2016

Playing a game alone is not nearly as fun as playing with your friends and that's one reason why massively multiplayer online games (MMOs) are a huge revenue stream that continues to grow rapidly every year. In June 2018consumers spent an estimated $9.1 billion digitally across all platforms [on MMOs], compared to $7.9 billion last June.

The design of online games can range from simple text-based environments to incredibly complex virtual worlds. A few other examples of popular online multiplayer games types include first-person shooters (FPS), real-time strategy games (RTS), and multiplayer online battle arena games (MOBA).

This project is intended to show how PubNub can be used to create a real-time multiplayer game.PubNub is perfect for powering multiplayer games because it makes it easier to build a fast and scalable multiplayer game. In this game PubNub is used to manage the players in the game lobby and to transmit game data. The game is built in Go using thePubNub Go SDK and is cross platform. You can learn more about how this game was built from theblog post.

PubNub usage in Space Race

Getting Started

Quick Start

The fastest way to get started is todownload and run the appropriate binary for your OS. You don't need to install Go or any dependencies to run the game. See the 'How To Play' section below to get racing.

Space Race Demo

Building From Source

  • Want to learn more about this project or build a clone from scratch? Check out theblog post.
PubNub BlogPubNub Signup
  1. Install the latest version ofGo and setup your $GOPATH.

  2. Download the dependencies.

go get github.com/pubnub/gogo get github.com/gosuri/uiprogressgo get github.com/nsf/termbox-go
  1. Clone the Repo.
git clone https://github.com/chandler767/Space-Race
  1. Get your unique PubNub keys from thePubNub Developer Portal. If you don't have a PubNub account, you cansign up for a PubNub account for free.

  2. Enable the channel presence feature for your keys. Presence can be enabled per key in youraccount dashboard.

  3. Openmain.go and replace "pub-key" and "sub-key" with your keys.

  4. Build and run the game.

make run

OR

make build./space-race

Space Race Game

How To Play

  1. The first player to enter a lobby becomes the host. The second player to enter becomes the guest.

  2. Both players need to enter the same lobby name.

  3. When both players have joined a lobby the game will start after a 3 second delay (get your fingers ready).

  4. After the game starts, alternate pressing SPACE and the RIGHT ARROW KEY to advance your progress bar.

  5. The first player to 100% wins the game.

  6. You can leave the game while playing by pressing ESC. If you leave the game then the other player wins automatically.

Space Race Game

Limitations

  • If the terminal window is too small, or if the font is too big, the progress bars won't render correctly. Make the window bigger and then press command+k to refresh.

  • The lobby is kept simple by design so it can be used as a seed project. The lobby may not always be able to start a game in some edge cases. If you have problems starting a game try restarting the game for both players and use a new lobby name.

Have suggestions or questions about this project? Reach out at devrel@pubnub.com.


[8]ページ先頭

©2009-2025 Movatter.jp