-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Notes - chore(web): physics & game controls
- Loading branch information
Showing
77 changed files
with
3,746 additions
and
1,456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@chess-d/configs": patch | ||
--- | ||
|
||
# Logs | ||
|
||
## chore(configs): disable unused local **typescript** rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
"web": patch | ||
--- | ||
|
||
# Logs | ||
|
||
## refactor(web): handle piece drop from piece group | ||
|
||
- Move the `dropPiece` handler to `PiecesGroupModel` | ||
- Handle `PiecesGroupModel` count update | ||
- Handle `PieceModel` deletion | ||
- `PiecesGroupModel` update PieceModes | ||
- Update `PiecesModel` composition on set coords | ||
- Update physics rotation | ||
|
||
## refactor(web): implement physics debug | ||
|
||
- Move out of the core the `Physics` helper | ||
- Register it in the dependency container | ||
- Add debug module | ||
- Implement physics debug | ||
- Add new turbo env to the dev process | ||
- use **vite** `import.meta.env?.DEV` env as debug mode checker | ||
|
||
## feat(web): use `PhysicsProperties` to position the board | ||
|
||
- Add `@chess-d/rapier-physics` | ||
- Add `physicsBody` property to chess-board component | ||
|
||
## feat(web): handle piece dropping | ||
|
||
## refactor(web): make `PieceModel` independent from board | ||
|
||
## feat(web): implement pieces initializers | ||
|
||
## feat(web): set base web architecture | ||
|
||
- Initialize world module | ||
- Initialize game module | ||
- Initialize chess board module | ||
- initialize core module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"@chess-d/rapier-physics": minor | ||
--- | ||
|
||
# Logs | ||
|
||
## refactor: implement force bounding-box usage | ||
|
||
- Use `Object3D.userData` to pass `useBoundingBox`, forcing **bounding-box** usage | ||
|
||
## feat(rapier-physics): base rapier physics integration | ||
|
||
- Use `ThreeJS` RapierPhysics addon as base. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"api": patch | ||
--- | ||
|
||
# Logs | ||
|
||
## Init base server resources | ||
|
||
- Initialize `graphql` code first. | ||
- Initialize `webSocket` support. | ||
- Use `WS` library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,8 @@ pnpm-debug.log* | |
# Misc | ||
.DS_Store | ||
*.pem | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,9 @@ | |
{ | ||
"mode": "auto" | ||
} | ||
], | ||
"cSpell.words": [ | ||
"timestep", | ||
"tsyringe" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { ApolloDriver, ApolloDriverConfig } from "@nestjs/apollo"; | ||
import { ApolloServerPluginLandingPageLocalDefault } from "@apollo/server/plugin/landingPage/default"; | ||
import { join } from "path"; | ||
import { GraphQLModule } from "@nestjs/graphql"; | ||
|
||
import { LinksModule } from "./links/links.module"; | ||
|
||
import { AppService } from "./app.service"; | ||
import { AppController } from "./app.controller"; | ||
import { ExperienceModule } from "./experience/experience.module"; | ||
|
||
@Module({ | ||
imports: [LinksModule], | ||
controllers: [AppController], | ||
providers: [AppService] | ||
imports: [ | ||
GraphQLModule.forRoot<ApolloDriverConfig>({ | ||
driver: ApolloDriver, | ||
autoSchemaFile: join(process.cwd(), "src/schema.gql"), | ||
playground: false, | ||
plugins: [ApolloServerPluginLandingPageLocalDefault()] | ||
}), | ||
ExperienceModule | ||
], | ||
controllers: [], | ||
providers: [] | ||
}) | ||
export class AppModule {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from "@nestjs/common"; | ||
|
||
import { ExperienceService } from "./services/experience.service"; | ||
import { ExperienceResolver } from "./resolvers/experience.resolver"; | ||
import { ExperienceGateway } from "./gateways/experience.gateway"; | ||
|
||
@Module({ | ||
providers: [ExperienceResolver, ExperienceService, ExperienceGateway] | ||
}) | ||
export class ExperienceModule {} |
18 changes: 18 additions & 0 deletions
18
apps/api/src/experience/gateways/experience.gateway.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { ExperienceGateway } from "./experience.gateway"; | ||
|
||
describe("ExperienceGateway", () => { | ||
let gateway: ExperienceGateway; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ExperienceGateway] | ||
}).compile(); | ||
|
||
gateway = module.get<ExperienceGateway>(ExperienceGateway); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(gateway).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
MessageBody, | ||
OnGatewayConnection, | ||
OnGatewayDisconnect, | ||
OnGatewayInit, | ||
SubscribeMessage, | ||
WebSocketGateway, | ||
WebSocketServer, | ||
WsResponse | ||
} from "@nestjs/websockets"; | ||
import { Server, WebSocket } from "ws"; | ||
|
||
@WebSocketGateway(4000) | ||
export class ExperienceGateway | ||
implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect | ||
{ | ||
@WebSocketServer() | ||
server: Server; | ||
|
||
afterInit() { | ||
console.log(`WS: ${this.server.address().toString()}`); | ||
} | ||
|
||
handleConnection(client: WebSocket, ...args: any[]) { | ||
console.log(`WS: New Client | ${client.url}`, args); | ||
} | ||
|
||
handleDisconnect(client: WebSocket) { | ||
console.log(`WS: Client Disconnected | ${client.url}`); | ||
} | ||
|
||
@SubscribeMessage("events") | ||
onEvent(@MessageBody() data: unknown): WsResponse<string> { | ||
console.log(`WS: On Event | ${data}`); | ||
|
||
return { event: "event", data: `data:${data}` }; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
apps/api/src/experience/resolvers/experience.resolver.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { ExperienceResolver } from "./experience.resolver"; | ||
import { ExperienceService } from "./experience.service"; | ||
|
||
describe("ExperienceResolver", () => { | ||
let resolver: ExperienceResolver; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [ExperienceResolver, ExperienceService] | ||
}).compile(); | ||
|
||
resolver = module.get<ExperienceResolver>(ExperienceResolver); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(resolver).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Query, Resolver } from "@nestjs/graphql"; | ||
import { ExperienceService } from "../services/experience.service"; | ||
|
||
@Resolver() | ||
export class ExperienceResolver { | ||
constructor(private readonly experienceService: ExperienceService) {} | ||
|
||
@Query(() => String) | ||
async log() { | ||
return this.experienceService.log(); | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
apps/api/src/links/links.service.spec.ts → ...ience/services/experience.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
|
||
@Injectable() | ||
export class ExperienceService { | ||
public async log() { | ||
return "logged"; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.