Skip to content

Commit

Permalink
Merge pull request #8 from Unity-Technologies/chore/restructure
Browse files Browse the repository at this point in the history
chore: Restructure repository for multiplay-samples
  • Loading branch information
nweedon-u authored Nov 12, 2021
2 parents 49c04c3 + 1e6db09 commit 0ce8539
Show file tree
Hide file tree
Showing 27 changed files with 54 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-and-release
name: simple-game-server-go
on:
pull_request:
push:
Expand All @@ -7,6 +7,9 @@ permissions:
jobs:
goreleaser:
runs-on: ubuntu-latest
defaults:
run:
working-directory: './simple-game-server-go'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -20,23 +23,26 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
version: v1.39.0
working-directory: './simple-game-server-go'
- name: Build
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/') == false
with:
distribution: goreleaser
version: latest
args: build --rm-dist --snapshot
workdir: './simple-game-server-go'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: 'go test -timeout=5m -race -v ./...'
- name: Release
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
if: ${{ startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, '-simple-game-server-go') }}
with:
distribution: goreleaser
version: latest
args: release --rm-dist
workdir: './simple-game-server-go'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 0 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,2 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
.DS_Store
.idea

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories
vendor/

# Build output
dist/
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
# mp-game-server-sample-go
# Multiplay Examples

This repository represents a sample game server capable of running on the [Unity Multiplay platform](https://unity.com/products/multiplay).
The [prebuilt releases](https://github.com/Unity-Technologies/mp-game-server-sample-go/releases) are ready for you to upload to Multiplay to try out the service without writing a single line of code!

The capabilities of this sample are as follows:

- Handling of [Multiplay allocation lifecycle](https://docs.unity.com/multiplay/Content/shared/allocation-flow.htm)
- Achieved by watching for file events on the provided configuration file
- When allocated, the sample starts a TCP server on the configured `Port` which listens for client connections
- When de-allocated, this TCP server is stopped
- Dynamic server query results
- Data such as number of players, map name, etc. are handled appropriately
- `sqp` and `a2s` query protocols over the configured UDP `QueryPort`
[Unity Multiplay](https://unity.com/products/multiplay) is a platform for hosting and scaling dedicated game servers. This repository contains a set of examples for interacting with the services and APIs that Multiplay provides.
Visit one of the sub-directories to see more information on each sample.

---
_Disclaimer: The repo owners will not (cannot) accept pull requests, GitHub review requests, or any other GitHub-hosted issue management requests._
18 changes: 18 additions & 0 deletions simple-game-server-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories
vendor/

# Build output
dist/
File renamed without changes.
1 change: 1 addition & 0 deletions .goreleaser.yml → simple-game-server-go/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
project_name: simple-game-server-go
before:
hooks:
- go mod tidy
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions simple-game-server-go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Simple Game Server (Go)
A very simple game server designed to demonstrate and test running a game server on the [Unity Multiplay platform](https://unity.com/products/multiplay).

The [prebuilt releases](https://github.com/Unity-Technologies/multiplay-examples/releases) are ready for you to upload to Multiplay to try out the service without writing a single line of code!

The capabilities of this sample are as follows:

- Handling of the [Multiplay allocation lifecycle](https://docs.unity.com/multiplay/Content/shared/allocation-flow.htm)
- Achieved by watching for file events on the provided configuration file
- When allocated, the sample starts a TCP server on the configured `-port` flag which listens for client connections
- When de-allocated, this TCP server is stopped
- Dynamic server query results
- Data such as number of players, map name, etc. are handled appropriately
- `sqp` and `a2s` query protocols over the configured UDP `-queryport` flag
2 changes: 1 addition & 1 deletion go.mod → simple-game-server-go/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Unity-Technologies/mp-game-server-sample-go
module github.com/Unity-Technologies/multiplay-examples/simple-game-server-go

go 1.17

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion main.go → simple-game-server-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os/signal"
"path/filepath"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/game"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/game"
"github.com/sirupsen/logrus"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
"time"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto"
"github.com/sirupsen/logrus"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"syscall"
"time"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto"
"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto/a2s"
"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto/sqp"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto/a2s"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto/sqp"
)

type (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
"sync/atomic"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto"
)

type (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sqp
import (
"sync/atomic"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto"
)

type (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"encoding/binary"
"sync"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto"
)

type (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/Unity-Technologies/mp-game-server-sample-go/pkg/proto"
"github.com/Unity-Technologies/multiplay-examples/simple-game-server-go/pkg/proto"
"github.com/stretchr/testify/require"
)

Expand Down

0 comments on commit 0ce8539

Please sign in to comment.