Ciudane is an future proof-of-concept 3D low-poly metaverse with realistic gameplay interactions. It features a working smartphone with a modular system capable of running isolated “applications” that work totally agnostic from Unity (no MonoBehaviours!) in C#.
This is a little tricky to understand but actually it’s quite simple and designed to be so.
Let’s take a look at the most simple application. It doesn’t even display any UI on the screen.
There are a few interesting points to look into:
- All applications implement an abstract class Application that provides us with a Smartphone class and a Metadata struct.
- The apps work event-driven. Simple logic is written and then thrown to smartphone events. In this case, a hardware change is invoked.
- The apps are instantiated on the fly, so you can consider adding “background threading” in the constructor. We’ll see that in the notifications app.
With that in mind, you might have an idea how the Camera App works:
Now there is some simple UI using widgets. Widgets are contained self-sufficient, independent components used to build a larger view.
In this case a CameraImageWidget is sent to the smartphone to be drawn. This one is created with a Front CameraType to tell the widget what to display exactly.
We’ll look into widgets in another post. For now let’s focus in application behavior.
Right now we know that applications are capable of:
- Controlling their behavior when they’re opened and closed.
- Sending hardware events to tell the smartphone to start, toggle or disable funcionalities like a flashlight or a camera.
- Sending software events to tell the smartphone to control a view (SoftwareIntent.Open) or close it (the Application’s Close base method already does it for you)
- Sending software events to draw widgets. These widgets can be built before being sent.
And there is much more to come.