Sunday, 22 June 2014

Prototype - Spider Polishing

Remember: 20% of your work is creating something and 80% is polishing it. This is something that lot of developers don't remember and when answering question "how much time you need?" the answer is 20%, not 100%.

So let's move into first polishing iteration of a spider. What I would like to fix:
  • Spider should rotate to player when shooting (the place where it's shooting),
  • Various spider speed,
  • Better impact effects,
  • Better dying effect,
  • Spider lasers are really annoying I can't see anything when they are shooting,
  • Bug: spider is above the ground,
  • Bug: they are still shooting at me when health < 0
And I have one thing in backlog: spider should move on walls/envrio but this is something for different post ;)

Rotate when shooting
Go to SpiderCharacter. Find MyAttack function and interpolate actor rotation like here:
Various speeds
In SpiderCharacter create new float variables:
  • MaxWalkSpeed: 160,
  • MinWalkSpeed: 80,
  • WalkAnimRate,
And add this into end of your Begin Play event.
Go to Animation Blueprint and create float variable: WalkSpeed. Open Anim Graph and find SpiderWarior_MoveForward sequence. When you click on it properties will popup. Pin Rate and assing WalkSpeed.
It's all. Try to change MaxWalkSpeed to get the best results.

Impact effect
We will use particle from Shooter Example: P_Body_Bullet_Impact.

Go to MainAI_Pawn and create new Particle System variable, default should be set to P_Body_Bullet_Impact. 

Now in Event Point Damage spawn emitter at location like here:
Dying effect
I will create ragdoll effect with bone break as well. First of all you need to have Physical Asset prepared. There is great tutorial about them here. You need to watch it all. 

Prepare your physical asset and in SpiderCharacter blueprint go to Take Any Damage event. You should have if health<0 then. Pin your ragdoll when you know that health < 0. I've pinned it with random bool as well so it won't be ragdolling all the time. 
If you want to break bones. There is an option for that in PHAT.
You should experiment with PHAT/ragdolls/breaking bones to get better results that I've.

Just change your start color because it's to big and bloom is enabling. You can work with noise and size as well. Just experiment to have "Spider lasers are really annoying I can't see anything when they are shooting" resolved ;)

What you could do is set Target of Beam more randomly and higher. Just go to SpiderAttackNotify and to Notify Begin and add this as Target.
There is a great site here with lot's of SFXes to use. I will put names of sounds that I will use from this site.

Before Attack Sound: "Science fiction steampunk robot spider scuttle"
Now go to your Attack Animation and create new Sound Nofity with this sound. 

Attack Sound: "Electricity High Voltage Spark Continuous Arcing" I've used Audacity to make the sound smaller.
Go to your SpiderCharacter and create new Audio Component with this sound, name it AttackSound. Auto Activate should be disabled. Now go to custom SpiderAttackNotify and in Begin Event get AttackSound and activate it. In End Event just deactivate it. That's all.

Steps sounds: "Person walking along metal bleacher isle." I've used Audacity to make each step different file. 
Pluging them into your project is really simple. Create Sound Cue - we have created couple of them earlier.
And now in Walking animation just create Sound Notify with this sound and enable bFollow.

Dying Sound: It's really hard to find anything good so won't be doing that now.

Spider is above the ground
This is really simple. Just go to SpiderCharacter and move Mesh down. You can use "ghost" or "toggledebugcamera" console command in-game to check if it's on the ground.

Spider is still shooting when health < 0
In SpiderCharacter find MyAttack function and before you change SpiderState check if State is < 2. 
It will prevent from shooting if Spider is Dead. As you probably remember SpiderState is 2 when we kill him. 

Still in SpiderCharacter find Damage Event and check if Health < 0. After that you should deactivate Beam.
Now go to your custom Notify: SpiderAttackNotify and check if SpiderState < 2.
You need to be sure that your Beam particle have Kill On Deactivate enabled. (in Required)

In SpiderCharacter create two float variables: ScaleMin(0.6) and ScaleMax (1.2) and in begin play event set the scale.
Final Result:
Spider isn't finished yet but it's lots of better now. Remember - there is always room for polishing and it's our first polish iteration so we will get back to this topic.

In next post I will add new flying and exploding enemy.

No comments:

Post a Comment