Announcement

Collapse
No announcement yet.

I don't understand

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    I don't understand

    I've been watching the video's, pretty much everyone now, I may watch them all again tomorrow.

    But I don't understand why blueprints are considered so powerful. I can't share variables between blueprints now matter how hard I try. I've tried creating functions which just show "no debug" data when watching them. When it comes to single blueprint I'm creating lovely wobbley cameras and walking blue dummys. But if anything requires a viewport X-Y to be shared or a bool, int, float etc etc variable I just can't share them.

    As I've said I've watched tutorial after tutorial but it only explains how to share to the HUD, can you get the viewport and cursor position and send that info to a pawn say to move the pawn based on the mouse cursor, it may be possible. But I'd be better off learning a 4 year degree in C++ to do it.

    I'm trying not to be bitter, but I paided money on an engine that was sold to me with video's using the slogan "I'm not a programmer" or "I've built all this with no programming experience", yes the basics of building up a single blueprint are very easy but doing anything more complex seems impossible. I've built complex levels in source with huge complex communication between "actors" and timed "scripted" sequences all with a two page "how to video" in a matter of hours. Yet I've watched video after video of how to turn a light on when I walk next to it to making a box change color to red when I shoot it. The variables sections shows me how to........ set them and get them.

    I will keep plugging away and I may eventually get there because I've seen so many great things that have been created, I just wish there was a tutorial that could explain very simply what "is" and "isn't" possible when sharing variables/values across blueprints and maybe a how to do it, which doesn't involve printing a string on the HUD.

    #2
    I'll write up a quick tutorial.

    The thing is, there's not a single way to make an interesting video game without programming. Dragging and dropping wires doesn't look like Hackers but it's definitely programming and it's a skill you'll need to learn. Anyone who tells you otherwise is full of it.

    Unreal's Blueprints are easy to learn relative to most text based languages because you don't have to look for syntax errors, and drag and drop is much easier than even relying on Intellisense in a text language. But it's definitely programming. That means math and problem solving. If those words scare you then yes, you've wasted your money.

    Comment


      #3
      Hi Zedrophobe,

      Have a look for "Blueprint Communication" on YouTube (http://www.youtube.com/results?searc...+communication) and the forums. At a high level, there are two different ways for Blueprints to interact with each other:

      Direct references (call a function or read/modify a variable on another Blueprint)
      Via an interface (fire-and-forget attempt to do something on another instance)

      Interfaces promote a looser coupling, so you can have a RespondsToFire interface for example, and any fire/explosion can do collision checks and send a TryToIgnite message to things it collides with, without having to know about specific kinds of flammable things.

      Alternatively, you might have central game state ('global' variables) in an AGameState subclass. Your player controller, etc... blueprints might directly interact with this and call methods on that Blueprint instance (e.g., by calling GetGameState and casting the result to your specific BP type).

      RE: The 'out of scope' warning on variables inside of a function: You can only view those values when you are stopped at a breakpoint in that function, since the function could get called many times in a frame, and the debugger has no way of knowing which invocation you wanted to debug.

      Cheers,
      Michael Noland

      Comment


        #4
        Ah, partway (Probably 1/5th) through writing a tutorial, and it turns out there are better resources out there already. Oh well, saves me time! :P

        This tutorial in specific should be exactly what you're looking for:


        You'll probably want to use Interfaces most of the time, as are covered in the second half of the video, but I'd suggest you watch both and follow along with both to get the hang of doing this.

        Good luck, let us know if those tutorials don't cut it.

        EDIT: Note that you can add inputs and outputs like you would any other function, so you can pass any type of variable you want around your objects.
        Last edited by Veovis Muad'dib; 09-29-2014, 07:40 PM.

        Comment


          #5
          I was able to get this to work in some fashion but it is still much more difficult than it really needs to be. I shall use Neverwinter Script (Neverwinter Nights 1 & 2) as an example.
          **I made the exact function in Unity via C# and works like a charm. Can access data directly from Playmaker (FSM similar to BPs) as well.

          void SetLocalInt(object oObject, string sVarName, int nValue);
          Description
          Stores nValue as a local number within oObject using the variable name sVarName. The parameter sVarName is a unique string identifying a single local variable. Using the same value for sVarName in subsequent calls will overwrite the original value.

          This functions the same with SetLocalString, ....Float, ....Location, and ....Object (an Objects UID reference to find that object...if it exists....easily)

          Now simply GetLocal..... to retrieve what the value is.

          As stated to do this in Blueprints is crazy difficult to fluently Set and Get data from objects.

          Also on Topic....something else super handy.

          object GetNearestObjectByTag(string sTag, object oTarget = OBJECT_SELF, int nNth = 1);
          Description
          Returns the Nth object nearest to oTarget that has sTag as its tag value. Return value on error: OBJECT_INVALID


          In the video pointed above.....ShrubToMove would be the Tag of what another Object running a cyclic heartbeat or perhaps when something walks over/into a trigger/collider....that collider runs its script and Gets the nearest Object (could be the 5th Nearest) with the Tag ShrubToMove. Or perhaps run this in a For Loop and get All the ShrubToMove Object within a certain Radius from the trigger/collider. The Trigger would carry the script and the ShrubToMove has zero to configure.....no editing of the Graph at all. The ShrubToMove could have a heartbeat script running on it checking a variable that is Set on it from the trigger/collider.....but if you have 500 ShrubToMove Objects then that is 500 wasted CPU resources on a heartbeat. Better off Getting the Object and doing something with it at that time.....perhaps a Psuedo HB script that will turn itself off after being used would work.

          But Krixa, the video show you how to find All Actors of Class. Yes, I saw that. However, what happens when the Questing Systems writes a New Tag of an Object to Find....or Perhaps a New Object of an Array of Objects stored for say 6 Pillars of Lights that need to be turned on in a specific order. The Foot Pad when stepped on Gets the Variable on a Player then Finds the Nearest one matching that Tag Variable and.....it does something. It is dynamic and fluid.

          You can have Dynamic Variables at Runtime or Static Variables as any script.



          Granted that the 'Internal' workings of what is going on in that function is going to be completely different in Aurora Engine even though both use C++....no matter. Why can there not be Blueprints already designed to Simply Get and Set information between objects. Personally I love the math and figuring out which pieces of data to Set but having to write/draw this for simply the sake of more work is nuts.

          I made a very nice Persistent Time blueprint and it works very well. Getting that time and syncing it to various objects was a pain. Should be much simpler.

          Comment


            #6
            Thankyou all for your honest answers, if anything the fact that blueprints are a "stop-gap" between quick (simple) game creation and the wider world of programming is something that doesn't bother me. It was watching video's about the Unreal Engine that showed whole worlds/games created by level designers which peeked my interest (I have used lots of editors in the past (UDK included)). There was a video posted featuring a level designer showing off his new game at I think a Ted talk using UE4 and blueprints.

            The biggest problem I seem to be having is, when I create a function in a function library (trying to work from memory here) which contains outputs I can bring those into a blueprint and connect my variables, say an int value. However when I call that function in another blueprint it contains no data. I gather that a function with outputs/inputs can't carry variables across actors.

            Comment


              #7
              Originally posted by Zedrophobe View Post
              Thankyou all for your honest answers, if anything the fact that blueprints are a "stop-gap" between quick (simple) game creation and the wider world of programming is something that doesn't bother me. It was watching video's about the Unreal Engine that showed whole worlds/games created by level designers which peeked my interest (I have used lots of editors in the past (UDK included)). There was a video posted featuring a level designer showing off his new game at I think a Ted talk using UE4 and blueprints.

              The biggest problem I seem to be having is, when I create a function in a function library (trying to work from memory here) which contains outputs I can bring those into a blueprint and connect my variables, say an int value. However when I call that function in another blueprint it contains no data. I gather that a function with outputs/inputs can't carry variables across actors.
              I understand your problem, will look into it myslef when i get a chance, But there is a way to expose variables publically.
              For example I created a calculator, Basically a Text component, within the blueprint I have events to trigger and update the function, but that function is contained within the Blueprint, I'm sure you are able to create just a blueprint that will act like a function. Ill come back after some experiementation.

              Comment


                #8
                I had problems with blueprint communication as well(probably still do ). I think it is an area that could use a few usability upgrades that mesh with the visual nature of blueprints. I am hoping that some day we get a project event graph where all blueprints reside and communicate that would be almost the same as your normal blueprint event graph.

                Until then, you just have to figure out how to get things to talk. Cast, Interface, exposing variables on spawn, etc.
                Map Generator 1.0
                Map Generator 2.0
                Map Generator 3.0

                Comment


                  #9
                  There is definately a learning curve for blueprint, example the way the connection work, & tracing which nodes get activate first,This is oppose to progarmming that you know line 2 will follow line 1.

                  I can imagine how it can be particularly frustrating for an experience programmer. I have been having UE4 for a little more than 3 weeks, & blueprint certainly top the list of most frustating stuff so far, after rendering.

                  I have mentioned before it will be good, to have a 'conversion' table of an equavilant node network for some common C++ operations, to get programmers up to speed in blueprint.

                  Many time, there are equalivent solution in Blueprint, but is not always clear (for newbies at least). A conversion table like I mention will help greatly.

                  I disagree however that its a start stop solution, & design mainly for non-programmer (Where programmer should use mainly use C++).

                  Its still young, & can be massively improved still. Its up to us end user to feedback to epic of some of the common limitation/confusion that we find, what nodes should be added, or which documentions need more details etc
                  Last edited by starseeker; 09-30-2014, 06:22 AM.
                  Check my working title: The Locked Room here: https://forums.unrealengine.com/show...he-locked-Room

                  Comment


                    #10
                    Hello,
                    there is a perfect place to learn, try to understand, try and come back when you want to try again for quite all ue4 stuff : The content example project. (And the blueprint examples too)
                    When i wonder something my first step in search is there and most of the time, i find solution immediatly. And when i don't understand, i reproduce the example in another project (all examples are documented and as it is a project you have all the time you want to understand and try)

                    Comment


                      #11
                      The problem I have with the content examples are they are very generic and very light on anything which can be considered learning material. The math room for example is a great example of what can be achieved with blueprints but when you actually try to follow how actor 1 communicates with actor 2 you then discover that its all contained via program rather than blueprints. The tutorials I've seen show "cast to" or functions storing variables, but none of the variables in the math room are shared visually.

                      I'm currently trying to create a topdown camera which will move when the right mouse button is held down and uses the change in cursor position to set the distance. Now I've managed to get it to move (read wobble) because I know I've done it wrong and I know why and what I need to make it work. However the "Topdown, turret defence" example which I downloaded with the expectation that "powerful" blueprints would feature heavily, only to discover that the viewport/camera movement is all controlled in code rather than blueprints.

                      I may look through the top-down template blueprint(s) later today (after work) and see if there's anything I can learn about mouse position and viewport size.

                      Comment


                        #12
                        You can nest a C++ code to make a node if thats the most optimum way to do things. In any case, we can feedback to Epic the issues we have with blueprint so they can improve.

                        As far as mouse position & viewport, do check out Rama's plugin,

                        There are some nodes that you may find useful, like 'Get mouse position', 'Set Mouse Position' node, as well as 'Viewport Size' node, among others.
                        Last edited by starseeker; 09-30-2014, 07:27 AM.
                        Check my working title: The Locked Room here: https://forums.unrealengine.com/show...he-locked-Room

                        Comment


                          #13
                          Hi Starseeker thanks for replying

                          I have the camera in a pawn (as I'm trying to create from scratch rather than use character bp), I've created a HUD bp because I initial thought if there's no draw hud event in the project it wouldn't give me viewport size, mouse position.

                          However I've tried to get "get mouse position" and viewport size in my Top_Down_Camera pawn blueprint and it just shows a size x and size y of 0. I can't find a way of connected the get mouse position node to communicate with any other node. I assume I need to link it to a get player controller, but it returns no data and the tooltip says "if no hud is found returns 0".

                          I can get the mouse position and the viewport size (and then /2 to get the screen center) in the HUD blueprint but I can't cast to "Top_Down_Camera" and the function I've created called ViewportXY which outputs X/Y int's from HUD doesn't contain any data when I bring it up in my Top_Down_Camera. It always appears that when I need something to share I fail or I get a corrupted project (causing me to start from scratch).

                          What would be brilliant is if you look through the node menu with context turned off, it highlights what nodes can call that node. I.e if you hover over "get control rotation" it shows you a "get player controller" (obviously this could be turned on/off in settings). It would greatly allow you to "play" with blueprints rather than hunt for a guide or tutorial.

                          Comment


                            #14
                            Are you using Rama's plugin? If so, there shouldn't be a problem to get viewport & mouse position in any blueprint. Then you will not need to use casting.

                            Something must be wrong, as mouse position is almost never zero (unless its out of viewport or at the top left most position).
                            if you have a screen res of 1920, 1080, X should be between 0 to 1920, & y 0 to 1080 (for example 400, 800)


                            Do note that the cursor (which usually is centered in the viewport in a first person cam) is NOT the mouse position.

                            Not sure you need it, but to enable mouse cursor event (like mouse click), you need to set it in the default tab of the playercontoller BP.

                            By default, screen size is available via the HUD event (which can be use only in HUD class). Thats why rama created the viewport size node, so we can grab screen size anywhere.

                            You can find Ramas Plugins here.
                            https://forums.unrealengine.com/show...No-C-Required!

                            This could be what you look for.
                            ~~~ ViewPort & Mouse Cursor ~~~

                            The Set/Get Mouse Position nodes work directly with the player's viewport, and do not require access to the HUD canvas.

                            ~ Set Mouse Position - SET the mouse position to any values of your choosing!
                            ~ Get Mouse Position - Get the current mouse position, will be consistent with results of SET Mouse Position

                            ~ Get Center Of Viewport - Obtain the coordinates of the center of the viewport! Works in PIE as well as standalone game instances
                            Last edited by starseeker; 09-30-2014, 11:12 AM.
                            Check my working title: The Locked Room here: https://forums.unrealengine.com/show...he-locked-Room

                            Comment


                              #15
                              Hi all, well I've been playing around and I think I have something I'm happy with. I've even included a "Zoom" to the camera. Please have a view at the below image and send any critisism my way.

                              Click image for larger version

Name:	MoveCamera.png
Views:	1
Size:	322.2 KB
ID:	1057258

                              Comment

                              Working...
                              X