in RPG, Voxel

This Week In Veloren 180

From Veloren: link to original post

This week, we hear about changes that are being made to the Scrolling Combat Text system.

- AngelOnFira, TWiV Editor

Contributor Work

Thanks to this week's contributors, @zesterer, @xMAC94x, @DaforLynx, @Isse, @XVar, @Awkor, @Christof, @Julio, @Slipped, and @Socksonme!

Weather by @Isse has been merged!.

Scrolling combat text by @Socksonme

For the past couple of months, I've been working on a rewrite of the SCT system that we have. (These are the damage numbers that show up on the screen - both for the player and the enemies). The old method that was used for creating the "floaters" had many issues. First, it checked if the health had changed in the last frame, and second, it only used the last change applied to the health. The way that the check was made was by storing the hp on the current tick, and then on the next tick - comparing them to see if they're different.

The issue that this caused was that an equal amount of healing and damage done in the same tick would lead to no damage numbers being shown. The second issue, which is displaying only the last change, led to some attacks/weapons showing incorrect damage. For example - the bow's "Shotgun" attack, the slashing damage from the sword, whenever the enemy doesn't have enough energy left, or the poise damage, whenever the enemy is stunned. All of these attacks apply multiple changes to the health, in the same tick, which would obviously cause an issue.

The new system put in place now uses "outcomes", which are the result of an event. Whenever an attack is applied, a HealthChange server event is emitted. This is then handled and then a HealthChange outcome is emitted. Then, for every HealthChange outcome, we go through some new conditions in order to see how some health changes should be displayed. Before the HealthChange server event is emitted, a random number is generated and then stored, since we will want to group up damage from the same attack (I will explain why later).

Another value that is now stored is the crit boolean, which, as the name suggests, stores whether a health change was a crit or not. Crits dealt to an enemy are separated from regular attacks, and they themselves aren't accumulated with other crits. They are also displayed in a random position left or right from where the regular attacks show up. They are a bit larger than the damage numbers for regular attacks and have a yellow color.

In comparison to the floaters for the enemies, crits and regular attacks are shown in the same position for the player, and are accumulated normally, however, they still possess a yellow color. I decided to also let the player decide the duration for which floaters should be accumulated. This is done by having two separate sliders going from 0.0 seconds to 2.0 seconds (one for damage dealt by the player and one for damage dealt to the player).

However, this poses another small issue, which is that, if you have damage from the same attack happening in the same tick, while you have the damage accumulation duration set to 0 seconds, this would lead to the text being unreadable. As a method to solve this, as I mentioned before, we check if this random number (which is the same for damage from the same attack) is the same, and also if it's from the same tick, and if so - accumulate the damage.

Some minor changes also include: having a toggleable option for rounding damage which is greater than or equal to 1.0, having an option for experience number accumulation (I decided that having a slider for the duration would be excessive) and some sources of damage/healing - for example, fall damage, campfires, food, the regeneration buff, and others, now show up in the SCT. Also, since we now have a slider for the accumulation duration, I felt that I should remove both the single and cumulated damage options. (might post some images later)

Ready to fight! See you next week!

Support the project!

Veloren Open Collective