A home for experiments for muddle.run
MIT License
A home for experiments for muddle.run.
https://user-images.githubusercontent.com/2943388/125176134-cb4e6f00-e1d9-11eb-8fc8-6d9aa5c09583.mp4
Currently, the project represents the very bare-bones of the game I'm trying to build: a multiplayer runner with a collaborative level editor, which will also allow players to test levels while they are being designed.
This application can be run in either UPD, or WebRTC mode. The workspace contains the following binary projects:
mr_dekstop_client
mr_web_client
mr_server
mr_matchmaker
mr_persistence
# Running the server
# (Note that 127.0.0.1 might not work for Windows, you can use your local network ip instead, like 192.168.x.x)
# (See https://github.com/naia-rs/naia-socket/issues/24)
MUDDLE_PUBLIC_IP_ADDR=127.0.0.1 MUDDLE_LISTEN_PORT=3455 cargo run -p mr_server
# Running the client
cargo run -p mr_desktop_client
# Running the server
# (Note that 127.0.0.1 might not work for Firefox, you can use your local network ip instead, like 192.168.x.x)
MUDDLE_PUBLIC_IP_ADDR=127.0.0.1 MUDDLE_LISTEN_PORT=3455 cargo run -p mr_server
# Running the client
cd bins/web_client
wasm-pack build --target web
basic-http-server . # or any other tool that can serve static files
DATABASE_URL=postgres://postgres@localhost/mr_persistence_development sqlx database setup
Environment variables are read when both compiling the binaries and running them (except for the web client). The environment variables that are read during the run-time take higher priority.
Dotenv files are also supported. They are recursively searched down to the root starting from a working directory. The binaries search for the following files:
Every found file is loaded, and all read variables are merged. Priority is defined as in the list above, where the most specific dotenv file overrides the vars from the other ones.
MUDDLE_ENV
equals production
when compiling with the release profile
and development
when compiling with the debug one. It can be overridden
with an environment variable.
mr_server
MUDDLE_PUBLIC_IP_ADDR
(mandatory if outside Agones cluster)
0.0.0.0
, use 127.0.0.1
if you want to connect to localhost, for instance.127.0.0.1
might not work for Firefox, you can use your local network instead, like 192.168.x.x
.MUDDLE_LISTEN_IP_ADDR
(defaults to 0.0.0.0
)MUDDLE_LISTEN_PORT
(mandatory if outside Agones cluster)MUDDLE_IDLE_TIMEOUT
(defaults to 300)
MUDDLE_PUBLIC_PERSISTENCE_URL
(optional)MUDDLE_PRIVATE_PERSISTENCE_URL
(optional)MUDDLE_GOOGLE_WEB_CLIENT_ID
(mandatory if persistence urls are set)MUDDLE_GOOGLE_DESKTOP_CLIENT_ID
(mandatory if persistence urls are set)MUDDLE_AUTH0_CLIENT_ID
(mandatory if persistence urls are set)mr_desktop_client
and mr_web_client
MUDDLE_SERVER_IP_ADDR
(defaults to 127.0.0.1
)MUDDLE_SERVER_PORT
(defaults to 3455
)MUDDLE_MATCHMAKER_URL
(optional)
MUDDLE_SERVER_IP_ADDR
and MUDDLE_SERVER_PORT
are still read,MUDDLE_SERVER_IP_ADDR
is passed explicitlyMUDDLE_PUBLIC_PERSISTENCE_URL
(mandatory if MUDDLE_MATCHMAKER_URL
is set)MUDDLE_GOOGLE_CLIENT_ID
(mandatory if MUDDLE_MATCHMAKER_URL
is set)MUDDLE_GOOGLE_CLIENT_SECRET
(mandatory for the desktop client if MUDDLE_MATCHMAKER_URL
is set)
MUDDLE_AUTH0_CLIENT_ID
(mandatory if MUDDLE_MATCHMAKER_URL
is set)SIMULATIONS_PER_SECOND
(defaults to 120
, compile-time only)
30
, 60
, 120
. You may want to set a lower value than themr_persistence
MUDDLE_GOOGLE_WEB_CLIENT_ID
(mandatory)MUDDLE_GOOGLE_DESKTOP_CLIENT_ID
(mandatory)MUDDLE_AUTH0_CLIENT_ID
(mandatory)docker build -t mvlabat/mr_matchmaker -f mr_matchmaker.dockerfile . --platform linux/amd64
docker build -t mvlabat/mr_web_client --build-arg muddle_matchmaker_ip_addr=<IP> --build-arg muddle_matchmaker_port=<PORT> -f mr_web_client.dockerfile . --platform linux/amd64
docker build -t mvlabat/mr_server -f mr_server.dockerfile . --platform linux/amd64
aws configure
terraform apply -target=module.eks_cluster
aws eks --region <region-code> update-kubeconfig --name <cluster_name>
terraform apply -target=module.helm_agones
kubernetes_manifest
fail to plan without this helm release installed firstterraform apply
terraform destroy -target=module.agones
helm delete agones -n agones-system && terraform destroy -target=module.helm_agones
terraform destroy -target=module.eks_cluster
kubectl set image deployment <DEPLOYMENT_NAME> <CONTAINER_NAME>=<TAG>
For example:
kubectl set image deployment mr-matchmaker mr-matchmaker=mvlabat/mr_matchmaker
:latest
tag suffix, to trick kubernetes into redeployingError: Kubernetes cluster unreachable: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable
To fix this error, run export KUBE_CONFIG_PATH=~/.kube/config
(or add it to your shell rc).
aws eks --region <region-code> update-kubeconfig --name <cluster_name>
before.