move files around; refactor the scripts; make a design doc
This commit is contained in:
parent
c31078ebd5
commit
4655a9d9b9
51
doc/DESIGN.gmi
Normal file
51
doc/DESIGN.gmi
Normal file
@ -0,0 +1,51 @@
|
||||
# DESIGN
|
||||
This document describes the design of this project. The main purpose is to describe the interface between the client and the server, but I might document other useful information here, too.
|
||||
|
||||
## Client/Server Communication
|
||||
All communication is done through JSON.
|
||||
|
||||
### Client Requests
|
||||
Clients can make requests to the server by sending a JSON object containing two fields:
|
||||
* "request", which is a string of name of the request being made
|
||||
* "parameters", which is an object whose structure depends on the request. It contains a named list of the request's parameters
|
||||
|
||||
### Server Responses
|
||||
Upon receiving and handling a request, the server will send a response object with the following fields:
|
||||
* "success", a boolean that indicates whether the request succeeded
|
||||
* "response", an object whose structure depends on the request. It contains data relevant to the request
|
||||
|
||||
### Example Request and Response
|
||||
An example request might look as follows:
|
||||
```
|
||||
{
|
||||
"request": "create-world",
|
||||
"parameters": {
|
||||
"name": "test world",
|
||||
"size": {
|
||||
"height": 10,
|
||||
"width": 15,
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A success response might look like:
|
||||
```
|
||||
{
|
||||
"success": true,
|
||||
"response": {
|
||||
"world-id": 69420
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Or, in the case of an error:
|
||||
```
|
||||
{
|
||||
"success": false,
|
||||
"response": {
|
||||
"code": 69
|
||||
"message": "A world with this name already exists"
|
||||
}
|
||||
}
|
||||
```
|
@ -8,7 +8,7 @@ if [ "$1" = "run" ]; then
|
||||
run_exe=1
|
||||
fi
|
||||
|
||||
if ! [ -f ".gitignore" ]; then
|
||||
if ! [ -d ".git" ]; then
|
||||
echo "Run in the project root"
|
||||
exit 1
|
||||
fi
|
@ -1,6 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
./build.sh
|
||||
set -e
|
||||
|
||||
if ! [ -d ".git" ]; then
|
||||
echo "Run in the project root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./scripts/build.sh
|
||||
|
||||
echo "### DAEMON ###"
|
||||
./build/server/simworld-daemon &
|
Loading…
Reference in New Issue
Block a user