Download

Blueprint Class, Constructor

Hey,
after some time of having no hands on game-design-releated stuff i downloaded and fired the the new unreal-engine, cause i was very interested in the new blueprint-editor, but so far I have some problems wrapping around how to really work with it. Saying this, it might be a problem that, so far, I started several years ago with the extendet Warcraf3-Editor (wich has a pretty neat scripting-language allowing classes, objects and so, called vJass) and afterwards moving to StarcraftII. Both were Kind of limited in what to do because most of the stuff in scripting was given to me. Some other programming-action was in college, but what so ever, my problem:

I want to create a Top-Down RTS-like camera. What i have seen so far is, that i need to keep in mind that, if used in multiplayer, there need to be one camera for every player, even when it is via internet.

My approach in my head is the followong. I create a new Class called RTS_Camera. This class contains an Camera-Object, info about the posessing player (playercontroller), assingment to wich map-area (it should not leave them) and the general controll-sheme. And here is the Problem. Normaly I would create a constructor for this class, taking the parameters wich are necesarry (map-area and player), create and camera Object, assign the camera to the player and fire up the controll-sheme for this camera.
So far, the Contruction Script seems to be what is the Constructor of a Blueprint Class, but i cannot take any parameters. I thought creating my own function and use it as a constructor, but they are not static, so i can only call them when the instance of my RTS_Camera is allready created.
Another idear crossing my mind is to put several functions into the class wich would be assignCameraToPlayer(player), assignCameraToMapArea(mapArea) and togleCamera(bool), but for this i would need to check if the camera is allready assigned. So not the best way…

I think I just have a wrong view on how to approach this issue, so I would be thankful if you can give me some advice and help me to understand the idear of blueprints as a whole.

You probably went the wrong way with construction script, just because the name dounds like constructor. Construction script is just some kind of script that is executed everytime the blueprint is updated in the editor. Totatlly not what you’re looking for.
For the rest, your interrogations are very vast, and you should just go and eat some tutorial videos to get all the basics you need, there’s tons of them, and the official ones by epic are top quality (except the ones about AI). That’s your best shot to understand blueprint as a whole, in forums, you’ll mostly find people ready to answer more specific questions. So yeah, that’ll take you some time, but I can’t think of any other way.

Hey,
thanks for the reply. I know that it is alot, especially because i try to fit one programming sheme into another, so my ask for help is more of the “help me to us my existing knowdedge” so i do not need to start from scratch. This is also a little problematic when you advice me to eat tutorials and state that there are a lot, because it is not so easy for me to find tutorials wich adress my matter because a lot of the tutorials handle basic stuff or are filled with things i dont need to know, because i have a very concrete matter to solve. I would be really greatfull if you mind to give me a link to some more conrete tutorials discussing, even when part of a bigger series, smaller parts of a project without vasting out in the big rest of the project.

Otherwise, considering my problem, i found that you can give an actor class Variables and check the exposeOnSpawn marker. With this, when calling the spawnActorFromClass the variable appears as a pin and needs to be adressed for the spawnFunction to execute. I think this is the nearest, or, in the end, that what I wanted. This is still a little bit tricky to because it seems to be kind of slow. The first variable i assigned to my RTS_Camera and marked as exposeOnSpawn appeared without problems, but after this, if i added or changed variables in the class, it will no longer change, so it is stuck with the first variable i assigned when I use the spawnActorFromClass function.
I just saw now that i need to compile the blueprint for the change to appear on other locations.
With this, my Question, is so far solved, but if anyone has another approach on the matter im happy for responses.

Edit: I am really sorry if my language is sometimes difficult to understand, in the end not a native speaker.

Not a native speaker either =)
It’s just that, if you want to make complex stuff, you’ll need to understand a lot, and probably stuff you didn’t know existed to start with. For example, when you say that you need a camera for every player, it just doesn’t seem to make much sense. You’ll just need a camera in your pawn, and every controller will create an instance of the pawn, and will get his camera this way. I’m just saying you should go through the basics, and everything will become clear. Especially if you want to make a multiplayer game, where all the basics will have their complexity multiplied by the replication factor. You’ll really need a deep understanding of pretty much everything if you are to make a multiplayer game.
Anyway, if you want a more precise advice, try this, that’s pretty neat, and will probably teach you a lot of directly useable stuff for your project. https://youtube.com/watch?v=VtMwSduToZgBut sincerly, I don’t think you can skip the basics forever.

Yeah, i try to learn by starting to do the stuff i have in my head and learn more and more about the habbits of the engine by solving the problems.

The link you provided is very nice, especialy seeing that it is really just about the camera and no other stuff. What is a little bit a problem for me is the, unclean way he works. It is not the best to provide a tutorials on a specific task if you have not solved the problems, wich is, in his case, not a small one. putting an enourmus mash to provide his solution from bugging is just dirty, but anyway, it helped me to understand and he asked the community to help providing a better solution. But this is going to be a bit much of OT, so thanks for the help, we will read us :slight_smile: