Wednesday, August 29, 2012

Alpha Complete

Well it's been a great 8 week session for the Alpha phase for Arrival: From the Unknown. The team did a great job wrapping everything up for completing the Alpha build. There were a couple of issues that we were not able to completely resolve. The AI code was pretty buggy because all the Savages were moving into one location. Another particular problem that I spent trying to correct was the melee animation. I solved the first issue which was that the Savage would go into the attacking state when approaching the main character, but the animation would not play. This was a simple fix in code because I discovered the call in UnrealScript to the animation was spelled incorrectly. The second problem was that the melee attack was not doing any damage to the player. You can see parts of the AlienMelee.uc file that governs how the melee is implemented below. It's what I was staring at and debugging profusely. In the end, we decided to just present with the latest build with the animation playing but with no damage being done.

class AFTU_AlienMelee extends UTWeapon;

var() const name SwordHiltSocket;
var() const name SwordTipSocket;

var array<Actor> SwingHitActors;
var array<int> Swings;
var const int MaxSwings;

//Instigator.mesh.GetSocketWorldLocationAndRotation ('WeaponPoint', traceStart);
//Instigator.mesh.GetSocketWorldLocationAndRotation('meleesocket', traceEnd);

function RestoreAmmo(int Amount, optional byte FireModeNum)
{
Swings[FireModeNum] = Min(Amount, MaxSwings);
}

function ConsumeAmmo(byte FireModeNum)
{
if (HasAmmo(FireModeNum))
{
Swings[FireModeNum]--;
}
}

simulated state Swinging extends WeaponFiring
{
simulated event Tick(float DeltaTime)
{
super.Tick(DeltaTime);
TraceSwing();
}

simulated event EndState(Name NextStateName)
{
super.EndState(NextStateName);
SetTimer(GetFireInterval(CurrentFireMode), false, nameof(ResetSwings));
}
}

function ResetSwings()
{
RestoreAmmo(MaxSwings);
}

function Vector GetSwordSocketLocation(Name SocketName)
{
local Vector SocketLocation;
local Rotator SwordRotation;
local SkeletalMeshComponent SMC;

SMC = SkeletalMeshComponent(Mesh);

if (SMC != none && SMC.GetSocketByName(SocketName) != none)
{
SMC.GetSocketWorldLocationAndRotation(SocketName, SocketLocation, SwordRotation);
}

return SocketLocation;
}

function bool AddToSwingHitActors(Actor HitActor)
{
local int i;

for (i = 0; i < SwingHitActors.Length; i++)
{
if (SwingHitActors[i] == HitActor)
{
return false;
}
}

SwingHitActors.AddItem(HitActor);
return true;
}

function TraceSwing()
{
local Actor HitActor;
local Vector HitLoc, HitNorm, SwordTip, SwordHilt, Momentum;
local int DamageAmount;

SwordTip = GetSwordSocketLocation(SwordTipSocket);
SwordHilt = GetSwordSocketLocation(SwordHiltSocket);
DamageAmount = FCeil(InstantHitDamage[CurrentFireMode]);

foreach TraceActors(class'Actor', HitActor, HitLoc, HitNorm, SwordTip, SwordHilt)
{
if (HitActor != self && AddToSwingHitActors(HitActor))
{
Momentum = Normal(SwordTip - SwordHilt) * InstantHitMomentum[CurrentFireMode];
HitActor.TakeDamage(DamageAmount, Instigator.Controller, HitLoc, Momentum, class'DamageType');
}
}
}

simulated function bool HasAmmo(byte FireModeNum, optional int Ammount)
{
return Swings[FireModeNum] > Ammount;
}

simulated function FireAmmunition()
{
StopFire(CurrentFireMode);
SwingHitActors.Remove(0, SwingHitActors.Length);

if (HasAmmo(CurrentFireMode))
{
super.FireAmmunition();
}
}

defaultproperties
{
Begin Object class=AnimNodeSequence Name=MeshSequenceA
End Object

// Weapon SkeletalMesh
Begin Object Name=FirstPersonMesh
SkeletalMesh=SkeletalMesh'AFTUClaws.Claws'
//AnimSets(0)=AnimSet'WP_ShockRifle.Anim.K_WP_ShockRifle_1P_Base'
//Animations=MeshSequenceA
Rotation=(Yaw=-16384)
FOV=60.0
End Object

AttachmentClass=class'AFTU.AFTU_AlienMeleeAtachment'

Begin Object Name=PickupMesh
SkeletalMesh=SkeletalMesh'AFTUClaws.Claws'
End Object

MaxSwings=2
Swings(0)=2

MaxAmmoCount=1
AmmoCount=1

ShotCost(0)=0
ShotCost(1)=0

bMeleeWeapon=true;
bInstantHit=true;
bCanThrow=false;

FiringStatesArray(0)="Swinging"
FiringStatesArray(1)=None

WeaponFireTypes(0)=EWFT_Custom
InstantHitDamage(0)=35

}



The next 8 weeks are going to be great. All development and no documents to be created. Definitely excited to begin the Beta phase. I'm going to try to be more efficient and try to make this game as complete and playable as possible. Look out for the official website for Arrival: From the Unknown to be up shortly. You can follow our team's development there and keep track of our progress. I'll put up a link in the future so see you guys then!

No comments:

Post a Comment