Coder Social home page Coder Social logo

Comments (7)

amiantos avatar amiantos commented on June 1, 2024

I was curious how NetNewsWire handles iCloud syncing and it looks like it uses CloudKit https://github.com/Ranchero-Software/NetNewsWire/tree/main/Account/Sources/Account/CloudKit

Wonder if their implementation is the most straightforward way to implement CloudKit. Since GBE is already using core data in a fairly standard way, maybe using CloudKit for database syncing wouldn't be a big deal... only one way to find out I guess...

Docs: https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit

from gamebookengine.

amiantos avatar amiantos commented on June 1, 2024

Doesn't look like the core data store in GBE has any problem with CloudKit requirements: https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/creating_a_core_data_model_for_cloudkit#3191035

from gamebookengine.

amiantos avatar amiantos commented on June 1, 2024

Doesn't seem like it would be all that difficult. And once the database gets into iCloud, we could write a web app.

Now, that said, users need to be able to opt-in to this, not opt-out, as I do promote the privacy and disconnectedness of Gamebook Engine. I assume I should be able to set it up that way.

from gamebookengine.

amiantos avatar amiantos commented on June 1, 2024

Got blocked trying to generate a CloudKit schema.

CloudKit integration does not support ordered relationships. The following relationships are marked ordered:
Game: pages
Page: decisions

CloudKit integration requires that all attributes be optional, or have a default value set. The following attributes are marked non-optional but do not have a default value:
Attribute: name
Attribute: uuid
Consequence: uuid
Decision: content
Decision: uuid
Game: name
Game: uuid
Page: content
Page: uuid
Rule: uuid

CloudKit integration requires that all relationships be optional, the following are not:
Attribute: game
Consequence: page
Decision: page
Page: game
Rule: decision

This might not be a big blocker. Pages don't need to be ordered in a game, literally no reason for that. And decisions... well... ordering seems like it might be important there though there is currently no way to actually reorder decisions on a page. If we want to keep ordered decisions, we can implement a displayOrder attribute easy enough.

"default value" is interesting, I wonder if default value can be an actual UUID in those cases. The other things have in-code defaults really.

And then the optional relationship thing... I mean... if an attribute doesn't have a game, if a consequence doesn't have a page, that's just bad data. But maybe it's not a big deal to consider those things optional.

Schema changes does mean migrations but maybe it's not a big deal...

from gamebookengine.

amiantos avatar amiantos commented on June 1, 2024

Another possibility is to set up a second core data store just to support syncing. Model would be super simple, local_uuid, game_json (the export of the game), sync_timestamp, and date_updated. I think with that we'd have enough to set up a decent document-based sync system.

from gamebookengine.

amiantos avatar amiantos commented on June 1, 2024

This doesn't have to be the solution--because I quite like my last comment's idea of essentially a document store using CloudKit--but taking that idea even further, does it not seem like Gamebook Engine could be something a bit more like, say, Pages? A productivity app? In the sense that it's acting on files. The fact that I'm loading the games into a database on the device and playing them off of that is an implementation detail. In reality it would make more sense if gamebooks lived in a Gamebook Engine specific folder in your documents or on your phone some where and you used gamebook engine to open them.

But I guess that interface is kind of lame deep down. There's no reason it can't work that way, though.

In reality Gamebook Engine is more like Books.app, where you drag files into it and then it does some hoodoo and changes the files all up into something it likes more and creates a database and syncs it to the cloud in its own way and so on.

from gamebookengine.

amiantos avatar amiantos commented on June 1, 2024

Idea of a document store backup is winning in my mind. And it should be essentially one-way where by default your books are uploaded to the sync database whenever they change, but it's not an automatic two-way sync. You can choose to overwrite your local book store with what is in the cloud if you want, but it's not going to overwrite a game while you're playing it. I was really overthinking the issue for a bit there.

from gamebookengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.