Lots of Decals?

0 favourites
  • 6 posts
  • If I have a game where I want to put a lot of decals around that I want to keep, like blood spatters or bullet holes, I know that using the sprite object wouldn't be the best idea because sprites support animation and have a ton of editable properties. A lot of sprites would simply lag the game, even if they aren't doing anything, so my question is, is there any other object type I can use for this purpose? Programs like flash have multiple subclasses for images depending on what you use them for, like a non-animating "graphic" vs a animated "movie clip" but construct only has really advanced and specific object types it seems.

    I was wondering if using the tiled background as an image would be better than a sprite, or even a 9-patch, or somehow rig the sprite font to be a decal, or is that even worse?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could use r0j0's canvas plugin, and paste the splatters.

    or more simpler: AFAIR construct2 can have lots of objects (I've tested like 500 objects at once) and there's no noticeable slowdown. You could implement a limit, as in "if I have more than 100 objects start to delete the older ones to give room to the new ones"

    Hope that helps

  • you could use r0j0's canvas plugin, and paste the splatters.

    or more simpler: AFAIR construct2 can have lots of objects (I've tested like 500 objects at once) and there's no noticeable slowdown. You could implement a limit, as in "if I have more than 100 objects start to delete the older ones to give room to the new ones"

    Hope that helps

    That may be because you have a higher end computer. Weaker computers (especially phones) can experience terrible slow downs. In one instance someone testing one of my games has physics based bullets travelling slower than you could walk even though the physics were framerate independant.

  • Sushin

    R0j0 canvas is the primary and best way to handle long term decals. However, it must be noted that each canvas is it's own memory object. If your not going to be sharing the canvas(which wuold void the point o share) then you can eat through memory FAST if you have many canvases. However if you game play environment is small and you don't need many. Then yeah. create a few canvases. use them as a decal layer and go nuts :D However if you have LARGE worlds or need many movie decal objects then try to follow the crazy mess below.

    Your best bet is to go the original route to decals of using a sprite. Identify each each decal with an incrementing number when created.

    As the game runs watch for when you drop below 30FPS. When you do destroy one decal on the screen with the lowest number.

    Alternativly you can also give each decal a PRIORITY value. And instead of destroy. you can do a

    Group: Level_Of_Decal

    var static LOD = 0     (level of decal)

    FPS < 30

    ----DECAL ON SCREEN AND DECAL IS VISIBLE

    ------ DECAL = LOWEST PRIORITY

    --------- Repeat DECAL.count * (LOD + 0.25) deactivate 25%

    --------- DECAL.setVisible to invisible

    ------ DECAL = MEDIUM PRIORITY

    --------- Repeat DECAL.count * (LOD + 0.10)

    --------- DECAL.setVisible to invisible

    ------ DECAL = HIGHEST PRIORITY

    --------- Repeat DECAL.count * (LOD + 0.05)

    --------- DECAL.setVisible to invisible

    ---- LOD = LOD + 0.1   increments a removal of 10% of base objects

    FPS > 35

    ----DECAL ON SCREEN AND DECAL IS INVISIBLE

    ------ DECAL = LOWEST PRIORITY

    --------- Repeat DECAL.count * 0.1 reactivate at 10% per

    --------- DECAL.setVisible to visible

    --------- if FPS > 15 then Action Decal Destroy(TOO MUCH TO HANDLE)

    ------ DECAL = MEDIUM PRIORITY

    --------- Repeat DECAL.count * 0.2 reactivate at 20% per

    --------- DECAL.setVisible to invisible

    ------ DECAL = HIGHEST PRIORITY

    --------- Repeat DECAL.count * 0.5 reactivate at 50% per

    --------- DECAL.setVisible to invisible

    This runs under both FPS Conditions

    -- Group Deactivate: Level_of_Decal

    -- wait 1 second

    -- Group Activate: Level_of_Decal

    Using a Level of Detail model you can probably go nuts and then let the engine sort itself out. This is what i would suggest. However the above is a quick dirty hack abstraction. You will need to sort out the details.

    Also as an update and it get's missed a lot.

    Physics in C2 uses Box2D. Physics in C2 is outside of Scirra's hands. Physics for Box2D is noted to run on Binary compiliation and CPU speed. Now physics can used Fixed time step wich will produce reliable repeatable results across same FPS machines.

    However

    A) I don't believe Physics in C2 doesn't uses a Fixed time step. So it's never going to be stable across different powered computers.( I could be wrong)

    B) And I know for 100% that Physics doesn't used Fixed Networking time step which would allow for physics to be stable across ALL processing frame rates, CPU's clocked systems.

    C) There is no way to fix C2 Physics as it's a straight jacket, cuffed, 6 point restraint, and padded room version of Box2d.

  • jayderyu you can change the physics stepping mode to be framerate dependent (same across all PC's).

  • sqiddster it's never really worked for me, there's always inconsistency with framerate

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