I’m trying to eliminate all the casts and getactorsofclass() nodes from my projects first level. I have my HUD class BP for my levels gamemode BP doing a 5-6 sequence executions with doOnce() nodes that fire off setting subtitle text in the widget the hud creates (and has to cast to) based on trigger boxes (casted to), the main character (casted to), multiple actor BP’s (casted to) and so on and so forth.
Now I’ve watched and followed Johnathen Daleys “Creating Gameplay Systems using Advanced Blueprint Features in Unreal Engine” as well as glanced over his new “Scripting a FPS in UE4” and after watching the adv. bp. one again I realized “Hey this is just like Unitys messaging system” (bad word I know). I’ve gotten so used to BP’s that I’ve not had the time to learn c++. Anyways.
I tried creating an interface for my first dialog sequence which plays the dialog cue and sets the widget text when a trigger box is beginOverlap() (was checked Previously if the triggerbox has a bool set to true every tick and then branched to play the sound and set the text. It worked by) and putting them in both of the BPs interfaces.
I tried every combination of a simple no IO message, a fake custom event (never fired on the HUD side) with just an input I tried bool in and out, ive promoted the bools on both sides every which way.
It made me think of doing Peter Newtons basic AI tutorial and binding events with an event dispatcher. Is this more what I’m looking for, a messaging system a cue system… someway to prevent doing rediculously weird and numerous (from a programming view) casts.
My scene of 50k tris and about 15 draw calls is getting 35-40 fps on epic on a GTX 760 Ti. Usually a similar scene would be 80-120.
In my trigger box I see it firing across the nodes EventBeginOverlap() -> Set at_area_one == true -> (tried both interface call and regular and a simple message) interface[x] -> delay(0.2f) -> DestroyActor()
But in my HUD class which currently holds all the scenes logic (dont ask why, just rapid prototyping and im the GUI guy on the team turned generalist) I go from event tick → interface[x] → playsound() → … Now that works just fine it fires through and plays the sound every tick, hence why I tried an interface with a bool in, a bool out, a bool in and out, a bool in and out connected together on one sides function, on the other, on both, with conditons on one side, on the othrer, on both.
Any tips to reducing casts? This is more hassle than its worth at this point but to re-write it would leave my team in the dust for this level for a few days. What I do have works, its just killing performance and its our primary hook scene so even more and more is getting added.
http://i.imgur.com/nW4rEtb.png the last setup I had tried, another simple bool in.
http://i.imgur.com/6nFXXLO.png my HUD class for this level. The mess I’m trying to optimize. No less than 6 casts and getActorsOfClass( ); to set 7 tutText subtitle lines in the single widget it adds to viewport and the 3-4 audio cues it plays and then spawn a few AI 1 at a time.
TLDR: NO matter what ways I try I cannt get a BPI from a trigger class to a hud class to work. It either plays the sound every tick (going right through the interface node) or doesnt play at all even when conditions are met, or there are no conditons, or conditions are manually set.
I do realize at some point I’ll have to rewrite all this logic in the proper way (not all this stuff in this hud class lmao) but even then, these casts from player controller[some actor] -> hud / widget kill me. They dont make sense. Coming from a Unity C# background and a very light C++ knowledge background.