top of page
Game Summary
Blueprints, C++, and Hybridization
Collision via C++ in UE4
Declaring Blueprint Usable Functions and Variables in C++
Rails Shooter

Technology

  • UE4

    • C++

    • Blueprint

​

Genre Single player, Rails Shooter

​

Platform PC

​

Development Time 2 Months

Table of Contents
Game Summary

Summarized Bullet Points:

  • Game is a Starfox-Like (Rails Shooter)

  • Goal of project was to use as much C++ code as possible, in order to learn how to use UE4's C++ side.

​

   This game is a simple rails shooter that operates similarly to how Starfox does.  The goal of the project was to explore some of the foundations of C++ in UE4, and see some of the best practices for making the game use as much C++ code as possible.

Blueprints, C++, and Hybridization
  • UE4 C++ was not as kind as blueprint in regards to spawning a camera, seemed as though it did not start with the correct view settings.

    • Thus the camera, and the places where spawn the explosion particle effects are the only places that are hybrids of C++ and Blueprint

  • At points had experimented with making the ship run on C++ code, but swapped it to full blueprint somewhere in the mists of getting the camera to work.

    • However it is possible to get player pawns to move completely from C++ code, most of the blueprint code can be converted to C++ code.

    • The only bits that can not be converted are the areas that involve spawning anything.

Blueprint and C++ Hybrids: Blueprint side

Blueprint and C++ Hybrids: EnemyShip Header file

Collision via C++ in UE4
  • .Pretty simple to set up:

    • First need to have a member variable that is your collision (for the mines/bullets, they use a USphereComponent)

    • They will also need a declaration of the functions "OnOverlapBegin" and "OnOverlapEnd", which are preceded by "UFUNCTION()"

    • Then in the constructor for the class, need to instantiate the collision component, set the variables to what want, and also assign the OnOverlapBegin and OnOverlapEnd functions to it.

    • After all that, do whatever calclulations or otherwise that want within the OnOverlapBegin and End methods.

C++ Mine Header File

C++ Mine CPP File, important methods only.

Declaring Blueprint Usable Functions and Variables in C++
  • Also pretty straight forward to set up

  • For Variables:

    • Just before the regular declaration of the Property type and name, type:

      • "UPROPERTY(BlueprintReadWrite, EditAnywhere)"

    • BlueprintReadWrite makes it to where it can be read from or written to via blueprint.

    • EditAnywhere makes it to where the variable can be edited in property windows, archetypes and instances.

    • other properties that could be used:

      • "BlueprintReadOnly" - marks the variable as only able to be read when in blueprint.

      • "BlueprintWriteOnly" - marks the variable as only able to be written to when in blueprint.

      • "SaveGame" - used to mark a variable as something that could be saved in checkpoints or Savegames

  • For Functions/Methods:

    • just before the return type of the function, type:

      • "UFUNCTION(BlueprintNativeEvent)" to make it an event

      • "UFUNCTION(BlueprintPure)" to make it a pure method/function

    • To note, the part you declare for Blueprints as a BlueprintNativeEvent CAN NOT have a declaration in C++ code.

    • Instead write another method that is not view able in blueprint and do your local calculations there.

C++ Mine header File, except only a couple valid examples.

Copyright © 2024 Alexander T. Baird

  • LinkedIn Social Icon
  • gmail
  • GitHub-Mark
bottom of page