RPGBlueprintLibrary.h: Exposes game-specific Blueprint functions that are not tied to a specific Actor, almost every game will need one or more of these.与具体的Actor联系不紧密的蓝图可调用函数。
RPGSaveGame.h:用于存档
RPGAssetManager.h:Subclass of the AssetManager that is used in the inventory system.
RPGInventoryInterface.h: Native interface enabling RPGCharacterBase to query RPGPlayerControllerBase about inventory without doing manual casts.
Cast在UE中似乎是一个很费的操作。
Items/RPGItem.h and Subclasses: Different inventory item types.
Abilities/RPGAbilitySystemComponent and Others: Used in the ability system as described in Gameplay Abilities in ARPG.
The "CookRule=AlwaysCook" section of the Primary Asset Type configuration file causes all items in your project's Content folder to be cooked into the final game。
Once we verified that the packaged game was working correctly and all of the project's content was included we then took a look at ways to reduce download and memory size
为了减少空间消耗
1.Disable any Plugins that are not being used. Doing this for ARPG reduced the overall project size by 30 MB. 2.Enabled the Exclude editor content when cooking flag that can be found in Packaging settings. Doing this will prevent the project from shipping any content in the UE4 Editor folders like /Engine/EditorMaterials.
4. Using the Size Map tool available from the Asset Audit window
5. Temporarily enabled the For Distribution checkmark box in Project Settings > Packaging and changing the Build Configuration from Development to Shipping to get a better idea of what the final size of ARPG would be。
Balancing Blueprint and C++
Broadly speaking, things in a game can be divided into Logic and Data
C++ vs Blueprints
Network Replication: Replication support in Blueprints is straightforward and is designed to be used in smaller games or for unique one-off Actors. If you need tight control over replication bandwidth or timing you will need to use C++.
Faster Iteration: It is much quicker to modify Blueprint logic and preview inside the editor than it is to recompile the game, although hot reload can help. This is true for both mature and new systems so all "tweakable" values should be stored in assets if possible.
Better For Flow: It can be complicated to visualize "game flow" in C++, so it is often better to implement that in Blueprints (or in custom systems like Behavior Trees that are designed for this). Delay and async nodes make it much easier to follow flow than using C++ delegates.
Easier Data Usage: Because storing data inside Blueprint classes is much simpler and safer than inside C++ classes; Blueprints are suitable for classes that closely mix Data and Logic.
The above code block uses the Core Redirects system to convert all references to the Blueprint BP Item C to instead reference the new native class RPGItem。The OverrideClassName option is required because it needs to know that it is now a UClass instead of a UBlueprintGeneratedClass.
Performance Concerns
Broadly, the main difference is that executing each individual node in a Blueprint is slower than executing a line of C++ code, but once execution is inside a node, it's just as fast as if it had been called from C++. For example, if your Blueprint class has a few cheap top-level nodes and then calls an expensive Physics Trace function, converting that class to C++ will not improve performance significantly. But, if your Blueprint class has a lot of tight for loops or lots of nested macros that expand into hundreds of nodes, then you should think about moving that code to C++. One of the most critical performance problems will be Tick functions. Executing a Blueprint tick can be much slower than a native tick, and you should avoid tick entirely for any class that has many instances. Instead, you should use timers or delegates to have your Blueprint class only do work when it needs to.
The best way to find out if your Blueprint classes are causing performance problems is to use the Profiler Tool.
Architecture Notes
Avoid Casting to Expensive Blueprints
Avoid Cyclical Blueprint References
Think about Async Loading: As your game grows larger you will want to load assets on demand instead of loading everything up front when the game loads. Once you reach this point, you will need to start converting things to use Soft references or PrimaryAssetIds instead of Hard references. The AssetManager provides several functions to make it easier to async load assets and also exposes a StreamableManager that offers lower level functions.
Avoid Referencing Assets from C++ classes
(转载)(官网)UE4--Pawn
Pawn
**Pawn**类是可由玩家或 AI 控制的所有 Actors 的基础类。Pawn 是玩家或 AI 实体在世界中的物理象征。 这不仅意味着 Pawn 决定玩家或 AI 实体的外表,而且决定其在冲突和其它物理互动方面 如何与世界交互。由于某些类型的游戏可能在游戏中没有可见的玩家网格或形象,这在某些情况下可能会令人困惑。无论如何,Pawn 仍 代表玩家或实体在游戏中的物理位置、转动等。Character 是一种特殊类型的能走动的 Pawn。