Announcement

Collapse
No announcement yet.

Mixing Blueprint and C++

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

    Mixing Blueprint and C++

    This is a general question about structuring UE4 projects, so I didn't think it was suitable for UE4 Answers

    I have found in my (*very limited*) trial of Unreal, that mixing Blueprints and C++ causes more issues that it's worth. Specifically, because you can't reference BP classes in C++, as soon as you start putting functionality into BPs you are very limited in what you can achieve in C++.

    Am I missing something? Is there some text based way of circumventing the one way flow of information?

    Failing that, should I pick one and if so, what do people recommend. Before starting, I would have assumed I'd have felt more comfortable in C++, being a coder. That said, iteration time is so much faster with the blueprints and it seems a shame to lock out non-coders at such an early stage.

    Anyway, general thoughts on how to mix and match C++ and BP and what people finds work for them as a good divide.

    #2
    One of the best methods I find are that you are able to create the variables and components etc you need in C++ for your actor and make that variable or component exposed and editable in Blueprint. Meaning that you are able to manipulate the variable/component from both C++ and BP whenever you want.


    For example if I wanted to declare a number that I want to later edit in either C++ or BP I would put something like this:

    Code:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Default)
    int32 X;

    How this appears in BP:

    Click image for larger version

Name:	1.jpg
Views:	1
Size:	61.0 KB
ID:	1051998



    There is tons of helpful information on the Wiki and documentation


    EDIT:
    My advice would be to play around with the project settings. Maybe start off a small project with just BP and then maybe try mixing them up and then make your own mind up to which you would prefer
    Last edited by ZeJudge; 06-16-2014, 11:33 AM.
    Q.U.B.E. 2 | Q.U.B.E: Director's Cut

    Comment


      #3
      Usually when i mix BP And C++ i make the fundation in Code (Variables, Basic events like onUsed, OnDropped etc ) and then extend that into a blueprint
      Offering my Freelance Game Design ,Counselling and C++ Programming Skills!
      https://forums.unrealengine.com/show...ner-Counseling

      Marketplace Assets
      Melee Tracing Plugin:https://forums.unrealengine.com/show...Tracing-Plugin
      Medieval Combat Starter Kit:https://forums.unrealengine.com/show...at-Starter-Kit
      Foliage To Blueprint:https://www.unrealengine.com/marketp...e-to-blueprint

      Comment


        #4
        I would try and divide the line between blueprints and c++ by thinking about two different "users", the Programmer and the Game Designer. Only put in to C++ what the Programmer needs to be in C++, while the rest should go in to blueprints for the Game Designer. Pretend your Game Designer can't code.

        Imagine you're making monsters for an RPG, you'll have lots of different types of monsters but they are all going to have a lot of the same basic functionality and properties. Functions such as OnDamage, or OnMove and properties like Health, XP for killing them, drops etc. The Programmer shouldn't care too much about what kind of monster he is coding, the C++ should keep things generic while exposing properties and functions so the Game Designer can change the health, xp, etc and hopefully even some of the behavior of the monster just by using blueprints. The Game Designer can then balance, tweak and create new content inside the editor easily while the Programmer can move on to more important things like fixing bugs or working on networking.

        Comment


          #5
          Originally posted by netizen539 View Post
          I would try and divide the line between blueprints and c++ by thinking about two different "users", the Programmer and the Game Designer. Only put in to C++ what the Programmer needs to be in C++, while the rest should go in to blueprints for the Game Designer. Pretend your Game Designer can't code.

          Imagine you're making monsters for an RPG, you'll have lots of different types of monsters but they are all going to have a lot of the same basic functionality and properties. Functions such as OnDamage, or OnMove and properties like Health, XP for killing them, drops etc. The Programmer shouldn't care too much about what kind of monster he is coding, the C++ should keep things generic while exposing properties and functions so the Game Designer can change the health, xp, etc and hopefully even some of the behavior of the monster just by using blueprints. The Game Designer can then balance, tweak and create new content inside the editor easily while the Programmer can move on to more important things like fixing bugs or working on networking.
          Netizen I really like your example and would have to agree 100%. Even if you are doing both if you are able to separate you mind away from the task and look at it from a program and or a game designer you will save yourself a lot of trouble later if you end up adding more people to your team. It will also be good practice if you ever decide to join a team. Well said

          Comment


            #6
            Basic core class stubs can go to C++ and maybe some time-sensitive functions/processing. All gameplay code goes in blueprint. If for some reason a blueprint routine where to impact performance I'd move it into C++ (but that hasn't happened so far). In the end, I do not expect to see much code at all in C++ for my game
            Godz for UT '99 / UT 2003

            Comment


              #7
              If I might add to thk123's thread, I am also trying to bridge some of the basic conceptual elements of Blueprint vs C++. If one is aiming to mix Blueprint and C++, should projects always be started as a C++ project? Or is it possible to add C++ functions into a Blueprint library such that the library can be shared with pure Blueprint users?

              Comment

              Working...
              X