indigo
indigo copied to clipboard
Proposal: Indigo becomes a Tyrian App
Jotting this down while I remember.
Things I've been thinking about in the background:
- "There are lots of people working on Tyrian's WebSockets, what about Indigo's? Seems wasteful to have this stuff twice."
- "How are we going to decouple Indigo from Scala.js? Ultraviolet was a good start but there's a long way to go."
Indigo came first, and so it needed to know how to run on a JS platform as a standalone thing. At one point, this was a separate module called "indigo-platform", and it was cross compiled to the JVM (though only a poor experimental JVM test was made in the end).
Indigo itself is mostly platform agnostic, and these days, all the parts of Indigo that deal with the browser would be much better handled by Tyrian.
Indigo has support scripts and harnesses, but these too are crude and merely 'reference' implementations - meaning: "For goodness sake do something else with your real game!" But Tyrian is quite capable of handling the jobs those scripts perform.
Indigo and Tyrian have a bridge, true it lives with Tyrian now, but what if we moved it across to Indigo's side of the fence so that Indigo cleanly depended on Tyrian and not the other way around?
I'm left thinking that we could move all of the Indigo platform and life cycle stuff down to something built on Tyrian - not just the obvious things like WebSockets, but also the event bus, asset loading, and the frametick and so on. That would mean that Indigo is platform agnostic (90%, maybe we'd need a rendering module?) and a JS runtime built on Tyrian would encapsulate all the browser specific stuff.
Indigo is now just a lib with an API.
Later: Could we port Tyrian's runtime to the JVM and Native? Not all of Tyrian, not all the HTML stuff, just enough of the core mechanics to provide a compatible runtime? It's just fs2 and Cats Effect, seems very likely.
If we can do all that... JVM and Native support are ...still miles off - but plausible!?!