Hi VASSAL Ninjas,

I’m designing a game where there could potentially be a large number of cards, say well over a thousand. Before I go and design all those cards in my graphics app, I’d like to know if there’s a limitation as to how many cards a running VASSAL module can support.

Let’s say (to keep the math simple) that each card is graphically realized as a 90 Kbytes PNG file. I’m assuming that in VASSAL, a card is a Java object or something that would import that PNG, plus have extra data and metadata for the card’s traits. So perhaps in memory, each card is **90 Kbytes PNG + 10 Kbytes data = 100 Kbytes total**.

Now, if I want a deck of 100 cards, I’ll need **100 Kbytes/card * 100 cards = 10,000 Kbytes = 10 Mbytes** of system memory just for the cards alone. I have no idea if my laptop can support that, but is this the correct way to think about system requirements and total number of cards when designing a VASSAL module?

Thanks! -ROA

1 Like

Image file size is irrelevant; only image dimensions matter. Image data is stored in memory at 4 bytes per pixel. What are the dimensions of your cards? What’s the largest number of them you envision being displayed simultaneously?

@uckelman Thanks for writing back! I am toying with two card sizes. The smaller cards would be tiny, approximately 70x70 pixels. The larger cards would be 200x350 pixels.

So…

The smaller cards :: ( 70 * 70 pixels ) * ( 4 bytes/pixel ) = 19.600 Kbytes/card?

The larger cards :: ( 200 * 350 pixels ) * ( 4 bytes/pixel ) = 280.000 Kbytes/card?

Assuming the above math is correct, how would I determine the max number of cards a low-end system could support? (I know that’s a Computer 101 type question, I’m a rookie here.) If I go with the smaller cards and create 250 cards total, then:

( ~20 Kbytes/card ) * ( 250 cards ) = 5 Meg just for the deck…???

Thanks!

At 200x350, a thousand card faces would be 267MB if they were all in RAM at once. I’m guessing you would not have a thousand cards visible simultaneously, so in practice you would not get anywhere near that.

The maximum heap setting with which Vassal loads a given module is the controlling factor here. All the images visible at once have to fit into the heap, along with anything else Vassal is using. The default max heap is 512MB these days, so I suspect you could do what you’re planning without needing to adjust it.

Even the lowest end machines these days will be able to run with a 512MB heap.

@uckelman Thanks, I appreciate the detailed information. Stupid question… the 512 MB heap size would be for the ENTIRE module, correct? Boards, units, dice, cards, everything?

I also assume that 512 MB is a hard limit, because VASSAL can’t or won’t request any more heap space after the initial 512 MB is used up? Curious about the limitations, this is fascinating stuff.

THank you!

Correct.

Can’t, because that’s how Java’s designed. If you need more heap, you can adjust the setting in the preferences and reload the module.

@uckelman Thanks, your info is so interesting. I think I’ll live under the 512 MB threshold, that seems more practical. Thank you so much for taking the time to write!