Combat Improvements

Barry Wood
Crayta
Published in
6 min readAug 27, 2021

One of the biggest updates coming to our next Season of Neon Coast, is massive improvements to gun mechanics and gameplay. We’ve seen a huge increase in shooters in Crayta, and lots of user created packages altering and adding to the gun packages. So we decided it was time to focus energy and time to making the stock gun mechanics feel a lot more special.

Programmer Barry, who worked extensively on these improvements, takes you through each change and how they work!

CONTENTS

To learn more about these changes in detail, and learn how to use the scripts and implement them to your games, head to our Developer Site for the Tutorials that will be live when the update goes live, 8th September 2021.

High Fidelity Hit Boxes

The combat has been improved thanks to the inclusion of high fidelity collisions, which all games in Crayta can now utilise.

The image here shows some of the magic that makes Crayta tick!

  • These lines represent the collision on your player. Until now, the big capsule around your player was the only thing you could collide against, so you could aim between someone’s legs, or above their shoulders, and still register a hit if you shot them.
  • Crayta will now let you ignore this outer collision capsule and instead collide with only the smaller collision bounds that wrap tightly around the player mesh.
  • What’s more, you can now tell precisely which part of the player has been collided with!
  • The latest gun template in the gun package will use this new high fidelity collision.

Collidable Body Parts

This video shows the areas in which can now shoot and not collide with the player, such as between the legs, and close to the body; giving a much more detailed feel to combat.

Headshots

Until now, headshots have been detected by adding a trigger box with the ‘damageCritScript’ attached to the Player template around the head.

We can now detect these headshots directly against the player mesh, so this trigger box has been removed from the Player template in all new games. But the damageCritScript remains part of the gun package, since this could still be used to determine critical hits against anything else in your game.

Framing

As part of the improvements to combat animations, one of the things we’ve improved in this update is the framing of the character as you play.

For example, precise changes to the camera position means you can now draw an imaginary line through the crosshair to the bottom corner of the screen, with the player/gun lined up beautifully along it.

Look at Crosshair

We’ve made changes to how the player character animates while you hold a gun, so that the gun is now always pointing directly at whatever is under your cursor. This should make all your shots feel like they are travelling exactly where you’re aiming. The video below shows this in action with the help of a handy debug line to show how the player’s gun is always oriented to face the right direction.

We’ve also smoothed the look of the player as they rotate on the spot while looking down the gun which, when paired with this improvement of where the gun is always facing, makes aiming feel buttery smooth!

Limited Ammo

Until now, guns from the stock Gun package in Crayta would let you set how many ‘shots per clip’ your gun had, allowing you to fire this many times before you had to reload. You could fire & reload as many times as you liked without ever running out of bullets. We’ve made some changes to address this, so that weapons can now specify which type of ammunition they require. If your inventory runs out of this ammunition, you won’t be able to reload!

Note that the game starts with the gun containing a full clip of 30 bullets. This is because ‘Shots Per Clip’ for this gun was set to 30, and ‘Start with Full Clip’ was ticked. The number under this shows how many of this type of bullet are currently in your inventory.

Camera Shake

We’ve also added a Camera Shake asset to compliment the existing gamepad vibration asset.

Here’s an example of this in action with a camera shake triggered every time the player jumps, with the Scale parameter tied to the jump height multiplier of the player:

Camera shake effect at location

The PlayCameraShakeEffectAtLocation has been added to the World API, and can be used to create a rumble at a certain location in the world. The closer the player is to the epicentre, the greater the camera shake’s effect can be felt.

Learn in more detail on Camera Shake when the update goes live on September 8th 2021 on our Developer Site!

Combat Audio

We’ve made some improvements to combat audio, have a listen to the new default gun sounds on the Gun, Pistol and Shotgun packages!

We’ve also added close and distant sounding versions of the weapon sound assets where the game will automatically crossfade between the two sets of sounds depending where the sound is being played.

In addition to the updates to our gun packages there’s a collection of new weapon, explosion, and impact sound which also use close and distant variations to add to your own creations.

Adjust Aim

AdjustAim is a new system available to creators that has been added to the character API.

What is it?

AdjustAim allows your game to control exactly where the player character needs to look, as well as providing control over how this change in look-at orientation is applied smoothly over time
This gives you far more control over precisely where you want the player to be looking towards!

Here’s how that might look:

Example 1 — Look at three targets in a row

Example 2 — Rotate by angle

Example 3 —Individual Turns

Where can I see examples of this being used in Crayta?

We have added Recoil to the stock gun packages, this is a great example of the kind of thing that is now easy to do with the new AdjustAim API!

While we were at it, we also decided to improve the existing Aim Assist that was present in the stock Gun package to use AimAdjust. We can’t wait to see what other uses you come up with for it!

Recoil

A new recoil script has been added to the stock gun package, which utilises the new AdjustAim API to bring these weapons to life!

Recoil Script Properties

The recoil script has these properties associated it.

We recommend having a go at altering each of these parameters by yourself to get a better feel of what they do.

Examples

Let’s have a quick look at what some of these do! Each video below is taken with all of the properties on the left set on the Gun, but in each video some of these properties have been altered. We’ve made some of these changes quite extreme so you can more easily spot the difference!

Vertical Recoil Min/Vertical Recoil Max

Recoil Speed

Recoil Camera Shake

Aim Assist

Aim Assist is something that was present in the stock Gun package, but we’ve been able to revamp it thanks to the new AimAdjust API, so it should feel better than it did before.

We hope that by adding these many improvements, shooters in Crayta will start to pack more of a punch, and increase not only the enjoyment for players, but giving more control and customisable options for Creators.

Want to join our community, and meet players and creators? Join our supportive and thriving Discord server!

--

--