diff --git a/.gitignore b/.gitignore index 03c1bdc..8685940 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ build +maps +ttrts *.user *.sublime* .idea diff --git a/USAGE.txt b/USAGE.txt new file mode 100644 index 0000000..ad7dacb --- /dev/null +++ b/USAGE.txt @@ -0,0 +1,56 @@ +To convert this file to c++ syntax use +$ cat USAGE.txt | sed 's/\t/\\t/g' | sed ':a;N;$!ba;s/\n/\\n\n/g' | sed 's/^/"/' | sed 's/$/"/' + +NAME + ttrts - Tiny Terminal RTS + +SYNOPSYS + ttrts [OPTIONS...] MAPFILE + +DESCRIPTION + ttrts is a tiny terminal based RTS where that uses text files as order lists to control it's units. + + This means that any user, program or cat that can read and write to text files can play the game. + +USAGE + When invoked, ttrts will set up a full game and output a single file representing the current gamestate into a local directory called ttrts_{GAME_NAME}. + + This file can be read in and interpretted by human, robot, or cat. + ttrts will wait for orders files to be placed in it's current working directory. + + File name formats: + gamestate Turn_{TURN_NUMBER}.txt + orders Turn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt + + Once orders have been set for each player taking part, ttrts consumes order files, + calculates new game state and outputs a new file. + + This process repeats until a winner is chosen! + +OPTIONS + MAPFILE: + File to read in the initial game state from + +GAMESTATE FILE FORMAT + Name + Turn_{TURN_NUMBER}.txt + Contents + ===== {GAME_NAME} ===== + SIZE:[{X},{Y}] + TURN:{TURN_NUMBER} + ~~~~ + UNIT:{UNIT_ID} tm:{TEAM_NUMBER} vs:{VISUAL} dr:{DIRECTION(NESW)} ps:[{X},{Y}] + ... + +ORDER FILE FORMAT + Name + Turn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt + Contents + ORDER:{ORDER_CHAR} id:{UNIT_ID} + ... + +ORDERS + F - Move unit forward one space + L/R - Rotate unit left or right + A - Attack space in front of unit + diff --git a/bootstrap.sh b/bootstrap.sh index d882c3a..8780bc3 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -20,7 +20,8 @@ if [[ $? != 0 ]]; then fi echo "TTRTS: Generating maps" -cd ../games +test ! -e ../maps && mkdir ../maps +cd ../maps ./../build/gen/ttrts-gen if [[ $? != 0 ]]; then echo "TTRTS: Generating maps, exiting Bootstrap" @@ -33,4 +34,4 @@ if [ ! -e build/ttrts/ttrts ]; then fi cp build/ttrts/ttrts . -chmod a+x ttrts \ No newline at end of file +chmod a+x ttrts diff --git a/source/ttrts/main.cpp b/source/ttrts/main.cpp index 6b1740e..2c6f8e4 100644 --- a/source/ttrts/main.cpp +++ b/source/ttrts/main.cpp @@ -6,21 +6,59 @@ #include "game.h" -static const char* sk_usage = "NAME\n" +static const char* sk_usage = + "NAME\n" "\tttrts - Tiny Terminal RTS\n" "\n" "SYNOPSYS\n" - "\tttrts [OPTIONS...] infile\n" + "\tttrts [OPTIONS...] MAPFILE\n" "\n" "DESCRIPTION\n" - "\tWhen invoked, ttrts will set up a full game and output a single file representing\n" - "\tthe current game state.\n" + "\tttrts is a tiny terminal based RTS where that uses text files as order lists to control it's units.\n" + "\n" + "\tThis means that any user, program or cat that can read and write to text files can play the game.\n" + "\n" + "USAGE\n" + "\tWhen invoked, ttrts will set up a full game and output a single file representing the current gamestate into a local directory called ttrts_{GAME_NAME}.\n" + "\n" "\tThis file can be read in and interpretted by human, robot, or cat.\n" "\tttrts will wait for orders files to be placed in it's current working directory.\n" + "\n" + "\tFile name formats:\n" + "\t gamestate Turn_{TURN_NUMBER}.txt\n" + "\t orders Turn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt\n" + "\n" "\tOnce orders have been set for each player taking part, ttrts consumes order files,\n" "\tcalculates new game state and outputs a new file.\n" "\n" - "\tThis process repeats until a winner is chosen!\n"; + "\tThis process repeats until a winner is chosen!\n" + "\n" + "OPTIONS\n" + "\tMAPFILE:\n" + "\t\tFile to read in the initial game state from\n" + "\n" + "GAMESTATE FILE FORMAT\n" + "\tName\n" + "\t\tTurn_{TURN_NUMBER}.txt\n" + "\tContents\n" + "\t\t===== {GAME_NAME} =====\n" + "\t\tSIZE:[{X},{Y}]\n" + "\t\tTURN:{TURN_NUMBER}\n" + "\t\t~~~~\n" + "\t\tUNIT:{UNIT_ID} tm:{TEAM_NUMBER} vs:{VISUAL} dr:{DIRECTION(NESW)} ps:[{X},{Y}]\n" + "\t\t...\n" + "\n" + "ORDER FILE FORMAT\n" + "\tName\n" + "\t\tTurn_{TURN_NUMBER}_Team_{TEAM_NUMBER}.txt\n" + "\tContents\n" + "\t\tORDER:{ORDER_CHAR} id:{UNIT_ID}\n" + "\t\t...\n" + "\n" + "ORDERS\n" + "\tF - Move unit forward one space\n" + "\tL/R - Rotate unit left or right\n" + "\tA - Attack space in front of unit\n"; // time for waiting between file stats static const std::chrono::milliseconds sk_waitTime = std::chrono::milliseconds(100);