Page 1 of 1

Create a fake zombie player

Posted: 09 January 2021, 18:55
by Ralchimist
Hi!

I'm working on Mahjong.
The 3 players version is a 4 players version with a dead player.
Because the dead player is doing same actions than my ZombieTurn function, I'm wondering if it will be a good way to create a fake 4th player and make him as a zombie.
Or is there a better way to do it?

Thanks for answers and advices =)

First edit: when I had a player on the DB, it's worked but I have this error on the top of window "WARNING: the number of players at this table (4) is not coherent with the number of players as known by BGA (3). We recommend you to abandon this table and report this as a bug!"...

Re: Create a fake zombie player

Posted: 10 January 2021, 13:59
by Draasill
I really don't think you can do this, as a zombie player will trigger other things (abandoned game, etc).

But if you "zombie" actions are well wrapped in your code, it should be feasible to use them by a "virtual" player ?

Re: Create a fake zombie player

Posted: 25 January 2021, 06:09
by quietmint
I also have a need to do this, and also ran into the same issues about the warning message (as well as an annoying PHP Notice because of some undefined variable in game.view.php line 1031). I'm developing a cooperative game where all the humans play against a single AI. I want to add a row in my players table for the AI player (because I must store the same attributes for the AI as for other players, and because I must display a player panel for the AI). I hadn't thought of making the AI player a zombie, but that doesn't sound like it would work (you'd need to differentiate the AI zombie from human zombies, but I don't think it's possible to access active player ID inside the zombie code). An eliminated player may be better than a zombie player, but it still gets activated in turn order and won't trigger zombie code, but that doesn't solve the root issue about unable to insert fake rows in player table.

Re: Create a fake zombie player

Posted: 25 January 2021, 12:25
by Een
Well, yes, the player table is ceated by framework, with lots of implications about handling everything.
Inserting fake rows into the player table is definitely something not anticipated and not supported in the current state of the framework.