x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

What part of this BP is slowing down the game?

https://i.imgur.com/rDc1HK7.png

When I run my game with 20 elements in the array this blueprint causes huge performance issues, what could be the cause? This doesn't seem to be that intensive to me? Any help is greatly apreciated!

The turret is setup in a way such that the "cannon support" is attached to ground and the "barrel attachpoint" is attached to the support. the support controls the yaw and the attachpoint controls the yaw of the gun.

Product Version: UE 4.17
Tags:
more ▼

asked Mar 02 '18 at 12:34 PM in Blueprint Scripting

avatar image

ziptos
81 3 4 6

avatar image Nebula Games Inc Mar 02 '18 at 01:55 PM

Are you running that in the weapon blueprint itself? So is the weapon rotating itself or do you have a separate blueprint that holds references to all your weapons and rotates them. How often are you calling that function? On tick? If that is located in the weapon blueprint, then you actually have 20 turrets and they each are told to create an array with 20 actors to rotate. If that is the case you have 20 arrays with 20 actors each being told to rotate which depending on how often this function is called could be an issue.

avatar image ziptos Mar 02 '18 at 03:23 PM

I call this function once per tick from a pawn that owns the turrets, so the turrets never call this function themselves. But do you agree that this blueprint should be pretty cheap to run, except if I have a lot of turrets of course?

avatar image Nebula Games Inc Mar 02 '18 at 04:48 PM

So 1 turret has 20 attachments that rotate and those are all stored in the array? And you only have 1 turret in your level?

avatar image ziptos Mar 02 '18 at 05:07 PM

No, I have one pawn which has the array of turrets, and each turret has two components (the ones you see that I set relative rotation on)

avatar image Jin_VE Mar 02 '18 at 08:06 PM

It should still be fine. There has to be something else going on. It's either too much to process or too much to draw. Are you sure the bottleneck is the CPU and not the GPU?

avatar image ziptos Mar 03 '18 at 07:29 AM

yeah I'm sure but here are som screens:

https://i.imgur.com/fpQ8DKp.png

https://i.imgur.com/K6EZTaV.png (the top row actually disappears after a while because the tim becomes to long)

https://i.imgur.com/WldkqTQ.png

(the reason it says that I move 200 components is because I increased the number of turrets to 60 to easier see performance issues) But as you can see, it takes like 1ms per rotation? does't that seem unreasonable as hell?

I really can't figure this out..

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

So the answer was simply that the turrets were to close to objects that they are collision checking against, disabling their collision against those objects worked wonders.

more ▼

answered Mar 28 '18 at 06:32 AM

avatar image

ziptos
81 3 4 6

(comments are locked)
10|2000 characters needed characters left

In console (~ key) type in command "stat game" and "stat slow" which will give you time of how much each step of frame composition take and see what causes the slow down. Note that if you run something on tick you only have 16ms (most likely less then that) to maintain 60FPS and blueprint (at least in editor since you can turn nativisiation in packaing) is 10x slower then native code, so looping array on tick with blueprint is costly. Also check if you don't do any other heavy operations like Get All Actors of class and such on tick.

more ▼

answered Mar 02 '18 at 10:15 PM

avatar image

Shadowriver
33.9k 916 164 1093

avatar image ziptos Mar 03 '18 at 07:34 AM

okay I tried som profiling commands and here are the results:

https://i.imgur.com/fpQ8DKp.png

https://i.imgur.com/K6EZTaV.png (the top row actually disappears after a while because the tim becomes to long)

https://i.imgur.com/WldkqTQ.png

And yeah I know that you preferably shouldn't do stuff on tick but I kinda have to handle their rotation in some way right? And no, I don't do anything like cast or "get all actors of class" every tick.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question