Wednesday, October 8, 2014

Auto generate UE4 C++ Project

When moving Plugins with code to another project, it's convenient to let UE4 automatically regenerate visual studio project file. Just open the editor choose File>Refresh Visual Studio Project and done, all the plugin source codes are there in the project. Thanks, epic.

Dissecting CouchKnights

Jump-Landing: the character is permitted to land and can continue to run rightaway. This makes a good agile character. In the landing state of animgraph, they adds Player_Land animation to a base animation (either idle or run) which is in sync using sync group. The sync group allows the idle and run to continue smoothly after transition from the landing state.

Attack Animation: Since UE4 root motion cannot be turned on and off during animation (at least in blueprint). Maker of CouchKnight split attack animation into two parts, the first part doesn't allow player to move/rotate (so the swing arc doesn't get much wider  from the animation and the character doesn't look jet-driven ). The second part is not root motion dominated, so the player can rotate freely (the movement is capped though).

Weapon Hit Detection: CouchKnights implement this with Overlap Collision detect for hit test. I find this not good enough for that it doesn't generate contact info as in hit event. Using hit event is possible but requires some trick to make it work. Like adding a physically-simulated object bound to the sword that will hit another kinematic capsule(or some collision component) attach to the player. Yet, my solution is far from perfect. It still doesn't produce perfect result when the sword must slash through multiple targets (wide swings in action games). So I'd prefer manual traces...

UE4.4.3 AnimBlueprint Limitation

AnimBlueprint has one serious limitation:: Its states nor blueprints cannot be reused on different skeleton. Make animblueprint as simple and stupid as possible, move all gameplay logic to the character seems to be a better practice.

UE4.4.3 packaging, win64, blueprint

I got a lot of troubles with UE4.4.3 packaging lately, hope it improves in 4.5.

A UE4 Runtime Plugin that include UnrealEd module seems cannot be packaged. Yes, this seems quite obvious. The not-so-obvious part is that: It also implies that building a runtime plug-in w/ components marked meta=BlueprintSpawnableComponent is not allowed as well (since using that meta requires UnrealEd module). A quick-and-dirty solution is to strip off all UnrealEd linkage along with meta=BlueprintSpawnableComponent (which seems to do no harm to previously created contents, but we can longer spawn those components in blueprint.) A better solution that i'm going to try is to use WITH_EDITOR macro and configure the build.cs not to include UnrealEd on packaging builds.  It seems to be okay w/o including UnrealEd while setting meta=BlueprintSpawnableComponent. The real problem is some other tags that came along with copy-and-paste process. Setting UCLASS( ClassGroup=YourGroup, meta=(BlueprintSpawnableComponent) ) works just fine.

Packing error: Blueprint referenced assets in transient package. This is another WTF. In my case, no transient is created. I just used Blueprint struct that embeds a class of a blueprint. The problem is gone if I just change that struct to embeds an actor class instead (and cast it on usage).

Wednesday, April 16, 2014

Extending the UE4 Editor

For mockup, use the experimental "Blutility"
https://forums.unrealengine.com/showthread.php?1954-Tutorial-Blutility-Running-Blueprint-functions-inside-Editor

Blutility is also said to possess a pointer to UEditorEngine so we can place actors and in the editor in a procedural way.
https://answers.unrealengine.com/questions/22052/how-can-i-place-actors-in-a-level-using-code-or-bp.html

The hard (and more powerful) way of extending the editor:
https://answers.unrealengine.com/questions/25609/customizing-the-editors-toolbar-buttons-menu-via-c.html?sort=oldest

update 1 ----------

Easier method to access GEditor is to #include "UnrealEd.h"
Also add "UnrealEd" in [yourproject].Build.cs as a PrivateDependencyModule
i.e.,   PrivateDependencyModuleNames.AddRange(new string[] {"UnrealEd"});

update 2 ----------

Landscape actor (ALandscape) can be spawned in the editor as in LandscapeEditorDetailCustomization_NewLandscape.cpp without the need to reference GEditor at all.

Monday, April 14, 2014

UE4 package slowly on Mac OS X?

UE4.0.2 on Mac package its demo very slowly. It took too much time to compress all the textures. It took me a ridiculous amount of time to package so small a game to iOS.

This is probably because my UE4Editor is in debug mode. Getting it to run in development mode is not so obvious for Mac. After a dig, here is the instruction:
https://answers.unrealengine.com/questions/25997/couple-questions-on-mac-side-of-things.html

Compiling UE4 source folder on a Mac Partition with Visual Studio?

It makes sense to use the same unreal engine folder for win and Mac. However, the problem is that Mac & windows don't use the same partition type. MacDrive seems to be a solution at first as it help in transparently accessing files on mac partition from windows. However, compiling hundred thousands of files on windows is a very slow process and can be much slower with MacDrive.

As a result... I use two sets of code on the same HD, one for mac and the other for win.