This idea is for a separate plugin or even library; good idea @mickare; not as something meant to be incorporated directly into the SpongeAPI.
I made something like this for bukkit. I didn’t get it out before bukkit died but I would be glad to help you make this for sponge.
I feel like there’s really not much more to say other than perhaps an even more in-depth elaboration of what is said below, but this is something that I highly recommend reading.
From @garbagemule (source):
For this kind of thing to succeed and become useful, you need to consider all of the existing, well-established minigame plugins. For them to join along, it has to be possible to implement support for this framework very easily, and it has to be non-intrusive, so they can function without it as well. I’ve been thinking about unified minigame frameworks since the first time someone said "I can join arenas while in " on the MobArena IRC channel, but the biggest problem I found is making it vague enough that any type of minigame can easily hook in, and still specific enough that it provides some sort of usefulness instead of just “implement these interfaces all over the place, but you still have to do everything yourself”. Generic interfaces for full control, abstract half-implementations for a starting point, and full implementations for easy compositional design to create new games just from what is in the framework. You’ll likely need to cover all three (like how e.g. Swing does it).
A few thoughts on the problem of finding boundaries:
A game does not necessarily have to be endable. Consider a classic free-for-all battle where you respawn 30 seconds after dying, and the game never really ends. Players can join and leave as they please without repercussions (aside from perhaps losing their session score).
Games do not necessarily have to have regions. With Minecraft being an open “infinite” world, it is only natural to want to make types of games that exploit this. For example, consider a minigame in a world of its own, where the goal is to be the first person to build full diamond armor. It might not be feasible to create a region of 1000 x 1000 blocks - maybe more space is required.
Some minigames have the notion of a pre-game phase (e.g. picking classes in the lobby in MobArena), which perhaps should not be counted as the game having started.
Concurrent sessions for a particular minigame should be possible (e.g. multiple arenas in MobArena), so “this minigame has started” might not be appropriate when it is still possible for other sessions to run concurrently.
I’m not saying you haven’t given any thought to any of these problems, but I want to make sure it’s up there. I’d love to see a unified framework for minigames so I don’t have to make silly hacks like disabling certain commands in the arenas, but there is no way I’m rewriting MobArena to dependon it to even work, just like it doesn’t depend on Vault for permissions, but uses it when it is available.
If you’re making a game framework please take in ideas from many different perspectives and plan always from the highest level of abstraction in order to support different implementations and infinite expansion. The framework would need to be abstract, generic, and specific all at the same time.
Plan the framework out carefully and discuss different approaches/implementations with others before tackling them. If you want this to be a public and collaborative creation (which I’d assume from this being posted here).
Looks like a great idea at the start though as it’s been mentioned there has to be an extremely high amount of abstraction. Really make it more of a type of Utility with extra features as to not intrude.