does 1000 still layers slow program down?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1400
Joined: Sun Feb 14, 2010 7:11 pm

does 1000 still layers slow program down?

Post by Bugala »

Instead of trying it out, I thought ti be easier to ask.

As I am making this Card based game right now, I have been thinking as one possibility to actually have all the cards at table for real so to say. That right now I am simply using table "somedeck" and when i draw a card, i take the topmost card from the deck and create that card. But another possiblity would be that all the cards would be there as layers already for real, in which case i could for example pile them so that each card would be at 1 pixel different place from the previous one, which would also make player see how many cards are left on the deck. It would also serve some other purposes that could perhpas make rogramming some parts of the game easier, and also give the interesting possibilty of letting player drag cards freely around as he wishes.

Anyway. lets say those cards are 400x300 pixels in size. Lets say theres 200 cards in total.

That would mean, that during the runing of program, there would be about 200 layers at same time on screen, which would all be still, and most wouldnt even be seeable as they would be on top of each other (unless i do that 3D effect by placing them 1 pixel apart from previous one of course).

If then only one of those cards (Layers) are moved at any one time, while all the rest are lying still. Would this slow the program down a lot, or not?

That can i have even 1 million big layers that all lie still, without it really affecting the speed of the program, as long as those layers lay still?
User avatar
airsoftsoftwair
Posts: 5887
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: does 1000 still layers slow program down?

Post by airsoftsoftwair »

It depends. If the layer is in the visible area of the display, it will be drawn - even if it is currently covered by another layer. This means that it can get very slow with lots of layers. To speed up things, just hide the layers that aren't visible anyway. Then you can have many, many layers without any noticeable slowdown.
Bugala
Posts: 1400
Joined: Sun Feb 14, 2010 7:11 pm

Re: does 1000 still layers slow program down?

Post by Bugala »

That hidelayer didnt even come to my mind. That could do the trick, although i would miss the 3d effect and possibility of freely draggin cards around. But for my current actual needs purposes, this could be the solution. Thanks!
Post Reply