Jump to content

Specific performance question


Dream Of Sleeping
 Share

Recommended Posts

Hello. First let me just show you a screenshot so it's easier to understand what I mean. https://twitter.com/dreamofsleeping/status/434714377254486016/photo/1

 

This shot is a bit old now, and there is even more sprites on the screen now. My game is just going to be aimed at desktops. But you see those colorful conveyor belts? Well I need to give the impression they are moving. So I need rotate the little circles. I probably only need about 4 or 5 different frames. But I'm unsure the best way to proceed.

 

1. I could have multiple images of each entire conveyor belt. But as the only thing is changing is the circles it seems like a waste.

2. I could have the circles as separate sprites, and rotate them.

3. I could have the cirlces as separate sprites and animate them.

 

If I have them as individual sprites that is 24 more sprites on the screen, and if they are all rotating is this significant? There is already a lot going on.

 

If performance isn't an issues which would you consider the most elligent solution? You might think this is a bit of a silly thing to post a topic on, and you're probably right I've been thinking about this for a while. All of them are a bit awkward to implement, so it would be cool to get some feedback first. Thanks.

 

 

Link to comment
Share on other sites

If you are aiming at desktop then I don't think you've got enough sprites on-screen yet to have to worry about performance, so you could quite happily animate or rotate all of those little wheels.

 

How I would do it depends on the game aesthetic: if going for a more retro style then you may want a frame animated approach. However if you want it to look smooth, and maybe need to vary the speed of rotation in time with the things moving on them, I would rotate them.

Link to comment
Share on other sites

Thanks for replying. I could try the rotation first and see how it goes.  I perhaps should have taken the time to post a more recent screenshot. http://i837.photobucket.com/albums/zz299/dreamofsleeping/My%20Games/sortbots.png

 

There is a bit more going on now.

 

Also does transparancy of an image make a difference? As it is pretty much a black background, images that have a lot of transparent parts, I could just have black instead.

Link to comment
Share on other sites

Also does transparancy of an image make a difference? As it is pretty much a black background, images that have a lot of transparent parts, I could just have black instead.

 

Storing transparency requires an extra alpha channel and thus one more byte (is that right?) per pixel. Add a black background only if you are sure that your background will remain black. Otherwise you'll have to change all you assets later.

Link to comment
Share on other sites

I'm not convinced. CanvasPixelArray for example has no option to not have an alpha channel. Loading a non-alpha image (gif for example) into an Image object and then getting the pixel data always returns an alpha channel with everything set to 255. In short, I'm pretty convinced if you don't have one, it creates one for you regardless.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...