Skip to content

Commit

Permalink
Merge pull request #51 from documentation
Browse files Browse the repository at this point in the history
Documentation
  • Loading branch information
Kiyotoko authored Apr 25, 2024
2 parents 0402eaf + 2588320 commit f39c2cc
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 17 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,70 @@
<a href="https://github.com/seekers-dev/seekers-grpc/actions/workflows/codeql.yml">
<img alt="CodeQL" src="https://github.com/seekers-dev/seekers-grpc/actions/workflows/codeql.yml/badge.svg">
</a>
<a href="https://github.com/seekers-dev/seekers-grpc/actions/workflows/maven-publish.yml">
<img alt="Maven Package" src="https://github.com/seekers-dev/seekers-grpc/actions/workflows/maven-publish.yml/badge.svg">
</a>
<a href="https://github.com/seekers-dev/seekers-grpc/actions/workflows/maven.yml">
<img alt="Java CI with Maven" src="https://github.com/seekers-dev/seekers-grpc/actions/workflows/maven.yml/badge.svg">
</a>
<img alt="GitHub License" src="https://img.shields.io/github/license/seekers-dev/seekers-grpc">
<img alt="GitHub top language" src="https://img.shields.io/badge/proto-100%25-blue">
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/seekers-dev/seekers-grpc">
</p>

Seekers gRPC is a repository that provides a gRPC-based communication interface for the Seekers application. It enables efficient and reliable communication between clients and servers using the gRPC framework.

## Messages

```mermaid
classDiagram
class Player {
string id
List<<string>> seekers_ids
string camp_id
uint32 score
}
class Camp {
string id
string player_id
double width
double height
}
class Physical {
string id
Vector2D acceleration
Vector2D velocity
Vector2D position
}
class Goal {
string camp_id
double time_owned
}
class Seeker {
string player_id
double magnet
Vector2D target
double disable_counter
}
Goal --|> Physical
Seeker --|> Physical
```

## Services

```mermaid
sequenceDiagram
Client->> Server: Enters game
Server->> Client: Returns token
Client--) Server: Requests properties
Server--) Client: Returns properties of game
loop Runtime
Client->> Server: Submit changes with token
Server->> Client: Returns new state
end
```

## Contributing

Contributions to Seekers gRPC are welcome! If you want to contribute, please follow these guidelines:
Expand Down
29 changes: 20 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<grpc.version>1.63.0</grpc.version>
</properties>
<dependencies>
<!-- Proto files -->
Expand All @@ -22,24 +23,31 @@
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>1.63.0</version>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.63.0</version>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.63.0</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<version>${grpc.version}</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!-- Proto files -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${grpc.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<extensions>
<!-- Property Detection -->
Expand All @@ -51,6 +59,7 @@
</extensions>
<pluginManagement>
<plugins>
<!-- Proto files-->
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
Expand Down Expand Up @@ -78,6 +87,7 @@
</execution>
</executions>
</plugin>
<!-- Proto files -->
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
Expand All @@ -90,6 +100,7 @@
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
Expand All @@ -99,4 +110,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
17 changes: 17 additions & 0 deletions src/main/proto/org/seekers/game/camp.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

import "org/seekers/game/vector2d.proto";
Expand Down
17 changes: 17 additions & 0 deletions src/main/proto/org/seekers/game/goal.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

import "org/seekers/game/physical.proto";
Expand Down
17 changes: 17 additions & 0 deletions src/main/proto/org/seekers/game/physical.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

import "org/seekers/game/vector2d.proto";
Expand Down
27 changes: 19 additions & 8 deletions src/main/proto/org/seekers/game/player.proto
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

option optimize_for = SPEED;
option java_package = "org.seekers.grpc.game";

// The Player message represents a player in the game.
// The Player message represents a player in the game. Every player has a number of seekers it controls and a camp.
message Player {
// The unique identifier of the player.
string id = 1;
Expand All @@ -14,12 +31,6 @@ message Player {
// The ID of the camp associated with the player.
string camp_id = 3;

// The name of the player.
string name = 4;

// The color associated with the player.
string color = 5;

// The score of the player.
int32 score = 6;
uint32 score = 6;
}
17 changes: 17 additions & 0 deletions src/main/proto/org/seekers/game/seeker.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

import "org/seekers/game/physical.proto";
Expand Down
17 changes: 17 additions & 0 deletions src/main/proto/org/seekers/game/vector2d.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

option optimize_for = SPEED;
Expand Down
22 changes: 22 additions & 0 deletions src/main/proto/org/seekers/net/seekers.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
* Copyright (C) 2024 Seekers Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

syntax = "proto3";

import "org/seekers/game/vector2d.proto";
Expand All @@ -11,8 +28,13 @@ option java_package = "org.seekers.grpc.net";

// Service for communicating with a seekers game.
service Seekers {
// Joins the game, returns your token.
rpc Join (JoinRequest) returns (JoinResponse);

// Gets the properties from the server.
rpc Properties (Empty) returns (PropertiesResponse);

// Commands any units, returns the current state of the game.
rpc Command (CommandRequest) returns (CommandResponse);
}

Expand Down

0 comments on commit f39c2cc

Please sign in to comment.