Bullet Behavior Performance issue

Get help using Construct 2

Post » Thu Jan 02, 2014 11:42 pm

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

B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Fri Jan 03, 2014 4:34 am

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 :(

B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Fri Jan 03, 2014 6:07 am

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.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Fri Jan 03, 2014 6:39 am

Are you by any chance using containers ?
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Fri Jan 03, 2014 11:35 pm

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?



B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Fri Jan 03, 2014 11:43 pm

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

B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Sat Jan 04, 2014 12:21 am

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

https://www.scirra.com/manual/150/containers
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Sat Jan 04, 2014 12:36 am

Hey Emoaeden,
thanks for the quick response. I will check your link right away :)
B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Sat Jan 04, 2014 12:51 am

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.

B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Post » Sat Jan 04, 2014 3:53 am

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

Underdog2014-01-04 03:53:35
B
26
S
10
G
3
Posts: 72
Reputation: 4,008

Next

Return to How do I....?

Who is online

Users browsing this forum: Fenix18 and 55 guests