Besides the InventorySystem a good game very often needs a skill- or value-management. Here comes TGorillaSkillSystem in place. Imagine you're playing a character in a RPG or sports game you normally have many different skills you can evolve to get better or make progress.
A SkillSystem manages groups which contains skills and supports multilingual content.
uses Gorilla.Utils.SkillSystem; [...] FSkillSystem : TGorillaSkillSystem; FMySkills : TGorillaSkillGroup; FSkills : Array[0..2] of TGorillaSkill; [...] // create a new empty skill system FSkillSystem := TGorillaSkillSystem.Create(Self); FSkillSystem.Language := 'en-us'; // add a group for managing general skills FMySkills := FSkillSystem.AddGroup(); FMySkills.Name := 'MySkills'; // add some skill to this group FSkills := FMySkills.AddSkill(); FSkills.Name := 'Power'; FSkills.Level := 1; FSkills.MaxLevel := 10; FSkills := FMySkills.AddSkill(); FSkills.Name := 'Speed'; FSkills := FMySkills.AddSkill(); FSkills.Name := 'Turbo'; FSkills.Level := 0; FSkills.MaxLevel := 1; // we can enable this by leveling up the "Speed" skill FSkills.Enabled := false; // just link to another skill FSkills.NextSkill := FSkills.GUID;
Each skill is completely configurable. You activate/deactivate them, configure values and factors for in game computations, and we support evolving of skills by levels. You can also level up by converting one skill into another.
|Activated||Defines if the skill is activated for use. It is different to “Enabled” which only unlocks the skill for activation. By default this value is set to false.|
|Value||Defines the main property/skill value. Use this value to compute game / app effects. By default this value is set to 1.0.|
|Factor||Defines an interpolation factor used with the interpolation method to calculate the level corresponding value. By default this value is set to 1.0.|
|Interpolation||Defines an interpolation function by which a new value is computed, in dependency to the level. By default this value is set to LinearInterpolation.|
|Level||Defines a value to identify a level category. By default this value is set to 0.|
|MaxLevel||Defines the maximum level to be reached. By default this value is set to 0.|
|LevelingTime||Defines the time for leveling up this skill. By default this value is set to 1000ms.|
|NextSkill||Defines a linked skill which will be enabled on leveling up. Use this property instead of interpolation mechanism. By default this value is not set.|
|Data||Use this value to store skill specific variable content. For example if the Value field do not provide enough information for this skill. By default this value is set to TValue.Empty.|
In most games it's not enough to just manage skill values, you also like to evolve your character. Leveling up allows you to change values and factors by levels. Each leveling up will start a TGorillaSkillProcess, because you might won't change the value immediately. The “LevelingTime” property of each skill item defines how long this process takes. At the moment only leveling up is allowed.
Besides easy leveling up, you can also enable new skill values by this method. Simply set the “NextSkill” property in the specific skill item. The leveling-process will automatically enable the new skill.
var LLevelProc : TGorillaSkillProcess; begin LLevelProc := FSkills.StartLevelingUp(); LLevelProc.Start(); end;
We're very sorry but currently the is no user interface template available. So you have to display your skill by yourself.
Load & Save
Skill settings can be written to xml-fileformat. Sadly AssetsManager support is not given yet.
Next step: InputPolling