#blueprint
402296 messages Β· Page 791 of 403
They should work fine. Would need more information about the issue to determine.
I was copying and pasting them over into actor class BPies maybe thats why
It only happened when I added a lot of them
merry xmas all, i got my demo ready i built it how do i share my demo with a friend without sending them the unreal project
ty I hope you well π
@frank viper I really doubt that the number of them had a cause for this. At the very least if something like this happens again I'd consider refreshing the nodes. DoOnce is just a function with a class wide bool variable that is changed on first use and reset. What you're describing sounds like some odd form of blueprint corruption or something else stopping the logic somewhere.
If you guys wanna see what that blueprint you helped me with does I posted it in #work-in-progress
Is it bad to set a value in a pure function?
If I have a widget built into my BP, which presumably the engine is auto-creating, is there a way to gain access to the actual widget instance it creates?
Normally I would Create Widget and use it's return value to set a variable so i can use it later. But since the BP is implicitly creating the widget in this BP i don't seem to have access to the instance it creates. I figured the widget component would be it, but it's not compatible with the event function from inside the widget.
Figured it out. It's WidgetComponent > GetUserWidgetObject > CastToYourWidgetBP > CallEvent
was trying to just cast, but i needed to get the user widget object first to get the actual instance
Cant think of a reason why
What's the difference between setting a widget to visibility false vs hidden in game true
Visibility will make it not show in editor either
I meant programmatically--at runtime. since during the game it doesn't matter what the editor is doing.
Probably not much
UMG Widgets have their own types of visibility.
Guess I don't know what that implies. That the set visibility function for widgets is different than the standard set visibility for other things?
and set hidden in game is on the same level of change as the normal set visibility. but the set visibility for widgets is different? is one more efficient? or some other difference
This is a picture of bps within a pickup. Im trying to lerp the pickup to the player when the playercharacter sphere overlaps the pickup. Currently, AddWorldOffset is the only one that seems to do anything and its sending the pickups out of map bounds/destroyed.
anyone know what im missing.
the pickups use physics but dont think that is a problem.
I think in bp, set vis or hidden is for an actor. But widgets are not actors... i think thats the idea.
I'm understanding now. I was once again confusing places i had written code for widget components and places where i had written code for the actual widget instance.
Hi guys. I have a hard to google problem.
How do I change a box grab/setworldlocation center point to a different place (preferably where it got hit by a linetrace)
I try to drag around a box, with grab component/setworldlocation (tbh don't know how it works, but sorta works) the issue is that the box gets grabbed (set to new position) of it's center that causes a small snap between the center of the box and it's edge. (example of the issue https://www.twitch.tv/videos/1242757504)
Any respons in DM would be much appriciated! (happy christmas and stuff!)
grab component has an interpolation in it that you can fidle around when it tries to move to the location where the physics handle is. It didnt fix my issue tho lol but it might fix yours
@ornate linden For actual widgets there are two types of invisible. Hidden and Collapsed. Hidden still 'renders' the widgets, but just doesn't display it so that it keeps it's sizing between other widgets. Collapsed treats the widget as if it doesn't exist anymore. Collapsed in this manner saves on performance. Any other setting is visually visible, but changes how the mouse interacts with the widget.
However for a WidgetComponent, which technically has nothing to do with UMG or Widgets, it is just an actor component. All Actor components have a Visiblity and an HiddenInGame value. Largely these are pretty much the same with the exception of design time and multiplayer. Design Time in the editor, the HiddenInGame setting doesn't do anything. You can set this to true and still see it in the editor. Visibility will work at design time and will hide the object in the viewport if it's set to false. These are also useful in multiplayer to distinguish visibility. The Actual Visibility setting is replicated, so if the component and the actor it exists on is replicated, then setting visibility on the server will also set visibility on all clients. HiddenInGame on the other hand is not replicated and can be set on any machine without it affecting other machines.
This is great information. Thank you for the write up.
I managed to fix the audio for the footsteps I created and decided to just lower the speed of the player to make the sounds sync up, although why does the audio take a bit to start after i start moving
it could be the bp logic or maybe the sound file has a brief initial silence
can i see the sound wave of the sound file?
yeah one sec
Thats the one that is the delayed one
I can see that theres about a frame or two where there flat silence
Heres all three of the sound clips for the walking
set timer by event doesn't immediately run the event
Set Timer by Event waits the timer to run out first.
If your time input in the set timer by event is 5 seconds, the first time it runs the event is after 5 seconds
they right you know π€
Hey everyone! 
I have a delay that stops working when pausing the game. After some googling I found Tick Even when Paused but it seems to do nothing. Anyone knows another solution?
Delay is affected by global time dilation. Pausing the game essentially setis the time dilation to 0
Ah that makes sense. Is there an alternative type of delay or any other workaround I can use?
Timers. I think those aren't affected by time dilation, but they do require different setup.
I'll look into em! Thanks for the help! 
So i have tried a bunch of ways to get this working, but cannot for the life of me seem to get it to work:
I have an posessed actor (vehicle) that im trying to destroy after the passenger leaves it, but every method i have tried for deleting the vehicle have only worked on the server but not via the client (it just not trigger the event via remote)
Is there some kind of failsafe way of deleting an actor in a multiplayer environment when its not possessed by a player?
The concept is that the vehicle deploys into a static building, and consumes the vehicle in the process, so the graph looks like:
Left click -> spawn building -> unpossess vehicle -> destroy vehicle
K after 4 hours of suffering I got closer to the solution. However I can't find a way to smooth out that glitch like Jitter with Physic constrait, any ideas? https://www.twitch.tv/videos/1242893249
Timer had the same result. However I found out I just needed a Event Tick to be in the blueprint, not even connected to anything. That made my delay work even when it's paused!
Yes π
can you add movement input to a pawn that ur not possessed?
Sure, if you redirect it
how exactly would i do that
You'd need a reference to it from whatever bp you are controlling
Then forward the event to the desired actor
oh okey thanks
Then why is it possible in a pure function but not possible in a pure const function? Why wouldn't they make it impossible in just a pure function ?
Just because you can doesn't mean you should, it would depend on the function name but in 99.99% of cases I would not expect a pure function to change the value of my variable
how to link two animation blueprints?
Btw someone mentioned having a sprite always face the camera the other day, I have a similar thing where I have a widget component always face the camera. There's nothing built in to have a widget always face the camera right? Like I'm not asking to help with implementation, I'm just wondering if there's functionality built in for that already?
I already have it implemented
Was just asking if I reinvented the wheel
Yeah, this must be a widget because I've got logic inside it
Widget will always face the screen if it exist in screenspace,
If thats what you invented then the wheel already exist
It's not the same as a world space widget rotating towards a camera tho
I got 2 Mesh with a physic constraint tuging each other. How can I make that neither is rotated as they swing around each other? https://www.twitch.tv/videos/1242893249
Limit their angular rotation values.
Thank you yes it happened right after I wrongly pasted a sound attenuation in stead of copying it and I corrected it right after. That is when all the sound just broke. It might have been a corruption issue. It was working fine before that. π No worries I just re-coded differently with bools and branches and it works fine now. TY for the concern and feedback.
The issue was that the physics constrain center point wasn't on the center point on one of the objects only the other. This caused a small lever to be created between the physics constraint center and the mesh center that got flung uncontrollably regardless any dampening as it did not applied to that lever in any shape or form.
:no_entry_sign: rishi2702#4030 was banned.
if you do still need advice, attaching the pickup to the player and use the "Move Component To" node to Relative Location of 0,0,0, this is only ideal if you want your item to guarantee reaches your player at a fixed time, but its incredibly easy to use.
How to create that dynamic gun placement? When you aim fast left to right you can see nearest part of weapon move bit later than farthest part of weapon? Many fps games use that
like this. But faster you move more that effect shows
to throw out an idea, since the character is turning, maybe take that same rotation delta and do it to the gun too since its a child of the player
Hmm, anyone know how to reset editor after a crash? My child blueprints are only showing a white sphere now instead of their actual skeletal mesh root component and I can't figure out why. (In the editor content browser)
It's also not showing my deleted blueprints since before the crash, but wont let me make another one since it says it already exists.
How can I hit event but only when a specific actor hits it
Sounds like the redirector is still hanging around. You could try to fix up redirectors on your content folder in engine
I wanted to use it in this way:
And this runs on a timer so the trace radius is updated every time the sphere trace goes off
I mean yeah, nothing wrong with that
Just don't set stuff from input since people assume a pure function is the same as a const so you expect the data you send in to just be a copy and remain unchanged
Or if you take it by ref you would usually have const ref and not change it
Also, I read something that a pure function is executed for every connection to a node, does that mean this function is ran 4 times, or just once because its connected to only 1 node?
But when I do this it only shows 60
However, if I connect the same pure function to another node after the trace, it does execute more times
Like such
Anyone know why this isnt working?
It executes 246 times
(and its suppossed to be 60)
So I do believe it only executes once if connected like the first screenshot
Alright I made a test for it
In this scenario, the first time it will execute the pure function once even when connected with 2 connections
In the second case it will execute twice, giving 2 different random numbers instead of 2 random numbers that are the same
Found this in an article: "Another thing in our statement which is also extremely important: the pure nodes are evaluated for each impure call."
So as long as its just one impure call its ok
Multiple editors open?
Could you tell me exactly how I would do that like step by step? Sorry I just started ue4 today
So if you hook up multiple copies of the pure instead of multiple wires from the same pure will it be the same?
This runs the function 120 times instead of 60
Each pure function is called once by the impure function
yea because you call it twice for each run
But keep in mind if you use a pure function within a pure function, you might be calling more things than you would like depending on how it is set up
Says trouble logging in
More info on pure vs impure
well, in theory the random number nodes from the engine shouldn't be pure in the beginning
Yup
Oh right, duh. I forgot that was a thing.
thats a good read, thanks
Any idea why this sometimes doesn't work? These are level streaming trigger boxes that trigger new levels to load when walked through. sometimes they just don't trigger.
Prints to make sure the box overlap is running when it should. Prints after the branch to make sure the player character == works. Past that it's probably a map naming issue.
Definitely not a map naming issue because it sometimes works
I can try that. Adding a few print to screens to see what's going on
You can also add a breakpoint to the load stream level and see if it executes
If it executes but it doesn't load the level you know its a name issue
Does anybody know why UE4 crashes every time i try to delete a variable now? It doesn't matter if it's being referenced or not, deleting any variable crashes the whole thing. I can delete anything but a variable so far
It seems to be a problem with my First Person Character and the children
If I delete a variable from either one the engine crashes
looks like it's affected the hud elements too
I think i'll just delete everything and remake all of it
Is there a way to create a widget and set one of it's variables at the same time?
I want a widget to add a bunch of items to its own list view on creation, but it needs the array of items to do so. So right now im making the widget, setting the variable inside the widget, and then calling a custom event to add the items.
But i thought it would be better to just create and set at same time if possible so i can just put the add items code in the construction event
Use the construct event?
yeah that's what i want to do. but the items it's adding are based on an array i currently set after creation
it's for a context menu for an inventory. so when you right click on an item it opens up a context menu with certain options. and the options differ depending on item. so i need to pass in what item was clicked so it's options are added to the context menu.
Oh I see. Are they multiple widgets in the same blueprint?
If so you can use a widget switcher and pass the index you want to switch to
the inventory widget has inventory entry widgets it creates in its list view, and when you right click on an item entry it creates a context menu widget, which has context menu entry widgets in its list view
You should be able to pass the variables into the widget after creation and before adding to viewport
ah, is the adding to viewport what runs the construction event?
It's what displays it on screen
yeah, just show it last, after all the code stuff
When you use create widget you get a return node which returns a reference to the widget. Add your logic to generate the menu items there before you pass add to viewport
so basically the way im doing it is the correct way and i can't make it simpler.
create widget > set variable > call custom AddItems event > show in viewport
or on the construct event of the widget if applicable
since i assume "create widget" runs the construct event, i can't add items there yet since i need to set the variable first. i'd need to be able to set the variable and generate the widget in one go before the construct event happns
You could possibly use bind to update the items but im not sure if the way you are building it works that way
Like for example you can bind a progress bar to a custom function and on tick it auto updates. If your general menu is bindable you could do that and update the menus based on the variable the bind pulls in but that may not be possible with the widget you are using
maybe the widget should be made at the start, but hidden, so you have a reference, and then you can do what you like whenever, just unhide when you need - i think you can keep it collapsed which is performantly better (i tihnk)
That is a question I was kinda thinking about. So, for the context (hehe) of a context menu, is it better to create the context menu on inventory creation and then just change its options, move it, and show it when a user right clicks?
The current way I'm doing it for comparison is that whenever a user right clicks an inventory item it creates the context menu widget, adds items, moves it, shows it. then when an action that would close it happens i just delete it.
but I guess the 1st ones probably better since it's only created once. I don't know if there's any downside to leaving it in existence, maybe a microscopic memory hit
i think, as a general rule of thumb (barring some exceptions) if you intend to use the same object throughout gameplay, hide/show it instead of create/destroy. Correct me if im wrong
Sounds like a good rule of thumb to me
basically, keep it in memory since its going to be referenced often
I've tried to make super mario 64 on unreal engine. Everything is decent with the blueprints except idk how to model on unreal. I tried 3ds max but I'm not that good at it either. Any tips on how to model?
3ds max will be better than unreal for modeling
you can level design with BSP in ue, but nothing fancy
True but I've seen people model on unreal using bsp or something
Yh that
Makes sense
Oh makes sense. I've heard people say it's for skeletal meshes but that makes sense. What's super cube simulator?
Ohhh. Fair enough I get you. Well yh, my computer as of right now can't install blender, I haven't tried Maya but I have 3d max. I'm just so bad with it and the tutorials aren't that good. Anywhere I can learn how?
there's all the crap for modeling online, but it just takes practice and learning
issues happen and sometimes forums have answers, but we generally learn the problems from doing them too many times and figuring out workarounds or whatever
then later, someone will tell you the right answer which is usually more complicated, but reliable
Fair enough. I'll just try to experiment then. Gets frustrating but that's how we learn...
Honestly wish I was forced to do more art in school or something. I want to make my own assets, but i feel like I'd need so much time to get good at it haha.
just keep modeling
more and more and more
take concepts you like and practice from them
find 3d artists you like, try to copy their models
I should watch a ConcernedApe docu and see when he decided he needed to up his competency in pixel art haha. whether he did it at the same time or had like a bunch of code finished and then started doing the art
wait what?
?
oh know i understand, that was odd to read at first
Art is irrelevant to code. Code is irrelevant to art. You can programmatically finish your entire game before introducing a single art asset(Possibly with the exception of animations).
i prefer to stick with design and code for as much as possible, but some placeholder art is always needed
yeh, animations are important for coding
mainly the timing of them and the systems around them, they can get polished at anytime
but yeah, they're moreso parallel routes
code is more important to me until its feature complete, then that becomes less of a focus
still important to maintain though
My problem with this assesment i suppose is where art and code meet with level design. like how things will move when intereacted with and I would assume you'd want a general if not exact idea of the dimensions characters will be in versus the world so ways you move characters around and what not work regardless. but i guess if you're only considering the code outside of level design specific applications i could see that. but there will be code involved in the level design
you've got the right idea - art, code, design
the big three, they can run in parallel but also overlap
probably could make some janky art at first but with the right dimensions and create your whole world and how everything works and interacts, and then improve the art at the end; but you still have something servicable in the meantime
since art is an asset, that asset can always be prettied up. its important to have it so code-wise it can be referenced
level design does inform coding decisions as you state, and often a basic "blockout" of architecture shapes and whatnot go a long way
but keeping things overly generic does not help as much as one would assume
I think the only thing i have in my code that overlaps with design and would need to be refractored if code and art were done seperately is when i drop an item im placing it a certain distance away from the character. but if the artist/level designer changes the dimensions of the game in some way that code would need to be changed. I suppose that means I should also think of a different way of doing it.
instead of dropping it x amount in front of myself dropping it on a invisible cone i've placed in the viewport
then it's the designers problem again
lol
Code shouldn't care about art assets. Dimensions are meaningless and can be queried. Character capsules can be resized to fit art assets with two variables that exist without the consideration of the art asset. Capsules generally encompass most of the art asset when set correctly and are what determines if a player can walk over something or through a doorway. These are all art and design questions and are largely irrelevant to coding.
Yeah i definitely am seeing the hard seperation you can do now.
It was just strange to see at first cuz in unreal i'm doing it all so it feels like it all flows together.
but yeah i see the hard seperation now.
I can definitely understand that. It's also much easier to think about coding for your specific use cases as you have them, but it can bite you in the end. This is actually something as simple as particle effects. Say you're making an RPG, and you have a cone like effect that sprays fire. Instead of having the particle system query for things it hit, it's just a visual thing that has it's parameters set similar to the code used to do the actual gameplay function. In reality your code might actually get all actors in the cone's distance and filter them based on which ones are within the cone's direction. This simple math is not only much faster and lightweight but is not prone to errors that randomly affected particle systems(Probably won't), but COULD cause. This has already separated your art asset from your gameplay logic. All the gameplay logic has to know is that it'll spawn a particle(Actually it doesn't even need to know that, it just needs to have a designer hook when the effect starts that a designer could spawn a particle asset from).
This all sounds like a lot of wasted effort when working with only yourself, but it's well worth it even when working alone. You'll find you'll fight the engine a lot less, and you'll also find that you have much easier to debug code. Because your art asset is useless in the sense of debugging why an enemy isn't taking damage, but the coding you did to handle that damage interaction is much simpler and cleaner, easier to navigate. On top of this massive bonus, it makes this code easy to subclass or affect differently. So that you can reuse identical code for a spray of ice, or a spray or fire, or a spray or force. The only difference is how this code applies affects to other objects after it's ran, animations it might play and the particles it might display. All of which are easily interchangeable without touching the underlying gameplay code.
Good information. Makes a lot of sense to me. I'll have to think about that seperation more from now on. Especially since it'll make debugging way easier in the long run. And debugging is where the real time sink is.
How do you set a variable to NULL? like this?
and then how would you check if it's null like this?
seems to be working
Happy Holidays yβall! π
That will set it to null, yes. Most often you check a pointer validity with the IsValid macro. But what you have there will do the same thing.
looks like vector colors
multiplying the "get forward vector" return by a float to get a bigger vector and adding it to the other vector returned from the "get socket location"
so how to find them or make them
?
This is also different if you're running UE5
u4
oh in ue5 its different?
The math nodes in UE5 were changed. Don't know how entirely, don't plan to care for another year at the least until it's stable for production.
how does that vector have a float in it
?
cool thanks for the info
That's Vector * Float.
a vector * a float is just a bigger version of the vector
alright thanks guys appreciate it
it multiplies each of the 3 parts of the vector by the float
alright it worked thank you
How do you stop button events from eating the mouse click event?
I had a overwritten function that runs OnMouseButtonDown. but now that i've changed my widget to be a button it's eating the click events in it's own On Clicked(button) and On Pressed (button) events. These events don't have the mouse event parameter that the OnMouseButtonDown does; and I need it.
try #umg - it sounds like this stuff on the button to change
interesting
but since you overrode the function, might not work as normal
Simple question : Is there any online tool (website) to prototype code like in Unreal with blueprint using Nodes ? I really want a tool like this to prototype ideas fast before coding it in any game dev software. I found Draw.io but it's not close to what I want as you only have shapes and you have to link stuff write stuff,... instead of having premade programming components like : variables, branches, gate,...
Please ping me if any answewr π
What's worse for memory/performance: 40 float variables or 20 float arrays with two floats in each? Any difference?
Do something on each 10,000 times in a loop at the push of a button, play as standalone, enter console command Stat Raw and see which approach produces the bigger spike on the graph
I wouldn't know offhand
Iβm guessing the arrays would take up slightly more space in memory?
tis my guess as well, ill see with seanny's idea
what about a single array of 40 floats ?
these floats are to be used in some different places, as individual floats i can have a name for each of them because they are used for specific thing. If i have one array of 40, i have to remember what each index relates to when referenced. I am building a data table struct so that would not be pleasant for me. It's a silly question i know π but if its cheaper, ill just have all my entries as floats, otherwise i would like to combine some of them as certain couplings for those that make sense while other floats can essentially stay unique (not in an array)
I think there's something called maps or dictionnaries I think it would fit best your need π
well i did a test. 10000 times in a loop. Print String of a Float variable ~152. Print String on Float Array 0 index ~330.
what the number means, is it the FPS ?
going off of game, but yes, its the same as frame
uh, its ms
so it takes 150 ms for the single and about double for fetching the array float
if it's ms it should be the lowest is the best
i guess im keeping them separate!
thanks for the idea
yep, meaning float is faster than array
and by twice the amount it seems
intersting
Array should be faster actually
As itβs guaranteed continuous memory
But I guess blueprints array isnβt a pure array
Yeah I think blueprints just makes it slower
Also thatβs a very bad test
whats a better test for it?
You are measuring the time to print, not the time to get the value
so instead of print, do some math?
well if im watching the stat raw chart, i guess i dont care about printing
Print string is debug stuff which is usually veeeery slow
At least compared to memory read operations
No I mean just get the 0 element
oh wait, i can get as ref
And add it to a local variable
Or that yeah
And make sure both tests use exact same values
thats the plan
just gunna add 1 π
getting a weird problem
the float test always returned 0
should be 10000 like the array
so im not sure if there's something inaccurate about it, but now the single float is around 80 ms while the array method has a tiny spike (no number pops up as its below the 33.9 ms line, but its suuuuper small, like literally nothing)
π€ I never use the increment
i tried the float + float but i still get 0 for the single float test
But I can say that a normal array has complexity O(1)
now in english π
Which means itβs the same as just using a float seperatly
I kinda hate that I planted this idea in your head cuz it's generally not a good idea to adopt weird patterns (using 20 variables instead an array) for the sake of a vague performance benefit; I would assume getting float variables is pretty optimal as far as BP is concerned. But the general approach of pushing a button and profiling approach A vs approach B is sometimes handy. If anything it puts my mind at ease about BP perf cuz it shows that you need to do something 10,000 times or 100,000 times in a frame to noticeably affect the gamethread.
You can package the project to get a more accurate reading. Just never do it in PIE cuz there are a lot of weird/debug things happening during PIE.
Hey, one question, why does my Character Component keep resetting its movement to Walking even tho I set it to Swimming?
nah, its a weird question, but as i described its pretty much just weird. From an abstract sense, yeah, i would just have one array and be done with it. But im pulling from data table where some entries are floats while others are small float arrays (maybe 2 or 3). There's some other crap on top of this, so maybe i just do what ima do and if i get hitches try the other. It was worth asking just to see.
If i could test how the fetching of a float vs float array happens then it would give me a better idea. Dont worry, this aint my first rodeo. There is a runtime concern since my data table is referenced when my ai is spawned. Im revising the data table so its looking like the same than what i had previously which did not have hitches when they spawned. I figured a bunch of little arrays would be worse, but are a bit nicer to work with from the human side. Thanks everyone for racking your brains on this one, i think ill toss this thought into the ever expanding bin of "it all depends on all other factors" and the only way to know for sure is to just commit.
As a final thought: I would say just try to cache it where possible when you need it at runtime and go with what is easy to work with while remaining readable
Rule nr1 on optimisation is to not optimise π
i think i need to make a parent class for my bt tasks and such so i can store the data table struct reference there to be used on all the separate tasks
And another question why cant I post this question on Unreal Engine forums?
actually... i guess i could cache it in my controller and then those tasks get from that
id have to cast though
generally just not a smooth solution :/
lol, once again, its individual tasks so i would cast them the first time they run, but yeah, not sure how different that is then just making a parent with the reference already
π go with what you think works, change it when it starts breaking or you got a better idea
agreed. that is what i could do, do a cast on recieve execute and definitely not on tick for bt tasks. but if i have the reference at the parent above it just seems less weird
yup yup, got options
ima go with what seems less weird first π
If you click this item in the toolbar, there's "Convert Selection to Blueprint Class"
thanks again y'all
lifesaver
hey, new to unreal but not to game dev
orient rotation to movement seems to not be working for some reason
I have unchecked all of the use controller rotation booleans
and I have the orient rotation to movement as true
I even tried doing it by c++ and it still doesn't orient the rotation to movement
I did exactly like it said in a tutorial
In the first case you pass a copy of a variable, instead of a reference.
In the second case you send a reference of an element in the array into the increment, hence it works.
You can tell if something passed by a reference if the pin spots have some sort of rhombical shapes
I have a multiplayer problem. When one player turns a light on/off the other player doesn't see this change.
When i selected my seleches and i did "convert selection to blurprint class" and i played in the editor nothing showed up and this error appeared
I have a chain of meshes, and I want to roll every segment of that chain around it's local Y axis. It should work but in reality the segments start to freak out and strobe. What I'm doing wrong?
foreach loop is not an instant thing, it takes time for each variable in that array to run that code, so if there's a lot of variables in the Array the problem could likely be that the foreach loop can't keep up with the update timeline
how to change player controller class? why is there has been one but now i cant do it? Wtf?
that's kind of like putting a foreach loop on event tick, there's gonna be some problems
what are you trying to do?
How do I check if an actor has spawned and destroyed?
Yeah but I straight up replacing the rotation, not adding or modding it, at worst the transition should be not smooth, and right now it's as if I'm adding 1000 degrees rotation every tick.
after you spawn the actor you can get the reference to it using the spawn actor from class node, then you can check if it's valid, if it is, the actor spawned.
Its just constant shit like this happening in UE. and searching google gets the impression im the only person in the world to do this.
Get actor of class and check if it's valid?
what I'm saying is foreach loop runs each member in the array one at a time, because you're basically trying to foreach loop on tick some do are missing their turns
how are actors being spawned?
if you are switching map you normally don't need to set the class, just set the controller class in the maps gamemode
These are the blueprints for spawning the actor
I have a timer which I'm trying to let the timer go faster if the actor has spawn
drag off the return valid of "spawn actor" node and type in is valid
And this is the timer
The return value?
yes
Okay let me try
if it is valid then run the code
if it's not valid then put a delay of 0.2 seconds and then check again if it's valid
how to change player controller class? Why has been but now not possible? What to do instead?
@fiery swallow It's working now. Thank you very much!
How to set player controller class?
I've been programming for a while now but want to learn ue4 blueprints.
I'm wondering is there a way to create my own class?
I mean like a class called "Enemy" or "item" and instantiate it at runtime?
What are you setting that for?
im possessing a new char
and it needs its own player controller class to function properly
Just create a BP derived from Actor.
ok, thanks
is anybody having any issues with the oriente rotation towards movement in the character movement class?
it's not working for me
and idk why
So in unreal you cant set a player controller class right?
No, at least not without swapping level.
this is just fucking stupid for real
is it possible to make a map, where it's values are another map?
and there has been pictures it has been available earlier on
yes it is
you can store for exampel in gamestate
@compact vapor
is game state an object type?
gamestate I believe is persistent all the time when the game is running
i have this but im not really getting anywhere.
there is no option in the string values to set them to a map.
?
You are not making any sense whatsoever what you want to do
You probably want to use an enumeratot
and no context
Enumerator
Hello.
Where i can read about path query ue4 type?
Do you mean you want to have let's say Key: Integer Value: TMap<String,UObject> sort of thing? If you do, try using structure.
It use in does path exist decorators
I have a hard time trying to translate that to visual blueprints in my head but I'm just trying to make a regular map, but then make the values of the map, another map.
So like getting a key of a map, would then return a whole other map. (since it would be the value of the first map)
that's what i mean, haopefuly that makes sense
right now in my blueprint, this variable is a map of integers that have values of strings.
https://cdn.discordapp.com/attachments/221798862938046464/924668864632090676/unknown.png
meaning that when I get a key, it is mapped to only one string.
I want to reset the map so that instead of strings, it returns a whole map.
Struct with a map in it.
^
A heads up though, maps are absolutely terrible to alter in blueprints. If this is all for lookup, this is perfectly fine, but any alterations are really ugly in BP.
What are maps for anyway?
Lookup mostly. They're insanely fast at finding data in.
ok, is there an alternative to maps? that offer some degree of the same functionality?
I'm just looking for a data type that can offer a layered system of tables (i guess would be a way to say it).
For example β
Faction
Faction_one
Stats
level
casual_level
ranked_level
Faction_two
Stats
level
casual_level
ranked_level
Faction_three
Stats
level
casual_level
ranked_level
How do you plan to find factions? By their ID or index?
Data Table, I guess?
index
In practice, an array of structs that have a key value on the struct can be used almost the same as a map. You just have to make your own small lookup function. It'll be slower than Maps, even in C++. But that won't matter until you're hitting hundreds of entries and many use times per frame.
But in BP, to alter data in a map, you have to first find and store the data from the map entry in a copy, then remove that entry entirely from the map, and then alter the copy and add it back to the map. This is for every entry change you do. You cannot just look it up like you can in C++, get the pointer to the data and just alter it right there.
Create two structures. Let's say first one is called "FactionContainer" and the second one called "FactionDetails"
In FactionContainer, you will add new variable and variable type will be FactionDetails. You will make it an array.
In FactionDetails structure you will create those Stats, Level variables.
Is anyone good with quaternion math? how would i compare 2 quaterninos and apply the delta to a third quaternion?
if it was a vector i could do v3 = v3 + (v1 - v2)
Thank you, @maiden wadi and @pulsar arrow.
That's tremendously helpful.
@pallid crescentNot sure in BP. I know that FQuat has a - operator in C++ at least.
Seems there's a BP exposed function for it as well. Not sure if it'll work the same to get the delta.
okay. well im working in Control rig. didnt really know where to post that question but this is what i have avalible
math is not really my strong side, but maybe it needs to be converted to euler?
alright, thanks!
On a side note. FQuat code looks questionable. O.o
you mean the c++ implimentation?
Yeah. Just has a lot of the math wrapped in some platform specific checks.
what? like the calculation would be diffirent on diffirent platforms? π
I want this key to set a door's unlocked variable to true. What target do I use for the Blueprint interface (got key)?
Possibly. It looks like it's a very low level SIMD optimization. Little out of my area. I assume it won't cause much variance. But operator- for instance has this.
#if PLATFORM_ENABLE_VECTORINTRINSICS
VectorRegister A = VectorLoadAligned(this);
VectorRegister B = VectorLoadAligned(&Q);
return FQuat(VectorSubtract(A, B));
#else
return FQuat(X - Q.X, Y - Q.Y, Z - Q.Z, W - Q.W);
#endif // PLATFORM_ENABLE_VECTORINTRINSICS
hmm ok, seams like they could just expose a - operator on it if is that simple. but im going to try to convert it to a rotator first and then do the subtraction
What does default map means for packaging?
The map that packaged builds will always open first.
The same thing but for the editor
Ohh okayy thank you very much!
find look at rotation > xvector from rotation > multiply by -1
If you find the way the ai is looking at a player and take the opposite vector then that's running away from the player
that's the direction the AI will want to run, that is
Is there some way to figure out boundaries of an instanced static mesh component?
Multiply the direction with 300, then add it to the current location
hey so is there a way to make something like weapon fire rate more consistent no matter the frame rate, for example at 30 fps some weapons shoot slower compared to 60 and 120
I have tried multiplying the fire rate variable with world delta seconds and it did not really do much
Not sure of the best implementation, but I'd imagine some form of timers would work best since they already can run multiple times per frame if the timer is too fast and FPS too slow. Usually extremely fast firing weapons are line traces anyhow so no issues with collision spawning.
Hello guys sorry to interrupt. I have been struggling with this issue for more than a week, can someone experience tell me if I'm going crazy or that is how it suppose to be in the blueprint.
When a custom event is fired and goes throught in the middle of the event, there is a requests to do other event in different place, everything works fine, that even starts to work BUT in the middle of that event it just stops (without going foward) and bluerpint goes back to the first event without finishing the requested event to be finished. On a level with nothing in it, everything works fine, but on level with a lot of different objects and bluprints, it stops in the middle ( no warning no errors, it just stops).
alright thanks Ill try it out!
Not sure if I'm following this entirely. Do you have any form of latent nodes anywhere?
Its as if, the engine thinks that there is infinity loop or CPU just told it, that it needs to go back to the main event to finish its operation.
No there is no delays, or for each loop there. It just fires and event goes half way and goes back to the first event that requested the event trigger
Would be very hard to say without seeing the logic pattern.
Sure. WinKey+Shift+S is an easy way to screen grab as well.
This is just a swift make up event to explain better
The secondary event is of course much longer than this
Just to make it clear in the second event there is no delays or anything that could potentially pause the event from going forward.
That is certainly unexpected and not normal.
Of course in normal execution flow you would expect this.
Yes exactly !
Is this UE5 or is that just a visual mod?
That is what I was always thought
No its in Unreal Engine 4.26 clean build
No changes made to the engine
The worst thing is there are no errors or warning, so I have no idea what else has this problem, I notice it from pure coincidence.
Also one more clarification, everything works normally in clean level, but when there is a lot of "stuff" in the level, something that will have some load on CPU and GPU, those problems start to appear.
I can't say I've ever experienced that. Even at work on some of the massive maps.
I do have stable 70 FPS on that heavy map so I wasn't sure if that is the problem.
But I triple check it to make sure, and indeed on heavy loaded map this problem start to appear.
If you have the time / authority to show code, it might be worth posting a bug report to epic, or on the AnswerHub.
Is there a way in blueprint to make sure that an event is fully completed before it will allow previos blueprint to go farward?
No, but you can use macros for that.
Unlike functions, macros can have latent nodes like Delay
I know that, in this case its not needed, as the function just halts in the middle.
Will Delay trigger that function again to make sure it will go farward?
Previously I thought that in the closed function it will make sure that the entire event is finished until the return node is hit or enough time has passed. (something like this ) but it also halts in the middle.
It should. If it's not, then it's definitely bugged if no execution is ending the function prematurely. Like an IsValid, or Branch without a False connected.
No I make sure there is nothing like that, that could potentially halt the script
its clean just forward setters nothing else.
Then either there is a bad bug there, or your test case is.
I made the script as pure as possible with only bools and floats (setters) to make sure nothing could potentially be invalid (the script had to be a little bit longer than my main one) but the bug appeared there too.
Can I ask how you're testing this?
I jsut made two blueprints, one is calling another, both have just simple custom functions with a lot of setters ( to make the blueprint longer) on a level with a lot of stuff happening ( heavy load on cpu and gpu)
Calls are valid nothing in problem there, but in the middle of the script it just stops going farward and goes back to the main blueprint as if the second blueprint finished.
But how are you testing it? Prints, breakpoints, UI Widget updating on tick?
Single breakpoints or multiple? I find Blueprint debugger tends to shit itself with multiple breakpoints in the same execution line. Will skip them.
I hate that thing.
With one and with none (just print point to make sure it was indeed not a debugger)
Never got hit
In clean level it always gets hit but on the heavy loaded map never.
I'm out of ideas. π
Like I said, if you have authority to share assets/code, I'd really consider a bug report with the necessary elements. Cause that kind of cutoff of execution is not normal or inended. Even object being marked for destruction won't cause that.
I have no authority to do that, but its very simple to make it on my own on a clean project (just copied the cube with light over and over again, and some blueprints making heavy load on CPU calculating) and the error always appears.
Its very easy to reproduce, will try to write something down and report it. Thank you for the help nevertheless Authaer.
Have you tested that the object where the code is taking place doesn't die in the meanwhile?
Is there a way to get a call back to the actor/pawn that triggered something?
For what use case?
Event dispatchers can be used as delegate callbacks
Ok
Is it possible for a blueprint to retrieve all files in the directory it's in?
An Editor Utility blueprint could. Normal blueprints not really. Maybe with the asset manager. I feel like that's a C++ area though.
definitely CPP area
Unless you know of a way to make the first var a ref version this should work. The increment float is is getting that var as a reference. Ive tried both wires and also tried the manual approach of adding +1 to the float and then setting it thereafter. And if i get a copy of the array float and use set array element after adding, it works. I am setting and storing the values in both cases; they should both work.
not sure then why the result is 0 for them.
Agreed, this should work. A var should work as a ref in this case
Me neither >,<
Have you tried this exact thing in another bp or in a func? Pretty sure ive had this work as expected
Dont worry i abandoned the idea so you can forget about it and sleep peacefully π
I dont have it in me to just forget it...
Yeah i do it in plenty of places
And like i said, without the macro too
Bugses
its probably PEBKAC but maybe i just can see the nuance that im missing
Nah. What you did was fine.
When things act illogical like that, it's most often some form of BP corruption. If that variable isn't used in a lot of places, it can be worth torching it with fire and recreating it.
i did, and i deleted it then restarted engine π
Hmm.. Wonder if it was a naming issue. What class was that in?
Dunno. I can't recreate it with same functions running on a F input key calling a custom event named Float, with FloatVar float being incremented 10,000 times.
i would hope not π
I tend to recheck engine files semi often when stuff like that starts happening. If nothing else works, that class gets trashed and redone from the ground up with a different name.
Makes me happy that I started writing most logic in C++. π I still glue everything together in blueprint, but code runs in C++. Less error prone IMO.
pretty much doing so, didnt care enough last night though
i agree, one day ill learn cpp
@gentle urchin rebuilding from scratch works as expected. You can sleep easy π©
the macro isnt working but the manual addition is.....
lol no no im a capable individual
π version?
4.26
and fwiw awhile ago, like 4.15 or something, the increment int/float macros did actually have a bug with their logic
but its been fixed
We're in the same boat regarding cpp btw ,
I just took the step some week ago
After 5 years of ignoring / postponing it
ah really? yeah, thats many things, id rather maintain my focus of game creation above anything else
spent this november learning BTs
Yeah there's still a ton of stuff i've barely scratched the surface on (bt being one of them)
still "learning" them but my AI BT is done now π
last thing is to connect up all the AI BT stuff to my data table - hence the weird question last night about single vs array floats - now im here π₯²
yeah, i dont look forward to it, but at some point id like to take certain BPs and optimize them for cpp as a way to get me to learn while being familiar enough with what im trying to do. Game runs well above 120 fps and aiming for 60, there's some art but im sure the more i push there its going to drop. So nothing has become "i have to make it in cpp because it runs like potatos" yet
Definitely a bonus. It opens a ton of doors. And quite honestly if you ignore the C++ channel it's very easy. They'll tell you to go spend ten years learning every aspect of basic C++. IMO that's a waste of time because you'll have to convert that knowledge to all of the stuff that Epic has wrapped in their own codebase. There are a ton of things you really don't need to know to use C++ with Unreal(Not saying it may not be helpful in some cases, but it's largely pointless).
^this is exactly the reaction i got
yeah exactly. This is why i tried cpp aswell. increased the performance x8 just by moving the Exact same logic from bp to cpp
worked instantly
lol dont worry, im not impressionable like that. Ive worked with programmers, they vary on this spectrum - some are cool while others pedantic - my background is art and design, i dont plan to become a programmer so they can crucify me all they want. It comes down to good enough performance for my needs - lets say its a postmodern idealism - and you cant shake my mentality there. I'm not trying or caring to make the opus of optimization. I keep in mind Minecraft for that reason and how badly it performed but got optimized in time. I'd rather have a game made then boast about an incomplete, but optimized system.
LMAO wtf, why does that work - it works for me too!
im losing my mind
To be fair, I'm with you on that regard. π Learning C++ as a designer/artist is fairly pointless unless you're getting into the realm of techart. It can be really useful there, but is still not a requirement.
ive been a tech artist, but it was in Unity and i did enjoy making shaders and little scripts in C# - it was approachable
I didnt read the books suggested yet, but i've gotten down about 1k lines of cpp, slowly but steadily moving forward, learning the syntax as i go along
Personally it feels like i've got pretty good progress already, so im not gonna pick up a book any time soon other than to explore some programming patterns
Amusingly, I probably don't even need C++ for this personal project I'm working on. I originally wanted to learn C++ because I intended to start with a city builder. CMC code for moving pawns is stupidly slow. Then I had multiplayer aspirations after that. And you just can't do honest multiplayer without C++.
Dude, check out some of that new Niagara stuff.
There are some Epic and GDC talks on using Niagara emitters that can potentially blow TotalWar level battles out of the water.
Yeah the potential is massive with Niagara . Not looking at that many pawns so ill make it work with just actors and some baked vertex animations
considering i spawn over 10k meshes (200-3000 tris - no ISM) and have on average 50-60 AI pawns (5k-8k tris) plus dynamic lighting and pp effects - and I get 120fps+ I'd say i could make things smoother for performance. My pc isnt that crazy even. The point is that i obviously practice optimization within bp, and i would say successfully well
how many meshes are moving at the same time ?
none of the spawned 10k ones, but they are all movable
its not before they start moving performance kicks you in the nuts
the pawns do and i dont have any expensive shaders..... yet
dont worry, they wont be π
those 10k meshes are all environment
is that green navmesh or material?
the navmesh previews tanks frames though
it was without preview
but im not disagreeing with you about cpp
but you said...
the green
and its
but not.
sry, it was true but a lie
the green is not the preview
but its a material showing walkable area
gotcha
which i happen to have a navmesh on
without ISM the performance is horrible
with ISM it's acceptable
if the ism is anchored correctly.... thats one of the parts of the cpp im not steady on yet
id imagine thats the point of ISM, and im looking forward to getting back frames after doing so
the majority of my world gen is 3 meshes with some different material swaps π
I've heard tales about auto ISM in 4.2x and upwards, but i couldnt reproduce it with regard to performance atleast
Ah ^^
World gen is also interesting field
which i probably should try in cpp next aswell
sounds like a good project
world gen is a very nice addition to the city builder
but costs alot of dev time to get right
so im gonna do that as an "extra" later on, if it becomes a thing
ive worked on, but did not create, a city builder for max long time ago and aside from so much use of the same terms, it was very cool
good times for sure
it was before i even dared look at cpp, so my code was very slow
at generating the world
and the world was stupidly simple
luckily the world gen happens before and at times where the player wont see
Yepp ^
start of the game and at key moments
took a page out of the dark souls 3 game where the shrine area puts up fog walls until the outside loads
I switched to C++ for performance reasons of course. But knowing what I know now, I do wish people would emphasize more on the lack of things you can do in Blueprint alone. I can't even imagine doing UI in UE4 with only blueprints.
UI is one of the things i mostly prefer to do in bp really
and although i have, i know there are things i simply cant get at that cpp allows
tho, i have not yet touched UI in cpp , so maybe that changes
but im also really good and convincing myself that the feature is not important or can be similarly achieved another way π
and i most prefer to do UI in 3D lol
There's almost always another way, especially in bp π
Make a combobox with the ability to search the contents via clicking on the box area and allow the user to type, which also showing the options that relate to what they're typing.
You can do it in BP. Semi easily actually. But here's a fantastic point. You don't have to. π Slate already has that. It just isn't exposed.
there's many of those cases, simply a thing not exposed to bp for some reason
its does entice me π
Lazyness, or by design cuz they dont want to expose slow things to bp? I dont know really
Another one is Comboboxes that take other data besides a String. There's actually an Enum Combobox in Slate. You can also make a Combobox very easily out of any of your own Datatypes like a Struct.
Its bugging me, but i can understand some of it even if i dont agree with it
i can only imagine that they cant really change it or it would break things in people's projects
That hasnt stopped them before
They could easily do it in a version update
Thats at the users own risk
Usually not recommended down the line
yeah but wouldnt that deprecate bp nodes?
i mean, this is why you shouldnt just update to latest all the time lol
A lot of it is that it would just take too much time to correctly implement stuff that for Blueprint in a dynamic way.
The reward for doing it isn't there because most studio's UI Programmers know C++. And creating a specific wrapper for your own use case in C++ is very easy to do. Versus Epic having to make it open ended for all use cases.
true true, if you're going to dive deeper into the inner works, just go cpp and spare the hassle
as for not everything being exposed, i get by just fine
Plus even if ui artist dont know cpp, theres atleast one in the team that do know it and can make and expose the functionality for the ui/ux artist
though yes, i do have to adjust my goals in minor senses
thats a good point, cant think of a UI artist ive met that didnt know some coding language in a professional capacity
<@&213101288538374145>
:no_entry_sign: admin02#9854 was banned.
It's kind of a requirement I started with modding WoW with Lua. Addons I needed were way too much for my crappy PC at the time. π So I learned to rewrite them not using the ridiculously large libraries most of them used.
The real xombobox that would be worth having would be dynamic FName
So that FNames made at editor time would show up
Like GameplayTags. π
Nah, that would be nice though.
GameplayTags are amazing though. Super tool for organizing data. Even with networking they're stupid light.
The mapping almost exists in that there's a meta specifier for FName UPROPs where you can specify a list of FNames. But I haven't been able to get it to work
I probably need to look more into them tbh. I suffer way too much from NIH so I almost always overlook convenient tools
so i put this mouse wheel axis event in my player pawns blueprint and it seems to be 'ticking' every frame because i attached a print string to it to test something
would it be better to just have a custom key in input settings of the project
and use that for 'zooming'
Axis events do run on tick, yes. As for your Zoom. That depends on how you want to handle it. Personally I set my camera zoon with event driven action mappings, and the spring arm handles the smooth zooming.
ya, im not comfortable with using on tick unless absolutely required given all the times ive been conditioned not to use it π
so ill try event driven action mappings too thanks
if its a zoom toggle, then go with action. Axis events, as mentioned, are meant to pay attention to the changes in the values overtime for precision
id also suggest making an input mapped action versus calling the literal input in bp
@raw orbit While I commend the attention to performance, I'd caution against the community pitchfork driven avoidance of Tick. Realistically there's going to be pretty much no discernable difference between you setting a float with an AxisMapping(In fact you would need this for Gamepads), and setting the float from an action mapping.
is that because the engine has to be ready to receive any kind of input at any time? the ones coded/used, that is?
hmmm
is independently deciding when a tick is warranted and when not more of a question of experience cause it is quite often tempting to use it though i do try to typically use timers that get the job done when its actually needed and can be set to tick less often than every frame
or timelines
Well, input itself already ticks. Player Controller has a list of Inputcomponents, every actor that you call EnableInput in has an input component locally created, and added to that controller's input stack. The only single difference between an axis mapping and an action mapping is that the bound functions run at different logics.
different logic... speeds? or just different for optimization?
As far as the Gamepad point, it's just that if you're using a gamepad joystick, you can control the axis value by only moving it a small amount unlike pressing a key on a keyboard.
Axis runs every frame and isn't gated. Action mapping runs if the key was just registered as pressed, and if it has not been ran since the last time it was pressed and isn't ran again until it's registered as released.
the steps i personally use to consider this sort of thing stem from the need "this has to fire over time" to which I try to solve that first by timer, then by timeline, then by tick - if im using delay, i could be using a timer (the only time i need a delay is to quickly test a latent action or because it uniquely solves the problem that a timer cant, which is rare)
so that sounds like any input is still somehow being watched on tick, the different is how it gets handled thereafter - axis being ungated as you say where actions have a gate or bool check preventing anything else until they change
It really just comes down to use cases. Timers run on tick as well. They're just functions bound to a TimerManager that it itself ticks and calls those return functions when the timer is evaluated as finished in the TimerManager's Tick.
A Timeline is nothing but an ActorComponent which is added to the actor and ticks in it's own component space to run the outputs from the Timeline.
Both of the former use tick. Tick is just a function that the engine calls each frame drawn to screen.
If something has to happen smoothly or over a time, in some shape or form you're going to use Tick, you cannot get around it.
true, they are all forms of ticks, but i like timer because it can be initiated and cleared, vs having a bunch of gates on the tick event
seems less cumbersome
It can be. But it depends on the case. Timers aren't useful for smoothing things out. They're only useful for calling something after a time.
right, but that is my process of determination
it is good to realize that they also do ticks in their own subtle way
For instance, I use tick quite often in UI to animate things. UI tick isn't called when it's not visible on screen. It works well because simply collapsing a UserWidget stops it from ticking. Great for performance gating. And that's also the reason a lot of people like Timelines, they do that gating internally for you.
i read this about umg stuff, that its a different tick because it will only tick on updates (butchering the idea im sure) because i was concerned that things like health bars and whatnot would be there ticking away while no changes happened
They would. But that change is literally not discernable. The reason killer of UMG performance is from invalidating widgets. If you don't actually call a change, and you simply evaluate if you should change it, your performance is pretty much untouched. Bearing in mind that this is for a few objects on screen. This conversation changes speeds really fast when we start talking about thousands of objects checking stuff on tick. But even in that conversation it comes down to why? Why do you need that many things ticking at the current moment?
you can enable and disable tick now as well
for umg right? im on 4.26
Yes and no. Direct bindings use tick twice (!!!)
For all classes
Widget tick is only different because it is inheriting from FTickableObject
you're talking about turning off tick in the class defaults right?
There are nodes for it as well
that part i did not know, but i pretty much turn off tick right away for my classes
save for the few that need it
Yeah I do the same, but you can always turn it on again
It's only in CPP you have the bCanEverTick
It's just the point that tick exists for a reason and it should not be "avoided" if you really need it. I think I lose hair every time someone comes in here with a 0.001 timer to replace tick. π¦
its this yes?
a 0.001 timer isn't the same as tick though
It's not. It's even worse. π
lol true
Set tick enabled I believe
get delta is better
ah, found it
Even that doesn't work with variable framerates. Timers can run multiple times each frame if they're too fast. For example if you happen to run that function at 120 fps and get 0.008333, and you start a timer for that, and then walk to a new area in the game and your FPS drops to 60. You're now uselessly running the same function twice every frame.
I did favor using timers due to being able to enable and disable them generally. But now that functionality is available for tick as well
thats the same reason but now im wondering...
im in too far now to refactor that, but this is great to know, something i can try at some point to see if i can squeeze more accuracy where needed
so far, all my timers work without a problem... but hey, this helps inform me of ways to test if a timer is a problem now
thanks for the knowledge drops, ive actually learned quite a bit of performance nuance just in this week compared to the rest of the year, Dean also posted a nice article on pure functions which i was able to optimize easily
I will have to refactor things as I move more and more classes to CPP
What kind of things really need tick?
but on the note of timers, if im doing a looping timer at 0.5, would there be a point to making it tick instead?
I've been injecting custom CPP classes for my BP classes retroactively so I have an easier converting. So far I'm kind of looking forward to it
for one, all my player movement stuff is on tick
you mocked it up in bp and are now transcribing to cpp?
Character movement, UI Animation, Animation graph updating.
Makes sense
Anything that needs to be updated frequently.
I find a timers a bit easier to control, but yeah some things should really be updated on frame
Yeah... "mocked up" ;) I was intent on keeping it BP but performance is telling me otherwise
Speaking of pure functions. That was a fun thing I learned when learning correct C++. Const functions are automatically made pure even when BlueprintCallable. You still have to mark them BlueprintCallable, BlueprintPure=false
lol im there with ya, keeping it BP until i have to do CPP, which will force me to learn it unless i can keep avoiding it
yup, basically just ticking pure and const for the function, but it does make things ~~cleaner ~~performant apparently
ive also a tick running for items that drop because they "suck in" to the player when close enough - seemed simple enough since they have a limited lifetime
Ah Ive done something similar but with a timeline, which makes me wonder is a timeline on tick?
yes
so is timer
Ive done plenty in CPP it's just repeat work that usually I'm not looking forward to
subsystems are a godsend tbh
considering ive never done cpp, id hope its smoother trying to remake bp logic than cpp from scratch
i cannot type anymore
So, then if you put a timer at 0.02, its the same as running something on tick (if you have 60 fps)?
Performance wise
might wanna scroll up a bit, but not necessarily π
Well UE4s CPP is not to be feared. It's got training wheels on
#blueprint message read from here and down
If you've done serious work in c# or the like you'll be fine
ive done work in C#, but i dont know if its serious
Im learning C++ at the moment and so far its easier and more fun than I expected it to be based on how some people were describing it online
Might change further down the line lol
doubt it, ive done light AI pathfinding logic and cookie cutter shit
Learning to use C++ with UE4 is very easy if you just avoid the mentality that you need to learn all facets of C++ to understand how it's being used in UE4 UE4's largely wrapped C++ is more or less a scripting language.
so you've built a pathfinding algorithm and optimized?
that wont be hard π€ͺ
nothing to the extent of what unreal allows - just following the player around, detecting player, that sort of stuff - "light" stuff
optimized? maybe
Pretty much.
Or similar. 0.02 is 50 FPS, but relatively the same.
Would you say normal C++ is easier to learn after learning Unreal C++?
Compared to never having used it
Not a clue, I have no inclination to learn it. π I won't ever leave UE4's design environment.
I had a rough first month trying to learn C++ though, because I was following general C++ channel advice. Learn basic C++, then learn it in Unreal. Of course you can't actually ask basic C++ questions in the C++ channel if they don't relate to unreal, so when you're trying to learn what basic C++ is, and you come in with questions about std::vector, people just start the "lol y u no use TArray?"
UDK Uscript was a headache and a half but i did some stuff in it to try learning it, but i was thoroughly annoyed. Unity C# was a smoother time, so ive not cared to pursue cpp in unreal even though i hear its easy - always a subjective viewpoint
fair enough. I do find it easier to do things once you understand the architecture, but I guess there is such thing as baptism by fire
considering life goals, programming is also not on the path, making games is the goal, especially the art
thats better to me than incremental steps in most cases - always good to learn base concepts and whatnot, but id also like to not derail from the progress of making something if i dont have to
if i do have to, well, i dont have a choice do i? π
I think it's a bit more complicated than that. Making games is wicked problem solving, so taking the utmost care that you start right is extremely important, lest technical debt consumes you
There are different philosophies, I suppose
If its your hobby, making a functioning game is more important than making a efficient game imo
sure, there are successful ones and unsuccessful ones ;)
If you wanna go pro, you should probably immediately be thinking about that stuff
If you're making Slime Rancher, you can afford to just.. do things. If you're making Red Dead Redemption 2, well, you can't. π
i do agree, especially if you've made enough. Though that does not hold true when starting out (not that i am). Planning is essential, but you can only plan for what you know. Its a chicken or the egg situtation. So to me its chaos and back and forth, methodically.
In blueprints I find cleaning up code to be very zen so I like doing it
It's not planning per se, it's staying flexible for as long as possible
anyways, i gotta eat, fingers and brain no work gooding lol
In code I find cleaning up to be a pain in my butt
same difference to someone who is familiar enough of with the system to know how to be flexible
I'm still just annoyed that I can't nextline the math equation node. :/
Hi! I have a Mesh moving along my spline and I want another one following it with a set distance between them⦠So it acts like a train.. I tried adding to Lerp but thats dumb and wont work especially in curves⦠Thanks in advance
i beg to differ with uscript, that was an unfortunate nightmare, let alone rebuilding ever time - literally restarting the engine half of the dev time
lol okay
yeah its more pleasant that uscript, epic said they would use an actual language with ue4 but then i saw it was modified and felt the same burning feeling as uscript
im sure you could also "do more" in C
right, im not saying they're repeating the same mistake as uscript π but it sounded like there would be some extra hoops
dont worry, im all sorted on it, i want to use cpp, but need to learn it, and time deadlines are not allowing that tangent
yeah.... that seems like such a distraction
Does anyone know how to get a scalar & vector value from a blueprint to a material?
Considered a material parameter collection, but that only seems to work at runtime
*on play
If it's a dynamic material instance you just have to call SetScalarParameter on the material instance pointer.
in my case though, the scalar value needs to be visible on the parameter in editor
as i understand it, dynamic materials have parameter that can change during play
but i need to bake a value from a blueprint to a material in editor
Not sure. Blutility stuff or something maybe.
ok, thanks for the pointers!
Is there a difference between these 2 things ? :
- Create a health variable and set its value to 100 in the "Default Value" property
- Create a health variable and use the construction script to set it to 100
Please ping me if any answer
is there a concept of making a variable that is local to a loop?
or do i just make a variable and then set it back to default before calling the for each every time
You could have a loop macro inside a function with local variables in it.
Do note that latent functions (those that have clock icons) won't work as intended in BP functions.
Is it possible to only show certain struct variables that relate to the "category" of the struct?
Its for storing items so for example a consumable doesn't need a weapon config
Just use Default Value
BP Contruction is mostly for affecting the state of something in the Viewport too
Doubt it makes sense for something like Health
But do we agree it's the same thing,right ?
I would imagine it initializing the value in a .h file vs in a constructor
So technically they both work yeah
thank you π
Just take care that Constructors can be "heavy"
I think if you move the actor it refreshed the value evetytime for example
In the viewport ofc
is there a array.find where you don't have to know the exact object? Like In javascript where you can look for a specific paramter of your item and if it matches your condition it stops?
Like I have a loop here where I
- Set a variable Broke to false each time i run this so it's always false when the loop starts.
- loop through each item and find out if it's selected.
a) If it is, break and set Broke to true
b) If it isn't, just go to the next item - Check if Broke is true to see if any item in the array ever met the criteria
JS would be like
Array.find((item) => Cast(Item, BP_InventoryItem).InventoryEntry.IsSelected)
and it would return the item if it found it or null if it didn't
we got something like that? or at least some way to make this specific thing less painful?
theres my example
sounds like your talking about gameplay tags. All variables in a struct will be there, but you can cosmetically hide pins.
what i do is wrap the loop in a function and return on the first matching hit
with some success bool and the actual object as output parameter
Oh thats exactly it thank you so much
That makes sense. I assume when you return from the function it also stops the loop from continueing in the background? Regardless it's a way more space effecient method. Thanks.
yes it stops the loop
Rad. That should definitely work
can anyone tell me the name of this highlighted node?
it's a vector2d + float, but it has 2 floats added. mine won't let me add a pin for the second float.
yes thats what i found strange
how come? here it only allows put vector2d type pins
Split one of the struct pin
if you take this
and right click on the 2nd blue pin on the left. you can "split struct pin"
aaah i found it, tyy
Could anyone check my Fortnite Style Health and Shield system and tell me if it could be more optimized please ? https://blueprintue.com/blueprint/r70uli1b/
Please ping me if any answer π
looks alright to me
bit of a broad question, there are usually always ways to optimize things but is it necessary?
The thing is I feel a big lag when I start loosing health but I don't if it has to do with my code or not
If you're trying to emulate fortnite you could check out the GAS, its what they use for fortnite. All be it a modified version of GAS but still GAS.
i doubt its that, maybe something else
(its a useful tool/system to know if you work with unreal engine)
the thing is it's a new project using the thirdpersonTemplate, and I only have 1 trigger on the scene applying damage to the player when colliding with it
the GAS, what's that ?
Gameplay Ability System
It handles anything from shooting guns to managing health in Fortnite
lol, well the hitch is weird for sure then
where can I find that ?
In the Engine, it has a bit of a steep initial learning curve though. Not sure what your experience level is
I'm intermediate
the thing is I don't want a premade system for me because what I'm trying to do is to code this system to recode it in another tool because my brain is more organized when I use this blueprint system
Its not, GAS is incredibly powerful, modular and will save you a lot of time after you've learnt it. Its also designed for multiplayer
https://youtu.be/_713CSOWkTU this video can help you understand what it is. There is also the #gameplay-ability-system channel in this server
It requires setup in c++ though, unless you use something like GAS Companion from the marketplace to make it blueprint only
Is it possible to comment out code to not be executed or something else to not being execute instead of just unpin the first node or deleting the code ?
Yes, you can bind Disable Node in your Editor Preference to a keybind. Then with nodes selected hit your keybind and it will disable them from being executed
You'll need to bind Enable Node as well so you can re-enable them. You can also bind Development Node to a key and make nodes that don't get compiled in the code in shipping builds
I do believe this feature is marked as experimental, but I haven't had issues yet. Although admittedly I don't use them as much as I'd like
found it thank you π
So for my code abode do we agree there's no way to optimize it right ?
You could possibly move it all to a function and make the damage variable a local var so it doesn't have to be kept in memory constantly
damageLeft or Damage variable ? And how do you make a variable local ?
Well any variable that doesn't need to be kept around and is just for this one calculation. Inside of functions you'll see "Local Variables" right under "Variables" in the panel to your left besides the Editor Graph
I don't see it
There isn't really much going on in your event though, so I highly doubt you'll find any noticable performance increases from anything you do to improve it.
This is a random image from google, but thats where you'll see Local Variables inside of a Function
yeah I'm more asking about the logic because I have to write this in lua and I need to make sure it's optimized as much as possible
I don't have that
You won't unless its inside a function.
will having this cast be a problem in the future?
not sure if problem is what i would say, but its not a great practice
on event begin play perform this cast and store the result as a variable, then you can just reference the variable
yup, though your StopShooting isnt plugged in
lol yeah
can I make it so that the children of this blueprint have access to that variable?
they will
I made it public, now it works π
children inherit all parent variables
it gave me an error at first lol
maybe because it was not compiled
that makes more sense
I wish you could flag BP variables protected π€
It's kinda odd that they have public/protected/private for functions, but only public/private for variables
I think it's because if a variable is not set to public it's considered protected essentailly.
I mean it's not really, but kinda sorta is in a round about way.
what would protected do for a BP variable?
I mean the class where it's declared can of course access it, but other than that only child classes can access
Load of what?
Encapsulation. Sometimes you want to have variables that are used by internal logic of your class
You might not want those available for anyone to poke at
ah, that part i get
i guess thats something ive always wanted π i just throw them in a private category or hide them from showing up in the class settings
heh
yeah I usually mark everything private by default since that option is available also on variables
I have a question regarding how to structure logic. As far as I've understood, the Game Mode is meant to execute logic, so in my case, that would mean I would have my turn based combat logic in the Game Mode, but I am wondering if it would be better to have a separate Combat Manager object that handles all of that instead
protected is handy sometimes when you have a base class where you might want to share some things with its child classes
You can do it either way
yup, i can see that
sure, but what's the benefit of doing either one? I guess one benefit of having a separate manager object would be cleanliness, but I'm wondering if there's anything else
Doing it in GameMode could be a bit simpler since you wouldn't need to manage the additional manager actor
But having it as a separate actor could give some further flexibility, for example if you wanted to have more than one GameMode, or some other cases like that
Ah yeah, I suppose so, I don't think I will though, so I'll just stick with having it in my Game Mode, thanks c:
Something you could also consider is having it as a component
since GameMode is an actor, you can add components into it
so if you later decided you wanted it to be somewhere else, you could just move the component elsewhere
Gamestate would probably also be a good place to handle it
Seeing as who's turn it is fits right into the state of the game
Yeah probably depends on what kinda logic it involves
any help please?
And now for a something completly different: A beginner question π
I have a problem with dispatchers in UE4.26.1 π¦
I have an sphere in my level and I made a dispatcher "KillIt". I call "KillIt" in my sphere blueprint (picture).
Then I have some cubes in my level, they should be "killed" (picture).
My sphere is an object of type sphere object reference (see picture).
I got this failure (picture):
Why it says assigned to none? There is only on sphere in the level. Whats going wrong?
what are you doing after the destroy actor?
also the print string will not work after you call Kill It
since you are destroying the sphere
the error is basically telling you, that sphere no longer exists which is probably because you're trying to do things with it after destroying
@timber knoll After destroy actor ist a print string as debug
The print string after "call KillIt" works
I want to destroy the cubes.
The sphere is there in my level
oh wait yeah you don't destroy the sphere true
what are you doing after DestroyActor
A print string as debug: "Destroyed". But it doesn't work
well yes, because you just destroyed self
it no longer exists, so it can't print string
But this is in the cube BP. self must be the cube itself
The problem: The character is "twerking" instead of moving the spine (rotation)
this execution pin will no longer work
There is only a "print string" as debug and not important
But the cubes and the sphere are in the level after the call
@somber pantherhttps://docs.unrealengine.com/4.26/en-US/AnimatingObjects/SkeletalMeshAnimation/AnimHowTo/AimOffset/
either your sphere is not valid, or it's complaining about the print string being after destroying
so in case it's not valid, you can add an additional print string to tell you the reference is invalid
if the other thing was the issue, this should also be fixed by printing before destroying
Sphere is not valid... But why?
did you properly reference it?
you can use breakpoints on the valid node to see what reference it has
Says nothing in the "Not valid print string"
if it's invalid, it also can't tell you it's name
more on the debugging with breakpoints: https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Debugging/
well yes that will work
otherwise it wouldn't print your string
what is the sphere value here?
did you ever set the reference to begin with?
or is it just "none"
so the reference is just not set at all
now, you've got a few options to set the reference
Just none.
In my cube BP:
either you set it from where you create the cube
I can't change the Default variable?
because it doesn't know of any existing objects to reference
at least that's what I would think
so you probably want to GetActorOfClass at the start and fill the reference with that
You can only set default pointers from an instance of an object, not it's class.
Hm. My sphere calls with "self" to the cubes, and they said "sphere = none"? Hm
your sphere isn't calling anything to the cubes
as your cubes are unaware the sphere even exist
But the instance called with self.
I thought I send a message with the call?
your sphere is just saying "hey everyone who is listening, I want you to KillIt"
but no1 is listening
Exactly. And it says "self" and so there is a reference or not?
self in that context, just means what object has to send the message
you could choose any sphere object in there
it's not going to tell your cube what sphere object sent the message
you have to decide in your cube, what sphere object do I want to listen to
Should a cube not listen to all spheres?
then you need ALL sphere references
you should quite literally see the binding as a connection
without having a connection, you don't hear them
Binding a delegate is like handing the other object a walkie in a bad spy movie. "Call you when I need you, don't call me."
or like subscribing on youtube
I spawn the sphere class in the level now, but the value doesn't change. Its none
only if you are subscribed, you will know there is a new video
you need to let the cube know of the spawned sphere
But how?
so for example, if you have both the sphere and cube spawned in the level
once you spawned the sphere, you want to drag from the cube and tell it: this is the sphere
I'll make a blueprint example, one sec
Thanks
so here I spawn both after eachother
after spawning the sphere, I tell the spawned cube: this is the sphere you are looking for
keep in mind tho: this won't work since you are binding it in beginplay
BeginPlay is not working?
Hm. I read this in the last minutes... I will try it again https://www.versluis.com/2020/08/how-to-use-event-dispatchers-in-unreal-engine/
Hmm I seem to be running into some issues with weapons. What's the best way to store weapons on a character? There are only 7 weapons in the game, each in the same unique spot per weapon. Right now, I am storing a Weapon1-Weapon7 variable, which is an actor bp_base object spawned into the world. When I pick the item up, I set the Weaponx to the item that was picked up, and hide it in the world. When I switch to it, I unhide it and attach it to the player. I feel like this should be handled better, perhaps the pickup in world is just a basic actor with a bp_weapon_class variable attached to it, and that is stored on the player, then whenever I switch to the weapon, it just spawns a new actor based on the class attached to the player. Which way is the better way?
in my example it won't (as the creation of the cube happens and I only set the reference after)
changing it to this will work tho (basically replacing BeginPlay with a custom event)
The weapon is never visible unless they have it equipped and using it, so I am trying to find the best and optimal way to store the weapon data.
well to start: an array would already be better π
then you could simple just change the index (representing the current weapon) and create small functions to handle switching between them
hiding them and all is just fine
spawning a new actor every time is making it more complex and more expensive
Yeah once I get the general concept in I will go back and refine it, but wanting to make sure that I am going about storing the actual items correctly. Each weapon bp has the stats (weapon xp, ammo count, etc) on it, so trying to find the best way to retain that data between weapon switches.
For scaling purposes, I'd probably just make that a map of FName/WeaponPointer.
Persoanlly, I'd do GameplayTag/WeaponPointer, but FName would work just as well.
also on an additional note: you just need to attach them once, from there even when invisible they should still be properly attached
meaning you only have to swap visibility and array index
You can define a default on the weapon's class, and add it to the map when you pick it up. Saving is as easy as saving and array of the weapon's keys from that map and respawning them at load.
I already define defaults, just not sure how best to retain/update the weapons info during gameplay. Right now, since it's attaching an actual spawned actor, the values are stored on the spawned actor.
Well. Saving would also entail bullet counts and stuff, but you can associate that with the map key in a struct or something and repopulate the weapon at load.
that's fine, you can just get that data from the actors on save
having the references means you basically have all the data available as well
@timber knoll Yeah, I just wasn't sure if having 7 spawned actors that aren't visible at all times would cause any issues or be troublesome.