Page 1 of 2

Coup - I'm trying to increase the player count

Posted: 15 February 2021, 19:24
by admiralspunky
I changed the setup in the PHP:
//$copies = count($players) >= 7 ? 4 : 3;
$copies = count($players) <= 6 ? 3 : 3 + intval( ceil( (count($players)-6) / 2 ) );


I changed gameinfoes.inc and reloaded it in my project, but now it looks all messed up when I try loading the game with >8 players.
Capture.jpg
Capture.jpg (75.61 KiB) Viewed 1313 times
What did I forget to do?

Re: Coup - I'm trying to increase the player count

Posted: 16 February 2021, 03:14
by quietmint
Hello, this is my game. :)

To display the players around the table, there's custom CSS for each player count. This circular layout is not happening by magic. I calculated the appropriate size/rotation/spacing/position for each player across all the player counts manually. There is a parent element with classlist containing "circle-6" that gets applied to the parent element, and each player is a child with classlist "oncircle player-4" based on the player's order. The resulting CSS will be like "transform: translate(-199px, 115px);" to position that particular player.

In addition to the custom position, since the players can overlap (e.g., during the moment while using the Ambassador's action and you have 4 cards in hand), there's also appropriate z-index on each player so they are layered on top of one another correctly.

Re: Coup - I'm trying to increase the player count

Posted: 19 February 2021, 19:56
by admiralspunky
Where does the game access its own css? Is there a "<link rel=”stylesheet” type=”text/css” href=”yourdefaultstyle.css” title=”default” />" somewhere that I'm missing?

Re: Coup - I'm trying to increase the player count

Posted: 20 February 2021, 01:09
by Tisaac
admiralspunky wrote: 19 February 2021, 19:56 Where does the game access its own css? Is there a "<link rel=”stylesheet” type=”text/css” href=”yourdefaultstyle.css” title=”default” />" somewhere that I'm missing?
That's handled by the framework.

Re: Coup - I'm trying to increase the player count

Posted: 20 February 2021, 15:49
by admiralspunky
I might be stuck, then. I'm trying to increase the player count, which should be a simple change, but everything is hard-coded into the CSS (which is poor programming practice). I could try to fix the existing CSS, but it's such a mess that it'd probably be easier for me to write my own CSS from scratch, and do it properly this time. However, if I did that, then I would be affecting games in progress. So I was going to write a CSS switcher - which I've done before, and would (probably) be pretty easy to do here, but I don't have access to the place where the site sets the CSS for the game.

After that, I was going to add some extra characters (there's a nice list at https://boardgamearena.com/forum/viewto ... 99&t=19633), but again, each individual character is hard-coded into the PHP, and also the CSS. I'd want to write a data structure for a Character, something like

Duke {
Color = FFCC00;
Name = "Tax"
Desc = "take 3 coins" }

Then it would be a whole lot easier to add additional characters.

Re: Coup - I'm trying to increase the player count

Posted: 20 February 2021, 16:16
by Tisaac
admiralspunky wrote: 20 February 2021, 15:49 I might be stuck, then. I'm trying to increase the player count, which should be a simple change, but everything is hard-coded into the CSS (which is poor programming practice). I could try to fix the existing CSS, but it's such a mess that it'd probably be easier for me to write my own CSS from scratch, and do it properly this time. However, if I did that, then I would be affecting games in progress. So I was going to write a CSS switcher - which I've done before, and would (probably) be pretty easy to do here, but I don't have access to the place where the site sets the CSS for the game.

After that, I was going to add some extra characters (there's a nice list at https://boardgamearena.com/forum/viewto ... 99&t=19633), but again, each individual character is hard-coded into the PHP, and also the CSS. I'd want to write a data structure for a Character, something like

Duke {
Color = FFCC00;
Name = "Tax"
Desc = "take 3 coins" }

Then it would be a whole lot easier to add additional characters.
Why should it be a simple change ? You have to work out the layout for one extra player at minimum.
Are these characters officials addons ? If yes, are you sure the license cover these as well ? If not, BGA is not making houserules so not possible without explicit approval.
How would your structure implement the corresponding rules ??
Have you read tutorials and docs ??

Re: Coup - I'm trying to increase the player count

Posted: 20 February 2021, 18:33
by admiralspunky
Coup doesn't show up on https://en.studio.boardgamearena.com/licensing ; where is the license?

Those extra characters that I mentioned apparently come from Complots 2 https://boardgamegeek.com/image/3115079/complots-2

I've seen the Inquisitor in a few places, but where did the Diplomat come from?

Yes, I've done the tutorials, and read the docs, and watched the slideshares, and I've submitted a couple of projects already, but it's entirely possible that I missed some things.

e: Oh, and as for the corresponding rules, most languages have a parse() function somewhere. I bet it's possible here, too.

Re: Coup - I'm trying to increase the player count

Posted: 20 February 2021, 19:01
by Tisaac
admiralspunky wrote: 20 February 2021, 18:33 Coup doesn't show up on https://en.studio.boardgamearena.com/licensing ; where is the license?

Those extra characters that I mentioned apparently come from Complots 2 https://boardgamegeek.com/image/3115079/complots-2

I've seen the Inquisitor in a few places, but where did the Diplomat come from?

Yes, I've done the tutorials, and read the docs, and watched the slideshares, and I've submitted a couple of projects already, but it's entirely possible that I missed some things.

e: Oh, and as for the corresponding rules, most languages have a parse() function somewhere. I bet it's possible here, too.
You probably needs to contact original dev or admins to know if the license covers this expansion or not.
And how a parse fonction would actually implement the rules automatically ??? If you manage to do that, you can become pretty rich I think

Re: Coup - I'm trying to increase the player count

Posted: 20 February 2021, 19:32
by admiralspunky
Ha. I don't need to become rich, but a non-zero amount of income would be nice.

I've set this parse() thing up in a few places, but never in PHP. However, I imagine you could do something like: put a text variable in your Character class that contains the string

Code: Select all

action = "getPaid(3)"
, and then, wherever you need to access that action, you just call some form of

Code: Select all

parse(Duke.action)
But that's beside the point if we're not allowed to add our own imaginary characters (except for the Diplomat, which is okay for some reason?)

Re: Coup - I'm trying to increase the player count

Posted: 22 February 2021, 16:23
by admiralspunky
I'm trying to find where the PHP file actually checks the options when it sets up the game. So far I've just gotten as far as:

Code: Select all

    public function meetsVariant($ref) {
        if (is_array($ref['variant'])) {
            foreach ($ref['variant'] as $key => $value) {
                if (self::getGameStateValue($key) != $value) {
                    return false;
                }
            }
        }
        return true;
    }
What's going on there? It looks like you've got a two-dimensional array, and you're... comparing each element to another list? I can't tell.