-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
At the moment, processAction is a synchronous function. This means that when the action of a player arrives.
Client-side, it may be useful to allow for an asynchronous processAction. This could be used to trigger animations during the processing of an action. In code, this would translate into:
async processAction(userId, action) {
if (action.type == "pay-money-for-item-in-shop") {
await decreaseMoneyOfPlayer();
this.state.money -= priceOfItem;
await animateItemFromShopToPlayerInventory();
transferItemFromShopToInventory();
}
}This is useful because sometimes you may want to maintain the state of the game to an intermediary state, between the processing of actions.
This would have a lot of impact on the architecture of Ravens, as all the code was done synchronously. There are also some questions that should be answered, like what to do when an action arrives from the server while processAction is waiting for a promise.
Reactions are currently unavailable