-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplay.sh
More file actions
executable file
·39 lines (31 loc) · 840 Bytes
/
play.sh
File metadata and controls
executable file
·39 lines (31 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
PORT=8065
HOST="`hostname`:$PORT"
PID="/tmp/elixoids_game"
SONIC=~/Applications/SonicAsteroids.app/Contents/MacOS/SonicAsteroids
# If we are running a game, stop it
if [ -f "$PID" ]; then
kill -9 `cat $PID` 2>/dev/null
fi
# Start the game and save it's PID
nice -n 10 mix run --no-halt &
echo $! > $PID
# UI
sleep 4.0
open "http://$HOST/0/game"
# Audio
if [ -x "$(command -v $SONIC)" ]; then
$SONIC "ws://$HOST/0/sound" &
fi
# Clients that shoot rocks
if [ -x "$(command -v python3)" ]; then
sleep 4.0
nice -n 19 python3 clients/miner.py --host "$HOST" --game 0 --name MIN &
sleep 4.0
nice -n 19 python3 clients/miner.py --host "$HOST" --game 0 &
fi
# Hunter that shoots ships
if [ -x "$(command -v ruby)" ]; then
sleep 8.0
ELIXOIDS_SERVER="$HOST" ruby clients/shoot_nearest_ship.rb KIL &
fi