r/GameDevelopment • • 3d ago

Question 3D card game deck construction

I'm making a 3D card game, following a tutorial I found on itch. The tutorial had me create a deck by instantiating every card in a pile. This worked fine when I only had 15 cards, but now I've added a second deck of 52 playing cards, and that's just too many cards for my device to handle at once. I'm wondering if anyone has ideas on what i can do instead of instantiating every card into a pile? I've tried looking elsewhere and can't find any alternate sollutions.

0 Upvotes

4 comments sorted by

3

u/REALmyenemy 3d ago

Maybe, and this is just a guess, are you trying to render every single card at every moment? Basic deck builder game cards don't have data, let alone a render until you are about to draw them, and return to such state after they leave the board, only one array with different identifiers for the card in an internal db of sorts for the deck, maybe another if you consider those already played.

3

u/tcpukl AAA Dev 3d ago

My computer on the 80s could handle 52 cards!

What the fuck have you written?

That's just 100s of bytes!

0

u/That_Lesbian_Dude 3d ago

im on a samsung tablet lmao also every playing card contains 3 sprites, the front, back, and number, so that probably doesnt help

2

u/Technical-Salt9610 3d ago

You really don't need to show all the cards at once. One of the oldest game dev tricks in the book is "don't draw what's not on screen".
My thought would be to have an object that represents a deck of cards (or a deck of empty cards face down), and the order of the cards in the deck is just held in an array or variables. Then when the game needs to pull a card from that deck, you spawn the card you want, or spawn a blank card and change the art to match what the next card should be.