Skip to content

Commit

Permalink
Simplicity. Decided on a design and implementing
Browse files Browse the repository at this point in the history
  • Loading branch information
phisn committed Sep 21, 2024
1 parent 3f927df commit 7c8218a
Show file tree
Hide file tree
Showing 19 changed files with 2,350 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/game/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/proto/**/*.ts
Empty file added packages/game/README.md
Empty file.
36 changes: 36 additions & 0 deletions packages/game/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "game",
"version": "0.0.0",
"scripts": {
"install": "yarn run proto",
"test": "vitest run",
"proto": "run-script-os",
"proto:default": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./proto --ts_proto_opt=unrecognizedEnum=false --ts_proto_opt=oneof=unions -I=./proto ./proto/*.proto",
"proto:win32": "protoc --plugin=protoc-gen-ts_proto=\".\\node_modules\\.bin\\protoc-gen-ts_proto.cmd\" --ts_proto_out=./proto --ts_proto_opt=unrecognizedEnum=false --ts_proto_opt=oneof=unions -I=./proto ./proto/*.proto",
"lint": "eslint \"src/**/*.{tsx,ts}\""
},
"dependencies": {
"@dimforge/rapier2d": "^0.11.2",
"@petamoriken/float16": "^3.8.3",
"@stdlib/math": "^0.0.11",
"lz-string": "^1.5.0",
"mnemonist": "^0.39.5",
"protobufjs": "^7.2.4",
"runtime-framework": "*",
"ts-proto": "^1.156.6",
"typescript": "latest"
},
"devDependencies": {
"@protobuf-ts/protoc": "^2.9.1",
"eslint-config-custom": "*",
"run-script-os": "^1.1.6",
"tsconfig": "*",
"vitest": "^0.31.4"
},
"eslintConfig": {
"root": true,
"extends": [
"custom"
]
}
}
5 changes: 5 additions & 0 deletions packages/game/proto/replay.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
syntax = "proto3";

message ReplayModel {
bytes frames = 1;
}
58 changes: 58 additions & 0 deletions packages/game/proto/world.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
syntax = "proto3";

enum EntityType {
ROCKET = 0;
LEVEL = 1;
SHAPE = 2;
}

message RocketBehaviorConfig {
float thrust_distance = 1;
float thrust_value = 2;
float thrust_ground_multiplier = 3;
float explosion_angle = 4;
}

message RocketConfig {
float position_x = 1;
float position_y = 2;
float rotation = 3;

RocketConfig default_config = 4;
}

message LevelConfig {
float position_x = 1;
float position_y = 2;
float rotation = 3;

float camera_top_left_x = 4;
float camera_top_left_y = 5;

float camera_bottom_right_x = 6;
float camera_bottom_right_y = 7;

float capture_area_left = 8;
float capture_area_right = 9;

optional RocketConfig rocket_config = 10;
}

message ShapeConfig {
bytes vertices = 1;
}

message GroupConfig {
repeated RocketConfig rockets = 1;
repeated LevelConfig levels = 2;
repeated ShapeConfig shapes = 3;
}

message GamemodeConfig {
repeated string groups = 1;
}

message WorldConfig {
map<string, GroupConfig> groups = 1;
map<string, GamemodeConfig> gamemodes = 2;
}
Loading

0 comments on commit 7c8218a

Please sign in to comment.