docs: minor adjustements and comments on techDesign #2
|
|
@ -108,16 +108,20 @@ Upon completing the seven rounds, players will be notified of the points they ea
|
|||
## 4. Out of scope (for V1)
|
||||
|
||||
- Private lobbies, where an admin can invite players by user id
|
||||
<!--Games are private by default as you need the code to join, and there will be no listing of all lobbies,simply being able to kick players out should suffice.-->
|
||||
- Kick player out from a lobby
|
||||
- Games history, saving to database
|
||||
- Playing against bots, with either algorithmic behaviour or AI
|
||||
- Drawing pieces, instead of placing them
|
||||
- Timed rounds
|
||||
|
||||
## 5. High-level proposal
|
||||
|
||||
### 5.1. Server-client communications
|
||||
|
||||
Server and client need to communicate asynchronously, as many actions (such as submitting piece placements) need to wait for other players to finish their respective actions. For this reason, they will communicate through web-sockets. The following requests will be needed:
|
||||
Server and client need to communicate asynchronously, as many actions (such as submitting piece placements) need to wait for other players to finish their respective actions. For this reason, they will communicate through web-sockets. The following requests <!-- best to talk about events as there will be no requests in the traditional REST sense --> will be needed:
|
||||
|
||||
<!-- *I think a request "originator" or direction would also be useful in this table, for exaple the game start event originates from the server, after all the players in the lobby have indicated that they are ready* -->
|
||||
|
||||
| Request type | Inputs | Outputs | Notes |
|
||||
| ----------------------- | ------------------------------------- | ----------------------- | ----------------------------------------------------------------------- |
|
||||
|
|
@ -155,7 +159,7 @@ The systems will contain the following modules, with submodules for specific ite
|
|||
- Manages the room state transitions, from lobby to in-game to ended
|
||||
- Manages the rounds transitions
|
||||
- Administrates quests
|
||||
- Piece placement module
|
||||
- Piece placement module <!--we have to be careful with what we inject with in this module, ideally nothing, as we wont have DI in react-->
|
||||
- Verification logic on piece placement (shared between front and back-end)
|
||||
- Special cells and pieces consumption (shared also)
|
||||
- Manages piece placement action stackings to enable undo actions (front only)
|
||||
|
|
@ -169,7 +173,7 @@ The systems will contain the following modules, with submodules for specific ite
|
|||
|
||||
### 6.1. Modellisation of the users and games
|
||||
|
||||
```
|
||||
```ts
|
||||
var usersMap = Map<socketId: string, userId: string>
|
||||
var users = Map<userId: string, User>
|
||||
User = {
|
||||
|
|
@ -199,8 +203,8 @@ Game = {
|
|||
| 1. Cell<br/> 2. Piece <br/> 3. External node <br/> 4. Border <br/> 5. Track <br/> 6. Internal node <br/> 7. Exit <br/> 8. Internal node | <img src="./samples/modellisation-schema.jpg" width=300px height=320px/> |
|
||||
|
||||
**Enum types**
|
||||
|
||||
```
|
||||
<!-- string enums are much more human readable if we later on decide to store games on a database-->
|
||||
```ts
|
||||
TrackType = "RAIL" | "ROAD"
|
||||
Direction = "NORTH" | "SOUTH" | "EAST" | "WEST"
|
||||
ExitType = "RAIL" | "ROAD" | "AMBIVALENT"
|
||||
|
|
@ -210,7 +214,7 @@ CellType = "NORMAL" | "STATION" | "FACTORY" | "UNIVERSITY"
|
|||
|
||||
**Internal types**
|
||||
|
||||
```
|
||||
```ts
|
||||
Exit = { type: ExitType }
|
||||
absctract Node = { cell: Cell }
|
||||
ExternalNode extends Node = {
|
||||
|
|
@ -228,7 +232,7 @@ Border = Pair<ExternalNode, ExternalNode | Exit> // Joins two nodes from adjacen
|
|||
|
||||
**Main types**
|
||||
|
||||
```
|
||||
```ts
|
||||
Cell = {
|
||||
externalNodes: Set<ExternalNode>,
|
||||
type: CellType,
|
||||
|
|
@ -258,10 +262,10 @@ Given a Board object:
|
|||
- If there are some tracks, for each of them find the external nodes that they can connect to. Traverse through the internal nodes when necessary. Note: internal nodes might be dead ends in some cases.
|
||||
- For each accessible external node (not the original), get the cell's border and traverse it:
|
||||
- If it's an exit:
|
||||
- If it's not AMBIVALENT, pop it from the original set and add it to this sub-grid's set.
|
||||
- If it's not `AMBIVALENT`, pop it from the original set and add it to this sub-grid's set.
|
||||
- Then stop (regardless of the type of exit)
|
||||
- If it's another cell, execute this process recursively starting from the new cell's starting external node.
|
||||
- In order to avoid the algorithm to stack overflow on looped grids, every time an external node is accessed, consume it by adding it to a global ban-list.
|
||||
- In order to avoid the algorithm to stack overflow on looped grids, every time an external node is accessed, consume it by adding it to a global visited-node-list.
|
||||
|
||||
#### 6.2.3. Calculating longest road
|
||||
|
||||
|
|
@ -278,47 +282,49 @@ For each border in a board, we will verify:
|
|||
### 6.3. Game transitions
|
||||
|
||||
## 7. Implementation plan
|
||||
|
||||
- Home page
|
||||
- Manage user connection
|
||||
- Create join page
|
||||
- Page frame
|
||||
- User name input box
|
||||
- Create lobby button and request
|
||||
- Join lobby button, input box, and request
|
||||
- Create lobby page
|
||||
- Create players view
|
||||
- Create start game button
|
||||
- Create request handlers
|
||||
- Create lobby handler
|
||||
- Join lobby handler
|
||||
- Broadcasting in lobby
|
||||
- Game start handler
|
||||
- Game play
|
||||
- Game page
|
||||
- Create board view
|
||||
- Create piece set view
|
||||
- Create piece focus (and rotation) view
|
||||
- Create quests view
|
||||
- Create piece placement animations
|
||||
- Create piece placement validator
|
||||
- Create special cells logic
|
||||
- Create undo action button
|
||||
- Create submit button
|
||||
- Create submit handler
|
||||
- Create quests checker and broadcasting
|
||||
- One quest checker will be needed per quest type
|
||||
- Create quests info display in web
|
||||
- Create round info broadcasted
|
||||
- Game end
|
||||
- Game end page
|
||||
- Create boards view
|
||||
- Create points view
|
||||
- Create winner view
|
||||
- Create focus board animations
|
||||
- Create points calculation logic
|
||||
- Create quests counter
|
||||
- Create longest track pathfinder
|
||||
- Create connected exits pathfinder
|
||||
- Create dead-end tracks counter
|
||||
- Create house and center cells counter
|
||||
- [ ] Design phase
|
||||
- [x] First design document Draft
|
||||
- [ ] Migrate tasks to kanban
|
||||
- [ ] Home page
|
||||
- [ ] Manage user connection
|
||||
- [ ] Create join page
|
||||
- [ ] Page frame
|
||||
- [ ] User name input box
|
||||
- [ ] Create lobby button and request
|
||||
- [ ] Join lobby button, input box, and request
|
||||
- [ ] Create lobby page
|
||||
- [ ] Create players view
|
||||
- [ ] Create start game button
|
||||
- [ ] Create request handlers
|
||||
- [ ] Create lobby handler
|
||||
- [ ] Join lobby handler
|
||||
- [ ] Broadcasting in lobby
|
||||
- [ ] Game start handler
|
||||
- [ ] Game play
|
||||
- [ ] Game page
|
||||
- [ ] Create board view
|
||||
- [ ] Create piece set view
|
||||
- [ ] Create piece focus (and rotation) view
|
||||
- [ ] Create quests view
|
||||
- [ ] Create piece placement animations
|
||||
- [ ] Create piece placement validator
|
||||
- [ ] Create special cells logic
|
||||
- [ ] Create undo action button
|
||||
- [ ] Create submit button
|
||||
- [ ] Create submit handler
|
||||
- [ ] Create quests checker and broadcasting
|
||||
- [ ] One quest checker will be needed per quest type
|
||||
- [ ] Create quests info display in web
|
||||
- [ ] Create round info broadcasted
|
||||
- [ ] Game end
|
||||
- [ ] Game end page
|
||||
- [ ] Create boards view
|
||||
- [ ] Create points view
|
||||
- [ ] Create winner view
|
||||
- [ ] Create focus board animations
|
||||
- [ ] Create points calculation logic
|
||||
- [ ] Create quests counter
|
||||
- [ ] Create longest track pathfinder
|
||||
- [ ] Create connected exits pathfinder
|
||||
- [ ] Create dead-end tracks counter
|
||||
- [ ] Create house and center cells counter
|
||||
|
|
|
|||
Loading…
Reference in New Issue