Closed 0matleb2 closed 6 years ago
Mockup:
Dev recap from Slack. #28
I've been working heavily in the Sandbox folder on a rewrite of the grid that supports editing the grid and tiles in scene, and easy creation of irregular grids. It's very much the same however I still chose to rewrite to not disturb the original scripts. I've ported the GetNeighbors
algorithm so far. This GIF shows how irregular grids are supported. They can be rapidly created by disabling the MeshRenderer on the tiles in a base 19x19 grid. I've attached the Neighbors
algo to the mouse selection for testing purposes. I also added multi-select with LEFT_CTRL pressed, may come in handy.
I created the above irregular grid from this base grid prefab in just a few moments.
Also it will support changing out the HexTile mesh as the positions of the tiles are linked to the size of the mesh. As long as new meshes have the shape of a regular hexagon, the layout of the grid should remain consistent.
Pathfinding with BFS ✔️
A* instead of BFS ✔️ . Much faster.
To verify and demo how A* searches I slowed down the algorithm and marked every node on the search path. In Unity waiting is not as simple as Thread.Sleep()
, so I had to learn how to make the magic happen with Coroutines 😅
Multi-select support and selection polishing,
Implementation hindering unit testing. Resolved ✔️
Character selection and movement on grid ✔️ #2
Refactoring GridController to reduce cohesion. ✔️
Prevent movement to unreachable tiles and error hover. ✔️
@ModestosV Unit testing ✔️
Character info panel integrated with grid. ✔️
Test | Inputs | Expected Output | Status |
---|---|---|---|
Show Grid | Launch game and press "Play". | Grid composed of hexagonal tiles is visible. | Pass ✔️ |
Hover Tile | Hover mouse over a tile. | Tile is hover highlighted. | Pass ✔️ |
Select Tile | Left-click on a tile that does not contain a character. | Tile is selection highlighted. No character movement. | Pass ✔️ |
Deselect Tile | Left-click on the selected tile or off the grid. | Tile is not selection highlighted. No character movement. | Pass ✔️ |
Change Tile Selection | With an unoccupied tile selected, select another unoccupied tile. | Initial selected tile is deselected. New selected tile is selected. | Pass ✔️ |
@ModestosV
We could expand on this test by setting gridWidth
to 2 and then verifying the coordinates are correct for all 4 hex tiles in the grid. These 4 tiles will have coordinates that can be expressed as movement along the 3 axes of the hexagonal grid. Asserting all of their coordinates are correct will be a more complete test than asserting the first and only tile in a 1 width grid has origin coordinates.
@ModestosV
For example, have a look at how I have tested getNorthEastNeighbor
in GridTraversalController
.
https://github.com/ModestosV/BlackDice/blob/feature/issue_002_1/Online%20Grid%20Arena/Assets/Editor/GridTests/GridTraversalControllerTests.cs
Second pass on GridController tests. ✔️
Test | Inputs | Expected Output | Status | Last Tested |
---|---|---|---|---|
Show Grid | Launch game and press "Play". | Grid composed of hexagonal tiles is visible. | Pass | 04/19/2019 |
Hover Tile | Hover mouse over a tile. | Tile is hover highlighted. | Pass | 04/19/2019 |
Select Tile | Left-click on a tile that does not contain a character. | Tile is selection highlighted. No character movement. | Pass | 04/19/2019 |
Change Tile Selection | With an unoccupied tile selected, select another unoccupied tile. | Initial selected tile is deselected. New selected tile is selected. | Pass | 04/19/2019 |
User Story
As a user, I want to view a grid playing field composed of hexagonal tiles. I want to view a variety of playing field layouts including a 6 tile-per-side hexagonal layout.
Story Points: 13 Priority: High Risk: High
Task Breakdown
[x] Create and import hexagonal tile 3D model (1 hrs)
[x] Create HexTile script that handles Unity game object properties and define Hex Tile Material Set (3 hrs)
[x] Create HexTileController script that encapsulates tile coordinates and state (3 hrs)
[x] Create Grid script and GridController that calculates HexTile coordinates and arranges grid layout (4 hrs)
[x] Setup Unity scene with HexTile and Grid game objects.
[x] Refactor scripts to implement interfaces for testability (3 hrs)
[x] Write unit tests for HexTileController and GridController (4 hrs)
[x] Unit testing second pass. (3 hrs)
[x] Setup Logging Interface [Technical Feature] (4hrs)
[x] Setup Unit Tests Project [Technical Feature] (3hrs)
[x] Setup .NET integration [Technical Feature] (6hrs)