Bullet Behavior Performance issue

0 favourites
  • 11 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Hi everyone and happy new year.

    I'm working on a Tower Defense that has some inspiration from Kingdom Rush and I meet a big performance issue with Bullet Behavior at the start of my project :(

    Example:

    After creating a Tower, I can spawn 2 knights who reach a defined position. While moving, my FPS drop from 50 to 30 FPS until they reach position. Once they arrived, my FPS is going back to 50.

    I can create 5 towers, and each time, I have this drop of performance and back to 50 when they do not move.

    I also noticed that my enemy (only one) is taking 20 FPS alone. I was surprised by it. I spawn this enemy 10 times each 3 sec in a random position and they follow the path where I put a few sprites to change the angle of motion.

    I was expecting that it would have been much efficient that the Pathfinding behavior which has the issue of having all the sprites ending on a line.

    By doing the test with 5 Towers (10 knights) and 10 enemies, my FPS drops a lot.

    I tried to add a short delay in order to check every X sec instead of every tick, but it remains slow.

    I really don't understand how I can fix this performance issue, especially that I'm testing on PC :(

    I also tested it on another PC and it is the same.

    I read a lot of threads about performance issue but I did not find any idea for me :(

    I also set the project and layout at 1024,768

    My sprites are 32x32 or 64x64 and the biggest for the castle is 256x256.

    I only have one sprite (knight) that has a weird format 64x101.

    I hope someone may have an idea because I really wanted to do a TD game with Construct 2

    Cheers everyone

  • ok. I think I found the problem but I have no clue how to fix it.

    When my knights and enemies are on screen, I reach a pick of 40000 collision checks :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you spawning too many object on top of each other. Double check your creation rules so that your not doing that. Check your profiler to see how many of each object is being created.

  • Are you by any chance using containers ?

  • Thanks Emoaeden and Jayderyu for trying to help me.

    jayderyu:

    I checked the profiler and I spawn the correct amount of objects.

    emoaeden:

    No. What do you mean by containers in Construct 2?

  • I reach 20-30 FPS if I spawn only 1 Knight instead of 2 per tower.

    I was expecting more because I really don't have a lot of objects, no sounds, no fx...

    I checked the Template-TowerDefense.capx from CS2 and it runs at 20-30 FPS.

    I would love to know if it is me or if you have 20-30 FPS as well?

    Thanks for your help

  • If you're doing something where you have two objects, and you want them to be addressed as one, then you might use containers

    scirra.com/manual/150/containers

  • Hey Emoaeden,

    thanks for the quick response. I will check your link right away :)

  • Nice Emoaeden.

    I tried with my enemy to create a Container.

    That's great, it reduces the number of events.

    I will update my knights now and see the impact on it.

  • hey Emoaeden,

    do you know how to set position to an object that is part of a container?

    I have a health bar that is pinned to the Knight but I want to offset the bar at the top of the Knight.

    I tried with the image point (origin) but when the health depletes, it does not resize the bar from right to left but both sides :P

    I tried to set position every tick but it does not work???

    Do you have any idea?

    thanks again

  • I removed the Green Health bar from the Knight container.

    it works like that :)

    So, good news, I have a strong 30 FPS with 2 knights now. Thanks guys, the container idea was a good advice.

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