Combining multiple sprites into one "Sprite"

0 favourites
  • 7 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Yo!

    So, I have my project, which I've made a system that consists of having characters that are customisable, and generally may contain about 20 sprites being positioned onto the body. This works fine, and I'm not having much trouble- Until I decide I want to create more characters at once, which is needed. When I reach about 10 characters (20*10=200 sprites being individually positioned and angled), it's completely obliterating the fps!

    Sooo... the way round it... Is there a way to sort of "combine" sprites at runtime (during runtime so the player has the freedom to customize still) and have them animate as if they were just a regular sprite?

    I sure hope this is possible. <img src="smileys/smiley24.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Bump!

    I have found the plugin "Canvas" created by R0J0hound, and this is almost exactly what I needed, but I'm not sure what the most efficient way of making animations with this. Is there a way to sort of temporarily store the data in a canvas so it could be animated? <img src="smileys/smiley17.gif" border="0" align="middle" />

    EDIT: I think I may have figured this all out. I'll edit again when I have done it for sure.

  • Bumpity

    Yeah it's probably not good practise to triple post, but I'd like to ask something since I needed opinions/technical advice.

    So, I implemented the Canvas object and here's the method I done:

    -Have all the sprites that make up the character positioned offscreen.

    -Canvas positions to the offscreen sprites whenever there's a new frame of animation on the character and pastes all the sprites onto the canvas.

    -Canvas always positions at Player object.

    This works, pretty well to be honest. The framerate comparison from having 10 character detailed with Canvas is like 80fps compared to 25fps if I was using the sprites onscreen without a canvas

    (usually framerate is much higher, 120fps+)

    Thing is, each time the frame of the character changes, it's got to erase, then paste about 20 sprites into the Canvas, which I believe would be a big hit on performance. Am I right? I believe having all frames be pre-rendered in the canvas, then switching between the pre-rendered frames. Even though I don't think a plugin like that currently exists, would this all technically be a big deal?

    I had another question, but I've literally forgotten it (it is 3:22am here at the moment) but yeah, any input is good input :)

    Thanks!

  • 200 sprites is nothing for a desktop computer, usually you can reach 1000 and still get 60 FPS. Are you running your game on mobile?

  • Ashley - That's what I thought; but it seems that whenever the sprites are onscreen, things get really laggy when around 5+ characters enter the screen. I've not optimised it so that characters are deactivated offscreen, so they behave just as they would onscreen and offscreen as of now, but it's just when the character is being rendered onscreen that it lags badly. Iirc I can get about 30 characters possibly whilst they are offscreen. I'm not sure why. The only event that is run at every tick is a "For Each" loop for each and every clothing sprite, to position itself on the character, and set its angle to the bodypart that it is on.

    Everything else, layering, changing animation, changing animation frame, all happens on the "On frame changed" trigger from the body of the character. I've done other small things too, like disable collisions for the clothing sprites, but it hasn't done too much lol.

    Thanks for your input!

  • Share your .capx so we can take a look.

  • I guess that would be the best idea... I will have to empty out the project though, it's pretty big, not sure when I'll have the time to do that, but I shall! Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)