Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for game variations #380

Closed
herzbube opened this issue Sep 2, 2022 · 5 comments
Closed

Add support for game variations #380

herzbube opened this issue Sep 2, 2022 · 5 comments

Comments

@herzbube
Copy link
Owner

herzbube commented Sep 2, 2022

With the intregration of SgfcKit the app has now access to game variations that are stored inside an SGF file. The app should be able to display game variations, but also to create new game variations and modify/delete existing game variations.

@herzbube herzbube added this to the Soon milestone Sep 2, 2022
@herzbube herzbube self-assigned this Sep 2, 2022
@herzbube
Copy link
Owner Author

herzbube commented Sep 2, 2022

Search the code for "variation support" for markers where it is already known that the code needs to be changes to add variation support.

@herzbube herzbube modified the milestones: Soon, 2.0.0 Sep 18, 2022
herzbube added a commit that referenced this issue Oct 5, 2022
the upcoming variation view will be another scroll view that competes
with the board view for screen estate. clearly the user must be able to
resize the views to his liking. ResizableStackViewController provides
support for this.

this initial implementation was tested on the simulator. CPU usage
during resizing still needs to be measured on a real device. also drag
handles are only drawn in a rudimentary fashion at the moment.
herzbube added a commit that referenced this issue Oct 6, 2022
…380)

this is preparation work for implementing the variation view, as this
will also be based upon TiledScrollView
herzbube added a commit that referenced this issue Oct 6, 2022
the skeleton is ready to be integrated in the view's app hierarchy.
it currently displays dummy content only.

it demonstrates that the basic functions work: drawing with CoreGraphics,
tiling, zooming, scrolling and syncing the main scroll view with the
node numbers scroll view.
herzbube added a commit that referenced this issue Oct 9, 2022
…skeleton (#380)

change details
- integration takes place in PlayRootViewControllerPhonePortraitOnly;
  other PlayRootViewController subclasses will follow later
- refactoring (i.e. no real changes) in
  PlayRootViewControllerPhonePortraitOnly: setup of view hierarchy and
  Auto Layout constraints has been refactored into many small methods
  for better readability
- actual changes in PlayRootViewControllerPhonePortraitOnly:
  - add ResizableStackViewController as a new child view controller
    of PlayRootViewControllerPhonePortraitOnly
  - add two child view controllers for the two resizable panes; these
    are child view controllers of ResizableStackViewController, not of
    PlayRootViewControllerPhonePortraitOnly
  - BoardViewController, ButtonBoxController, AnnotationViewController
    and BoardPositionCollectionViewController are now child view
    controllers of these two resizable pane view controllers, no longer
    of PlayRootViewControllerPhonePortraitOnly
  - add NodeTreeViewController as child view controller of the view
    controller that manages the second resizable pane
  - setup the view hierarchy to match the new view controller hierarchy
  - add a new button that when tapped switches between board position
    collection view and node tree view
- BoardViewDrawingHelper now contains a number of checks for invalid
  layer and drawing rectangles, to avoid the spamming of CoreGraphics
  warnings in Xcode's debug console that are due to the inability to
  draw because of extremely small board dimensions
- UiUtilities now applies button tint color depending on user interface
  style (light/dark mode)
- AnnotationViewController uses UiUtilities button tint color handling
- cleanup: remove obsolete constant indexOfMoreNavigationController
- unrelated: improve SaveSgfCommand documentation
@herzbube herzbube changed the title Add support for variations Add support for game variations Oct 10, 2022
@herzbube
Copy link
Owner Author

herzbube commented Nov 5, 2022

Merge commit e9eea6a contains a first set of important changes:

  • Changes to the data model, the most important of which are
    • Store setup information in GoNodeSetup
    • Move property zobristHash from GoMove to GoNode
    • Remove GoMove reference to the next move (not possible in a tree)
  • Loading of the full tree of SGF nodes in LoadGameCommand
  • Cleanup: GoBoardPosition no longer uses KVO to react to changes in GoNodeModel
  • Added unit tests for GoNode which were missing until now

@herzbube
Copy link
Owner Author

Merge commit 035304e contains the next batch of major changes:

  • First working implementation of the scroll view that displays the node tree. Major parts/features:
    • Calculate the view model data from the Go node model data.
    • Draw node symbols, lines between node symbols, the currently selected game variation, and the selected node.
    • Zoom in/out of the node tree view.
    • User can tap in the node tree view to select a node => this changes the current game variation in GoNodeModel!
    • When the current board position changes, the node tree view focuses on the newly selected node .
    • A set of 4 new user preferences that govern how the node tree is drawn.
  • The app now remembers which was shown last: The list of board positions or the node tree view.
  • Several bugfixes in LoadGameCommand.
  • Several game variation handling fixes (GoNodeModel discard methods, ChangeAndDiscardCommand, SyncGTPEngineCommand).
  • Other improvements too numerous and detailed to list.

@herzbube
Copy link
Owner Author

herzbube commented Mar 2, 2023

Further important commits:

  • 374e29e: new move creates game variation instead of discarding future board positions
  • 5fd272d: new user preferences "new move insert policy" and "new move insert position"
  • c52a623: new user preference "focus mode"
  • e8ab1e6 - 2f0acb9: display node numbers

At this point rendering the node tree seems quite complete. The development focus now shifts back again to integrating the view into the device-specific UI layouts.

  • 4086fc2: drag handle drawing is now more sophisticated
  • abc2525: size distribution of board view / node tree view is now a user preference

herzbube added a commit that referenced this issue Mar 4, 2023
change details
- node tree view is now displayed in both Portrait and Landscape
  user interface orientations, for both UITypePad and UITypePhone.
  the view is displayed in addition to everything else, i.e. no toggle
  feature like in UITypePhonePortraitOnly.
- node tree view and node numbers view now support different color
  schemes for light/dark mode
- improved orchestration during NodeTreeViewController dealloc: the
  controller now explicitly removes observer registrations so that the
  observed objects are guaranteed to be still alive
- fix board position collection view border in UITypePhonePortraitOnly
- apply transparent style to node tree view and node numbers view
  in UITypePhonePortraitOnly
- reduce minimum size for node tree view resizable pane from 30% to 10%
@herzbube
Copy link
Owner Author

herzbube commented May 4, 2024

In the year since the last comment, the work on this feature has been finalized, bugs were eliminated and unit tests were written. Overall it's too much effort to link all the relevant commits to this feature.

@herzbube herzbube closed this as completed May 4, 2024
@herzbube herzbube modified the milestones: 2.0.0, Soon May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant