Download

Need help optimizing BP code

Hi there people,

I have been creating a menu from scratch based off of SAO (Sword Art Online).
Before hand I didn’t really know all that much to do with BP scripting so once the ball started rolling and I started making things actually work, I continued on my warpath to have my UMG menu as it is now:

Not terrific. I’m not even getting 60FPS in the BP editor anymore because of the sheer amount of s***ty coding I have in there.
Don’t get me wrong, the menu works fantastically.
I just need a guru’s help in optimizing the code.

After checking, I have found no issues in copyright because I have manually created everything and I will be posting the project to the marketplace for free.

**Credit to whoever can help me with optimizations!

Video of latest updates:

(Current state is much further than this).**

Why all in 1 graph i.e. no functions or macros? so NO WHERE in there do you have duplicate code?

I have a Blueprint of a Character with more than 300 functions, if that functions are not activated together all, it gives me maximum fps, when u do lot of events it goes worse obviously.

U have to exit from Tick events if u have, or at least go with delays or something to not colapse the timeline. If the Hud gets hidden ingame, it will stop making events.

All events are activated irrespective of tick. They are only fired when particular UMG buttons are I am removing children when a sub-menu is closed. My coding in that respect is something I’m quite proud of.

Note, the gameplay is fluid, only the visual side of Blueprinting is a little laggy. I’m talking like 57fps, thats not really an issue.

What I’m wanting to achieve here is effectively shortening my code to do the **same things but less lengthy. **

For example, I have a vertical list of buttons. When I press one of those buttons (button0 for example), it reorders the list to place button0 on the top of the vertical box slots, hides the rest of the buttons (1-4) and displays more sub buttons (buttons 0_0, 0_1 & 0_2). Instead of dragging all of those main buttons (Buttons 1-4 and all of the sub buttons of them respectively), into a hide-widget node, could I effectively group all of them into an array to streamline the coding?

There are many more things I wish to optimize, so realistically I’m looking for someone proficient in BP coding to actually load up my project and understand what I’m trying to achieve and gather a list of ways to do so.

I am so sure that events that are not firing are activated, but not firing, so cant influence in fps at all, or at least not to drop from 62 fps (Custom is that value in UE4) to 57 only cause that events not fired. For example i have 500 tress in a zone replicated to client and they have 10 events each one, the client would notice those events in fps, but nope.

At the beggining, trees had a tick event with branches, wich caused 10 fps loose to 52 when 40 trees in close range, but without that tick event they dont affect to fps, at least not the blueprint even having that events reproducing from player who hits the tree with an axe, so…

If u have lag with ur hud with no events being displayed is not really normal, can u answer me a question? U have functions with return nodes in that hud (I see friends, equipment, etc, wich text depends on variables prolly)? If u have em then u can have the fps issue, cause they are firing events all the time, as more, less fps. If u are using an Array to give names (if u have an inventory with 9 slots, from 0-9 can be an array limited lenght with last index) and u have those index to the value of text boxes, u need to use Is Valid to check that indexes, if not it will fire more events cause an error finding those elements not valids.

U said “All events are activated irrespective of tick”. It cant be the length of the blueprint or how much things it have, cause bp only drops when firing events, i am so sure, but lets see if someone from unreal can verify this :stuck_out_tongue:

sorry to be clear I was having FPS drops in the graph editor, not during gameplay.

This is resolved now. I am using macros to sort all of my buttons now, thanks for the heads up!

LOL them it was confusing, i didnt understand ur problem xD, then yes, u need to take events shorter, but is just, not neccesary no? but yes, if u do macros no lag at editor. but for example if u are working with a multiplayer game, sometimes macros give stupid errors, u would do everything using macros?

Nice that is solved :stuck_out_tongue: if i understood the question i would help u before :frowning: