Technical support > Feature Requests

Smooth encumbrance system

<< < (2/4) > >>

Norby:
Here is the completion of the smooth encumbrance system. All changes are available in the zip file at the end of this post.
 
  I applied a maximum in ufoai/src/game/g_match.cpp to limit the skill bonus at the usual level:
--- Code: ---const float penalty = std::min(0.4f, GET_ENCUMBRANCE_PENALTY(weight, chr->score.skills[ABILITY_POWER]));
--- End code ---
   
  This will limit the skill improvement multiplier at 2.5x. Without this the smooth formula in my previous post resulted 20x at 100%. :o
 
  Using this limit the ideal point of strength training is at -12TU. Over this only the mass increase is counted, exactly as in Ufoai 2.5. So 100% weight give only a bit more strength than 75%.

  To indicate this I suggest to change the kg to red when penalty is more than -12TU (at almost 75% weight).
  In ufoai/base/ufos/ui/inv_stat.ufo replace the line "if (penalty > 0) then" with these 3 lines:

--- Code: --- if (penalty < -12) then
  sender:root():child("bt_load"):set_color(1, 0, 0, 1)
elseif (penalty > 0) then

--- End code ---
  Then change these lines also (make room to TU next to kg):

--- Code: ---  name = "bt_load",
class = "button",
pos = {65, 35},
contentalign = ufo.ALIGN_CR,
text = "_0/0 Kg  0 TU (+0)",
color = {0.56, 0.81, 0.76, 1},
flashcolor = {1, 0.5, 0.5, 1},
size = {306, 25},

--- End code ---
  Also in ufoai/base/ufos/ui/equipment.ufo below confunc equip_actorload replace the line start with "if ( <3> > 0 )" to these:

--- Code: --- if ( <3> < -12 ) { *node:parent.bt_load@color = "1 0 0 1" }
elif ( <3> > 0 ) { *node:parent.bt_load@color = "0 1 0 1" }

--- End code ---
  Below "bt_load" need to change these:

--- Code: --- pos "210 30"
flashcolor = {1, 0.5, 0.5, 1},

--- End code ---
  Then change the similar lines in ufoai/src/client/battlescape/cl_hud.cpp to these:
--- Code: --- Com_sprintf(label, sizeof(label), "%g/%i %s  %i %s (%+i)", invWeight / WEIGHT_FACTOR, maxWeight, _("Kg"), tus, _("TU"), tuPenalty);
        int weight_percent = (int)((invWeight/maxWeight)/10.0f);
        float skill_multiplier = std::min(2.5f, ((int)((1/penalty)*10))/10.0f);
Com_sprintf(tooltip, sizeof(tooltip), "%i%%  %.1fx", weight_percent, skill_multiplier);
UI_ExecuteConfunc("inv_actorload \"%s\" \"%s\" %i %i", label, tooltip, tuPenalty, count);

--- End code ---
  Also change in ufoai/src/client/cl_inventory_callbacks.cpp to these:

--- Code: --- Com_sprintf(label, sizeof(label), "%g/%i %s  %i %s (%+i)", invWeight / WEIGHT_FACTOR, maxWeight, _("Kg"), tus, _("TU"), tuPenalty);
        int weight_percent = (int)((invWeight/maxWeight)/10.0f);
        float skill_multiplier = std::min(2.5f, ((int)((1/penalty)*10))/10.0f);
Com_sprintf(tooltip, sizeof(tooltip), "%i%%  %.1fx", weight_percent, skill_multiplier);
UI_ExecuteConfunc("%s \"%s\" \"%s\" %i %i", Cmd_Argv(1), label, tooltip, tuPenalty, count);

--- End code ---


I tested and I like the result. Please get the zip file below this post, test and comment here.

I do not know how to commit changes into github, if somebody tell me the preferred way and I will be allowed then I will send in.

 
Another thing that I cleared the ufoai/base/pics/ui/screen.png file, which is drawn over all ui items, causing "blur" in most screens. I disliked this so I asked my 3 sons separatedly, all said that the ui in 2.5 is more nice, mainly due to the blur in 2.6. This file should be drawn in the background _below_ others or if this is not possible then better if simply left out. Now the game looks better with the "renewed" sharp ui. :)

geever:
Hi,

We use GitHub as a mirror only yet. Patches can be uploaded to our Issue Tracker at: http://ufoai.org/bugs/ (First you need to create a Patch ticket, then you can add attachments)

Thx!
-geever

Norby:

--- Quote from: geever on March 08, 2017, 07:36:58 am ---you need to create a Patch ticket, then you can add attachments
--- End quote ---
Thank you, I uploaded a patch file what I created in this way:
--- Code: ---git diff > Smooth_Encumbrance.patch
--- End code ---

This command excavated my addition of some missing video modes what I added for my monitor. I guess you will forgive me if I do not make another issue ticket just for this so I left in this patch.

About the smooth system I like the possibility of optimizing equipment to the borders, like adding more grenades while it is possible without TU change. Now I have big freedom to select the border: worth to try getting a few extra TU or at least one more in the green area when equip soliders.

Moreover I like that the optimal point of body building is not at 100% weight but at 73%. Here the skill multiplier reach the maximal 2.5x value, as now shown in tooltip over kg. I was always in trouble to train the strength of my best soliders further: simply was not enough room and enough heavy items to reach 100% weigth over 60 strength. Now the optimal point (-12TU) is reachable up to 80 skill points.

Norby:
I improved the formula in red and yellow areas to balance the high speed bonus of experienced soliders.
Start from 50% as before but fall down to only 2TU in total regardless of the speed skill. The change in q_shared.h:
--- Code: ---#define GET_TU( ab, md ) (MIN_TU * (md) + (ab) * 20 / MAX_SKILL * std::min( 1.0f, (md) * 1.45f ))
--- End code ---

This returns the original values up to 50% weigth, over this the bonus of speed ability (ab) is reduced by the weight penalty (md), which leave only 2TU at 100%.

I updated the zip and patch files, please test it.

Norby:
I made smoother color changes:
-Orange label color from -13TU up to the border of the optimal strength training.
-Red color now start from 73% weight, indicating which area should be avoided, where the encumbrance modifier is not increasing further.
-Green and Yellow colors got lighter and darker parts after 4 TU changes.

I also tried very smooth color changes after each TU but it was almost unnoticeable so now use less, more distinguishable colors.

See in the attached zip file or the updated patch.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version