Closed cpojer closed 4 months ago
I'm taking a stab at this here: https://github.com/nkzw-tech/athena-crisis/pull/19 [WIP]
Do you have a preference on where to put the buttons? I was thinking of placing them below the "Playtest" button on the right side (vertically stacked).
Many Map Editors feature symmetrical drawing modes. This task is about adding a symmetrical/mirror drawing mode for tiles, buildings and units. Here is how I imagine it could work:
Basic Modes
For example, with regular horizontal mode, on a map that has dimensions of 14x10 (width x height), drawing on field 4,4 it would draw on 10,4 on the other side (14-4). The "Both" mode would instead draw at 10,6 on the other side (14-4, 10-4). I imagine we may need a fifth mode that mirrors each field 3 times, so that drawing in one field will draw in each quarter of the map. For example, drawing at 4,4 would also draw at 10,4, 10,6 and 4,6.
The basic implementation as above should work for tiles. When a building or unit is selected, I think it makes most sense to rotate player/colors as more fields are drawn. Let's say I'm designing a map with pink (1) vs purple (5), with horizontal mode. The first unit would be player 1, and the second would be player 5.
map.active
can be used to determine the players. If the mode that draws on 4 fields is selected, and there aren't enough players on the map, I suggest doing something likenew Set([...map.active, ...PlayerIDs])
and wrapping around that set while drawing.Next to building this feature, the challenge is how to make the UX good and not confusing.
I'm not sure if there are any modes beyond this that could be useful, and I'm open to ideas.
Steps
DesignBehavior
so that multiple positions can be updated at the same time, while still running all the tile, unit and building related validations.DesignPanel
. The state should be stored inEditorState
.MapEditor
, but more likely needs to be done inDesignBehavior
's component. If neither are a good option, it can go into therender
function ofGameMap
by usingeditor
(EditorState
) and placing cursors next to the existing<Cursor />
. This might actually be the cleanest option, but I'm not entirely sure without trying.I can provide icons for the buttons. Feel free to just use any placeholders from
ui/icons
in the initial PR.Note: The code of
DesignBehavior
is maybe less ideal than it needs to be in some places. I appreciate any refactors that bring clarity, any possibly even some extractions intoathena/lib
(orathena/editor/lib
?) with added tests for mutations/validations, but it is not necessary for the completion of this task. I care about it not breaking, and this is one way of doing that.Links
Funding