How do I setup a card driven game?

Get help using Construct 2

Post » Wed Oct 21, 2015 2:45 pm

Hey, I hope I´m posting in the right forum.

So I´m making a card-driven roguelike game and I got most of the elemental mechanics to work and now I´m about to create the cards, but before I setup the system I wanted to talk with people, who can provide me some help regarding performance. The game is targeted for Android devices, so efficient memory usage is my priority. I come up with two ways to make the card system. (The maximum of visible cards is eight.)

1. Each card get its own sprite and will be included in a family with several booleans, numbers, and so on.

2. I make one sprite with frames for all cards. Information changes will be run through events.

Pros and Cons

1. Changing information on the fly. Better overview during development, but the game has to load many objects at the beginning.

2. Less objects to handle, way worse overview, much more work in the event sheets.


So, my question is, which way is the better one in the end? Would it be so bad, if I load my planned 300 cards at the beginning of the game, destroy them and then create them when I need them (when they´re drawn), or should start just with one object, so the memory just has to load the frames. Or do exist other methods I didn´t think about? From my understanding, the second way should be the more efficient one, but how much worse is the first one?

Hopefully you get my point, English isn´t my first language. I´ve read the FAQs about performance, but before I get to the meat of my game and just wanted to be sure, how my next steps should look like.
B
3
Posts: 1
Reputation: 177

Post » Wed Oct 21, 2015 3:01 pm

Option 2 wins hands down.
Option 1 is actually harder, especially when you have to make changes (and there are going to be plenty)

And all cards look the same, the only thing that changes in the data on it, let the array handle the data, including what little images to show that are pinned to your card.

Also Create cards as you need them. And don't be scared to destroy and write data back into database. Allow the array to do what it does best (handle information) and put your code into functions that have multiple actions

Fetch card >
param(0) = Type of card
param(1) = IsOwnedby
Param(3) = etc
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Wed Oct 21, 2015 3:05 pm

Hi @freshdeus, My English is not so good either,

I am working on a system, that lets you just upload the card suits, and the face cards. The cards are assembled in real time and the entire package is under 500k. I made a similar system in the Unity Store, and it has sold quite a few copies. DUTOIT gave me the idea a few years ago, and I have profited from it greatly.

If you are interested in something like this for your game send me a Personal message.

All you need to do is worry about the actual game. The cards will all be taken care of. The theme, and the card styles can all be changed in real time. The users can even make their own custom decks.

Entire system has 6 Sprites!!!! Perfect for your celphone project!
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 21, 2015 3:11 pm

I would do it with the frames for each card, unless I was planning to animate them, in which case I would still use the same sprite and make different animations for each card. It makes managing your object list a lot easier.

(I believe you could put an animation in the sprite with 1 frame of the back of the card. and could switch to that animation to flip the card. Even though there is only one frame in that animation, the frame would stay the same, so when you switched back it would still be the same card. In other words, you could still check the frame number to see what card it is even flipped down.)

You can still place all the cards off the visible screen in design time, and edit each card's instance variables manually.
B
226
S
60
G
33
Posts: 902
Reputation: 39,989


Return to How do I....?

Who is online

Users browsing this forum: duke2704, sebrosen and 28 guests