![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR25rswOCbmVs1gwbV9AcR4sRZiVbiW9QlhdKJTDPXikZuSvIadmWpqGz8UHg0alVdNRhicMwJkLZb5g74e8B5rRmNC0cGzrfVbeuX2YwrmmiRghCGHodSLCm2_jeAGG8_sz1_wUYgoEih/s320/tweak-example-pic.png)
I am investigating how to integrate a Tweak app with Croquet. Read on for a little intro. Get it:
The code of the simple example and the Tweak-in-Croquet TEmbeddableApp implementation.
There's currently certainly the 2D-overlay menu of for example the KAT Demo which is implemented in Tweak. But besides that what really matters to me is to have 3D windows with Tweak apps inside. Example (do you find the bug?):
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjavpYqgbt2eWBhPL-ROp0uZMZ0H5p4qCz39fcI8QGK8Ts7RtrCZ1ctjdpECrhE49sZ2tl1GO8apoKxJMI_kb9sA-bdNz0Arz3vV8TBx_JxIbG0eI59KctNxIaZSvT4gC3SnryPDNIScb8U/s320/tweak_in_croquet_no_sync.png)
Why is that? Actually the architecture of TEmbeddedApp is creating an app locally, next to each replica of the island (don't know the terms? Look at the Croquet Architecture Introduction). There's a mechanism in CroquetHarness, #updateEmbeddedAppsIn:, which handles the creation of the local copies for the embedded apps.
Embedded apps are of course not in the island - so during sync they aren't snapshotted and copied over to the joining node. They need to care for this synchronization themselves. That's what the appData in the TEmbeddedApp object is good for. Every app instance needs to update its replica's appData-copy. No joke (and no network traffic for this)! That's the current architecture for embedded apps. SyncSend is the keyword, with it you are accessing island-data directly.
So if you want to build an embedded app - or integrate an existing Tweak app, then you have to provide means to load existing state from the appData and of course you have to store each change to the app's state in the appData object. See CSimpleEmbedTweakPlayer's state-mgmt category in the provided code.
That's also how the morphic app KTextApp/KMediaText is working:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3nKgbIvhL8JlOhlUSBVbB2dn_1KXUGL-xh_KCdZuawlkInFf63Em2EKlnRHEYWLfaMPZlYdGzFC8ZmkLrJ4QHdKXt_UelGImmVPNpQL8YpsfjhZlU_sBitSVD7Dt3K_hwHNCmZL5tvEZE/s320/Croquet_textapp_syncSend_commented.png)
I am currently investigating a framework for the creation of embedded apps. The state-saving should be supported by a framework and the default widgets should provide adapters for this kind of state-persistence. I hoped I can sooner provide a demo for that, but I dragged on so I created this simple demo for the meantime.
I hope that this draws some comments! :- )