How to change card size in Stock?

Game development with Board Game Arena Studio
Post Reply
User avatar
chinkes
Posts: 3
Joined: 17 December 2021, 19:13

How to change card size in Stock?

Post by chinkes »

Hi!

I have high definition card images that are way too big to display at their full resolution. I have them in a Stock for the player's hand. How do I make them smaller? I've tried adding an extra class as described in the Stock documentation and then using background-size for that class in my css file. That does change the size of the card, but then the entire sprite sheet displays instead of the single card.

Thanks!
User avatar
i_a_green
Posts: 7
Joined: 31 March 2020, 22:04

Re: How to change card size in Stock?

Post by i_a_green »

The way I have it working is as follows:

I have a 2500 x 4080 image representing a 5 x 6 array of cards on the sprite sheet (i.e. 30 cards total)

In the css for the stockitem I have :

Code: Select all

background-size: 500px 816px;
so this is 1/5th the original size.

Then when I create the stock I use:

Code: Select all

cardwidth = 100;
cardheight = 136;
Which is the size of 1 card after shrinking.

You don't have to shrink it by a whole number ratio, but I think it will probably look better if you do.

Hope that helps.
User avatar
thoun
Posts: 1620
Joined: 10 December 2020, 22:25

Re: How to change card size in Stock?

Post by thoun »

Why not resize the image? It will also make the file smaller
User avatar
i_a_green
Posts: 7
Joined: 31 March 2020, 22:04

Re: How to change card size in Stock?

Post by i_a_green »

thoun wrote: 01 February 2022, 15:22 Why not resize the image? It will also make the file smaller
It will not look as good, especially when you zoom in.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: How to change card size in Stock?

Post by Tisaac »

i_a_green wrote: 01 February 2022, 15:18 I have a 2500 x 4080 image representing a 5 x 6 array of cards on the sprite sheet (i.e. 30 cards total)
You might have trouble on "old" android devices of assets not loading.
User avatar
i_a_green
Posts: 7
Joined: 31 March 2020, 22:04

Re: How to change card size in Stock?

Post by i_a_green »

Tisaac wrote: 01 February 2022, 15:28
i_a_green wrote: 01 February 2022, 15:18 I have a 2500 x 4080 image representing a 5 x 6 array of cards on the sprite sheet (i.e. 30 cards total)
You might have trouble on "old" android devices of assets not loading.
Interesting. I'm sure I remember a finding a suggested size limit somewhere on the wiki (can't remember if it was pixels or MB) but made sure to resize down enough to come under that limit. Do you know what "old" android devices can handle?

I have some fairly old devices kicking around so I'll be sure to test it on them.
User avatar
i_a_green
Posts: 7
Joined: 31 March 2020, 22:04

Re: How to change card size in Stock?

Post by i_a_green »

This page: https://en.doc.boardgamearena.com/Game_ ... _directory suggests 4096x4096 as an upper limit.
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: How to change card size in Stock?

Post by Tisaac »

i_a_green wrote: 01 February 2022, 15:35
Tisaac wrote: 01 February 2022, 15:28
i_a_green wrote: 01 February 2022, 15:18 I have a 2500 x 4080 image representing a 5 x 6 array of cards on the sprite sheet (i.e. 30 cards total)
You might have trouble on "old" android devices of assets not loading.
Interesting. I'm sure I remember a finding a suggested size limit somewhere on the wiki (can't remember if it was pixels or MB) but made sure to resize down enough to come under that limit. Do you know what "old" android devices can handle?

I have some fairly old devices kicking around so I'll be sure to test it on them.
It's pretty hard to find proper documentation on this issue, see for instance this thread :
https://stackoverflow.com/questions/125 ... -in-chrome
It's probably something like "the older the device, the smaller max-size" so it's hard to set a limit but I usually try to keep under 2000px in any direction, it's usually way enough anyway, or I split my sprite if needed.
User avatar
chinkes
Posts: 3
Joined: 17 December 2021, 19:13

Re: How to change card size in Stock?

Post by chinkes »

Thanks for the replies!

I tried to add pixel size to the background-size of the stockitem as you suggested and it didn't size correctly for some reason (perhaps a mistake on my part). However using percentages worked perfectly. So for my 7 columns and 6 rows sprite sheet I used:

Code: Select all

background-size: 700% 600%;
It works great! Thank you!
Post Reply

Return to “Developers”