🌊Flows
Flows are customizable sequences of components within the Tavern Protocol that define the gameplay logic of decentralized games. By orchestrating the execution of components, flows enable developers to create dynamic and engaging gaming experiences tailored to their game's unique requirements.
Key Features
Customizability: Flows allow developers to define custom sequences of components to implement specific gameplay mechanics and interactions.
Flexibility: Developers have full control over the order and parameters of component execution within flows, allowing for dynamic and adaptive gameplay.
Interactivity: Flows can respond to player actions and game events, triggering component execution based on predefined conditions and triggers.
Flow Definition
Flows are defined by submitting transactions to the Game contract, where Game Creators specify the sequence of components to be executed during gameplay. Each Flow is defined as a set of component addresses and the function to call on the component.
Flow Structure
When creating a Flow, the Game Creator must provide both:
name: A unique identifier for the flow.
funcs: A sequence of component calls, each specifying the component and it's function to be executed in order.
Example Flow
Note that this example can be submitted as multiple transactions, it is only scripted for convenience. When a player calls executeFlow
and passes in playRPS
as the name, the Game will execute three functions in order:
setMatchOrWait
on the Queue ComponentoneOnOne
on the Rock Paper Scissors Component (RPS)reward
on the Reward Component
This works because the setMatchOrWait
function will update the currentMatchPlayers
property on the Game Entity, which is loaded by the RPS component. RPS will then set the winner
on the Game Entity, which the Reward component can load.
Conclusion
Flows play a crucial role in defining the gameplay logic of decentralized games built on the Tavern Protocol. By customizing flows to suit their game's requirements, Game Creators can create immersive and interactive gaming experiences that captivate players and keep them coming back for more. All this without writing a single line of code, and only submitting transactions.
Last updated