I’m just starting out with Unreal Engine, before only briefly having used the jMonkeyEngine. So my understanding even of the basic concepts might be wrong.
BUT
Let’s say that I want to have a robot that has a laser weapon for attacking.
What I would like to do is create the laser weapon as an entity by itself, so I can attach it to different units. Then, when I want to have a human person with laser weapon, I just reuse the laser weapon I created for the robot.
That, in my mind, creates a hierarchy tree. A robot is composed of multiple parts - head, torso, laser weapon - and all these parts are composed of parts themselves. So a laser weapon is composed of some meshes of the actual weapon, maybe some particle emitters etc. If the robot moves, his laser weapon also moves.
The problem I’m having is, I can’t find the proper way to create such a hierarchy tree. More specifically, if I want to use a “laser weapon” like I mentioned - consisting of “parts” and being able to be a “part” itself - I don’t know, what the “laser weapon” should actually be.
Blueprint doesn’t seem the right choice because it doesn’t seem Blueprints are meant to be parts of other Blueprints. Even if I drag&drop a “Laser Weapon” blueprint to “Robot Blueprint”, I don’t seem to be able to call functions of “Laser Weapon” from “Robot”.
Components don’t seem the right choice because it doesn’t seem Components are meant to be composed of other Components. I want something I can attach a mesh and particle emitter to, and it doesn’t look like I can do that with Actor Component or Scene Component.
I hope my question here is clear. Any help or advice is greatly appreciated. Thanks.
Look first of, you have object and actor, actor has the power of timers and other stuff. Latency power
And objects don’t
So you have to use actor, actor can be used as inventory,
what I do myself Is also make ITEM an ACTOR, and so that ITEM is in an array inside the INVENTORY perhaps you want to use index 0 as the primary weapon perhaps you want to have a pointer for it ( pointer being a stupid variable ).
I won’t ever switch my inventory system because it’s perfect.
Ok you need 4 classes for the robot.
1 PlayerController, uPlayerController
2 pawn uCharacter ( I come from UDK we use pawns there ) not characters Boohooo
3 Item Actor ( this would be a weapon also )
4 InventoryManager Actor
Now … let’s say you have some mesh components on that Pawn (which is what he looks like) and you have some mesh and particle components on the Item Actor (which is what the weapon looks like and how it looks when it shoots).
Also, you have a function like “Shoot” on the Item Actor, which takes a target as a parameter and actually performs the functionality of the attack.
My question now is … how do you make the connection between the Pawn and the Item Actor (as in, the Pawn carries that Item Actor in his hand) such as that:
They are both visible (their geometries) in the world, they both render
The translations of the Pawn reflect on those of the Item Actor (ie. the Item Actor moves with that Pawn)
The function “Shoot” can be called from the Pawn
I thought that simply dragging the Item Actor to the Components list of that Pawn does exactly what I need. I thought that makes the Item Actor connect as a Node under the Pawn. However, I don’t seem to be able to call that “Shoot” function of the Item Actor from the Pawn. What do I need to do in order to do that?
Well thing is that we got a real important variable in the Unreal world, that is called **owner, **with it, you can communicate with your other blueprint so you cast it to ( in this case inventory manager ) and cast it, you can assign owner on **spawn **function.
The owner is **replicated **by default.
But you have to make an inventory manager variable by default. in this case, you create variable and you assign it to the class you created.
I’ve looked up the ownership system and while I certainly don’t understand 100% of its uses, I don’t think that’s what solves my problem.
What I’m basically asking is - how do I use composition to create an object in the world that has some geometry and some abilities it can perform by combining several simpler objects (that also have geometries and abilities). It looks like a Component is what I need, except I don’t see the possibility for it to have geometry (so far I’ve seen the Scene Component as the most promising). If there was a “Component made out of Components”, that would probably be exactly what I need.
I would then be able to attach a geometry to it, some particle emitters and whatnot, I would be able to script it and then I could attach it as a component to my Actor, alongside other components.
Then, a Robot might not understand how exactly his Gun creates it’s graphical effect or how it does damage, but would be able to use it. I thought this is the common approach to the general design in game making.
Component that has components? mmmh no no actor has components add a static mesh component in the actor and there you go, an entity with visual geometry… .
Like I said, what I want to do is create a PART of an entity with visual geometry. One that can be reused for multiple actors. I then want to create an Actor that has some base visual geometry and then attach that reusable PART to him. Like … I don’t want to be creating “a person with a pistol” Actor, I want to be creating “a person” and “a pistol” as two separate entities and then connect them together somehow.
it would be quite good if someone would make a tutorial series on how to implement the most common design patterns in blueprints. im no expert programmer at all, but i get quite a lot of the design pattern concepts which solve many problems like the above, and as my blueprints get more and more complicated im wishing i could impose some kind of order on things or implement certain pattern, but still learning what the engine can do so i stick with blueprints for the moment, but i think i will have to go c++ when im more comfortable because i just think over a certain complexity things become much easier to read and maintain n code.
I consider myself a pretty good programmer. But in totally different area - backend Java programming of web applications. Some concepts are very different, but many are fairly similar.
That being said, I’m pretty sure what I’m trying to accomplish needs everyone, developing any kind of game. What I’m trying to accomplish is the basis of code reusability. I do not believe there isn’t a way to do it.