Tuesday, October 21, 2014

UE4.4.3 info.plist for xcode debug

I'm trying to get location service to work on IOS:
http://nevan.net/2014/09/core-location-manager-changes-in-ios-8/
And that requires a few modifications to info.plist.

ue4.4.3 xcode debug doesn't use same info.plist as what is set in ue4 editor.
the info.plist in project setting (and project folder) will be the one packaged.
the other plist that is used during xcode debug will be in UnrealEngine-4.4/Engine/Build/IOS/UE4Game-Info.plist.


in ue4.5.1, it seems that the debugger now uses info.plist in project setting...

Sunday, October 12, 2014

Client can't see AI Characters (if they are inactive)

My Hack Solution: Make sure that those ai characters take action once in awhile to solve this problem (like using MoveTo or SetFocalPoint).

AnimNotify does not always fire

AnimNotify can be VERY unreliable. It is possible (but with very low probability) that the notify is NOT fired even if the blend weight passes its MinTriggerWeight. From experiments, I found animnotify sometimes does not fire in both clients and server.

I don't know what causes this, however, I suspect that it is because of a lag that somehow cause the engine to skip the notify.

I first hypothesize that if I can set MinTriggerWeight to zero, the animnotify should always fire given the sequence is play. In Editor, MinTriggerWeight cannot be set to zero (it has to be a small positive value). I suspected that why I can't set this to zero. In C++, the MinTriggerWeight corresponds to the float variable TriggerWeightThreshold. That variable will be used in UAnimInstance::AddAnimNotifies to filter animnotifies. So I created a new class inheriting from AnimInstance class, then make sure that the smallest MinTriggerWeight will always trigger.

But I failed, animnotify does not always fire (at least on client, yet it seems to always fire on server). I suspected that was because of something else... at least I saw a warning saying something like servertrackposition doesn't agree with client's co-occur when the client animnotify doesn't fire ... I suspected that it could lead to notify skipping... Searching in the source code, the client animation montage Position is set to match ServerMontageTrackPosition. This small hack smells fishy... I need to investigate further. In FAnimMontageInstance::Advance, I found that the playing montage will harvest notifies inbetween PrevPosition and Position. However, the PrevPosition is set to "Position" (the same variable that was assigned when server-client track position mismatch) before the Position is advanced to the next... Animnotify from montage with root motion may not be fired because of this!

To fix this, we have to generate animnotifies when that Server-client track position mismatches occur. It is ok, if animnotifies doesn't have great impact gameplay. Yet, sometimes this can be extremely annoying, not to be able to rely on them.

Wednesday, October 8, 2014

Weird Stuff in UE4.4.3

I consider these as known bugs.

- Scaling is not replicated by default. Even spawning with non-unit-scale transform in blueprint does not produce correct results for clients.

- ChildActorComponent causes weird behavior on clients (w/ editor build)... One component spawns two child actor instances (two separated actors: one is owned by server and is replicated, the other is owned (authorized) by client)! But this behavior is gone in packaged build.

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).