Chuckleberry-Finn / game-night

GNU Affero General Public License v3.0
4 stars 3 forks source link

Snap to grid on boards. #10

Open fed-cap24 opened 11 months ago

fed-cap24 commented 11 months ago

Is your feature request related to a problem? Please describe.

It grinds my gears that the pieces are not properly placed on board games. A snap to grid for those games would avoid those issues.

Describe the solution you'd like

Boards could have invisible 2D coordinates stored in some way, that includes a radius, and a mask for pieces.

Pieces matching certain tags and placed inside the radius would be snapped to the center of these radius. Pieces that are not part of the mask would be ignored, and not moved.

There could also be a swap / remove / whatever options when a piece ocupies another's spot. This could enable easier captures on chess for instance.

Circles could also have alternative coordinates in case that several pieces can be in the same spot at a time, like in monopoly.

On debug menu, the circles could be shown, for development purposes and addons.

fed-cap24 commented 11 months ago

I've thought a little about this. I think that the simplest way to get this working would be the following.

coordinates should be in .xml format.

They could be nested in the following way:

<board>ChessBoard</board>
<board>Checkers</board>
<PiecePositions name="8x8BoardPieces" , radius = 2 , action="replace">
 <Piece>chessPiece</Piece>
 <Piece>checkersPiece</Piece>
 <!--AlternativeLocalPositions x=1, y=1></AlternativeLocalPositions-->
 <coord x=1, y=1 , rot = 0></coord> <!--rotation data can be used to rotate the pieces. For instance, catan roads. It would be from 0 to 360 degrees-->
 <coord x=1, y=2 , rot = 0></coord>
 <coord x=1, y=3 , rot = 0></coord>
 <coord x=1, y=4 , rot = 0></coord>
 <!-- Etc -->
 <coord x=8, y=4 , rot = 0></coord>
 <coord x=8, y=5 , rot = 0></coord>
 <coord x=8, y=6 , rot = 0></coord>
 <coord x=8, y=7 , rot = 0></coord>
 <coord x=8, y=8 , rot = 0></coord>
</PiecePositions>
<!-- Other piece position if needed, for instance, road and a settlement shouldn't snap to the same positions in catan.-->

This would enable similar boards to share the coordinates, so you could play chess vs checkers for instance.

It would also allow for coordinates to share radius, and local alternative position data, so you wouldn't have to copy a monopoly space alternative local positions 40 times.

rotation data can be used to automatically rotate pieces if required.

Actions could be allowed to be trigered when placing items to the snap position.

for instance, replace could make you instantly grab the piece that was where you dropped yours.

Stack could add cards to a stack, so you don't have to do it manually.

Etc.