Game specific notepad stored in player db?

Game development with Board Game Arena Studio
Post Reply
cranflavin
Posts: 4
Joined: 12 November 2022, 01:12

Game specific notepad stored in player db?

Post by cranflavin »

I've been working on the game Alchemists, and there is a notepad in the game that users use for the deduction puzzle. I'd like players to be able to modify this notepad at any time and store it in the player SQL table. However, the only way I can see to allow players to modify this at any time is to make all my game states multi-active states, so all players can always perform the action (which is kinda gross). Is there an alternative mechanism by which a player can do an action at all times, even if they aren't the active player? Or is there another obvious mechanism for this that I'm missing?
User avatar
SwHawk
Posts: 133
Joined: 23 August 2015, 16:45

Re: Game specific notepad stored in player db?

Post by SwHawk »

You don't specifically have to make all states multipleactievplayer, you can just allow an out of turn action when the player updates their deduction grid. You would obviously need to use checkPossibleAction instead of checkAction.
cranflavin
Posts: 4
Joined: 12 November 2022, 01:12

Re: Game specific notepad stored in player db?

Post by cranflavin »

Ah thanks, that makes sense. Missed that in the docs.
basilebor
Posts: 2
Joined: 25 May 2021, 18:48

Re: Game specific notepad stored in player db?

Post by basilebor »

HI,
I had the same problem for an action in the game I dev.
I wanna player be able to send a forfeit request any time of the game, even if they are not active player.
I didnt want to change all my states to multi-active states just for this.

From the client javascript non active player I have a button that do an ajax call to the server to store data in the DB even if player is not active.
I do just a
➡ js fle :
this.ajaxcall("/mygame/mygame/writeText.html", { text : myText}, this, function( result ) {}, function( is_error) {});

➡ myGame.action.php
public function writeText()
{
self::setAjaxMode();
$text = self::getArg( "text", AT_alphanum, true );
$this->game->writeTextInDb($text);
self::ajaxResponse( );
}

➡ mygame.game.php
function writeTextInDb($text)
{
$sql = "UPDATE database etc
}

Player dont need to be active to do these action
Post Reply

Return to “Developers”