Skip to content

Commit

Permalink
Added more examples and built docs
Browse files Browse the repository at this point in the history
  • Loading branch information
grofit committed Sep 7, 2023
1 parent 83f7670 commit 14582de
Show file tree
Hide file tree
Showing 37 changed files with 75 additions and 23 deletions.
Binary file modified docs/_framework/OpenRpg.Cards.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Cards.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Cards.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Combat.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Combat.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Combat.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Core.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Core.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Core.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.CurveFunctions.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.CurveFunctions.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.CurveFunctions.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Data.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Data.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Data.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Demos.Web.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Demos.Web.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Demos.Web.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Demos.Web.pdb.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Genres.Fantasy.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Genres.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Items.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Items.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Items.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Localization.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Localization.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Localization.dll.gz
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Quests.dll
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Quests.dll.br
Binary file not shown.
Binary file modified docs/_framework/OpenRpg.Quests.dll.gz
Binary file not shown.
Binary file modified docs/_framework/System.Linq.dll
Binary file not shown.
Binary file modified docs/_framework/System.Linq.dll.br
Binary file not shown.
Binary file modified docs/_framework/System.Linq.dll.gz
Binary file not shown.
24 changes: 12 additions & 12 deletions docs/_framework/blazor.boot.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
"netstandard.dll": "sha256-Njv4QtOTpwFKzkaMg8VFjyNAMWyB+YpphaAb1kcimkQ=",
"Newtonsoft.Json.dll": "sha256-cs8pHUurDt0IqbB8YXPh560au3q3J\/1wRL9jBddRVmE=",
"OpenRpg.AdviceEngine.dll": "sha256-mwHKE6uSy29tht26qwWS4oft9KR\/JY5+QOYRWQS\/CSQ=",
"OpenRpg.Cards.dll": "sha256-XBPL8J86PS9OjJ6s7tDvGRrkA0gDGywGCRbNuRXe8qM=",
"OpenRpg.Combat.dll": "sha256-QQdH\/hArhH76JN\/LqlHYCNG9KkOVEKeVZtYnt+IlWdo=",
"OpenRpg.Core.dll": "sha256-BFl15E03TeXI3ZQjFZDL4iMk1lmrvqQEQL93lHwdHsM=",
"OpenRpg.CurveFunctions.dll": "sha256-Yl5pHX6VgNwhBiSEppy9hQsQsHMnGrfpAD8\/YjYU0bY=",
"OpenRpg.Data.dll": "sha256-CJnTB4qe0YdxSXq28e14RoI\/dl0fZEWnEVMiA5lShcA=",
"OpenRpg.Cards.dll": "sha256-8i\/cBidBEdO25Mn6sL4qHbPufyXh3En10qTQ+DB6xyo=",
"OpenRpg.Combat.dll": "sha256-kdK24YJEB5gXcV4zdPhg\/dKGePYv92QGLbjTpohji0A=",
"OpenRpg.Core.dll": "sha256-O83KlxdSIynwzvU8SpG3qtuDjXwd7UD3wejv5b1Zz0M=",
"OpenRpg.CurveFunctions.dll": "sha256-MDxxg2Y390PQPW+dPk1YpRhoPrW+u7BIYz7qu4WMNU0=",
"OpenRpg.Data.dll": "sha256-vYNJeVnY+8tx22UFzoZfABIIvHaRZPwz4jjzDj8gn6U=",
"OpenRpg.Data.InMemory.dll": "sha256-XdmAB1E8NOtcztOLzz2N9INYGnN4LtoAQA2zRVjqPu8=",
"OpenRpg.Demos.Infrastructure.dll": "sha256-\/psbVqucp0c3YlvVZD2I6JM4WqkIt99wmMt\/b37fhEk=",
"OpenRpg.Demos.Web.dll": "sha256-zG\/pgICmvOOAicgz7EdzAjiPFa4Yn3ghr8K9cJroQrg=",
"OpenRpg.Genres.dll": "sha256-zaXcB\/qqbjaM8V7rRFlG1SKIiyRqczcTwXw1t8+vlKE=",
"OpenRpg.Genres.Fantasy.dll": "sha256-GV90VgAhABFCQzhrvOwp+8c6gSb21XhiscP9denJ9Go=",
"OpenRpg.Items.dll": "sha256-BQypYhjryAmciE1qToVJeVjaglCO2bFjo5ZmSfxnm2A=",
"OpenRpg.Localization.dll": "sha256-Za0M2MTUjIHeUbsqT2yv7kKHcPld53F6Fm4zplPzPpM=",
"OpenRpg.Quests.dll": "sha256-3CsgYo9GtDBs9bJIMzJ34qDATtgfI2PhgyjtvwNojOE=",
"OpenRpg.Demos.Web.dll": "sha256-fzIi2X4WyVFg9MyRnCUl7FDyfLP9IGVqXnOP7vYfPdE=",
"OpenRpg.Genres.dll": "sha256-1rUw49xhroiRrCC5SoLs8A0YZjCiK5KVicnvEIC0I2o=",
"OpenRpg.Genres.Fantasy.dll": "sha256-Pz1k3MUzsInOaySjOAo7rEXkDma8ZIYz\/YyNtLCDvjk=",
"OpenRpg.Items.dll": "sha256-wJzAiKNUebP6twoR\/gVNDV2e1foQKWRL5i2SzUcyqS8=",
"OpenRpg.Localization.dll": "sha256-yb0bP9FTvx\/d6qv1ygkGl5865FTrZ55ZlQvOiHKJUKc=",
"OpenRpg.Quests.dll": "sha256-KNsY1KnYsgVEkTn9c4evm9Foq\/kLnBSVnfhrEZCP\/2g=",
"RandomNameGenerator.dll": "sha256-aZenSA\/tE3jilQD1YLI2e5+lV7sZbkqT8aj+SL93+AU=",
"System.Collections.Concurrent.dll": "sha256-3U228gTvMf\/gO9hhTQZGzQ83G6FRxqNnsx\/TbQfbZUI=",
"System.Collections.dll": "sha256-4OQzh8enJT1otPCDBr0DO073OkYRSgynTt1n\/BW46pk=",
Expand All @@ -53,7 +53,7 @@
"System.dll": "sha256-BNWEPToYca0k2Y0PYNhWWJz+D2hRVoqA4pqCB6I0mxE=",
"System.Drawing.dll": "sha256-BW9w083EkVEAm2xBAvSmRXUnpSd45a3GazhKcjthruU=",
"System.Drawing.Primitives.dll": "sha256-2sqtdptuVCbKPTG50s4QWPCMZzz1r2d5gGy60ieYTmM=",
"System.Linq.dll": "sha256-gsNWPYsCOe8R0z0+VRTpiFDii\/KgdkS7tMbiLKINYYc=",
"System.Linq.dll": "sha256-WFZVIZf2K75dKhMdyi7V+onr8R1V4\/B4hMAkePb18kM=",
"System.Linq.Expressions.dll": "sha256-2AWLyEEUmBcfDkWb0BKsmXjqBw5lPOhuAJlMZjMktwY=",
"System.Linq.Queryable.dll": "sha256-cuW5HEWrexvKLiNa74LV1Y7Xb74tT2VEmxzkP9hg5BU=",
"System.Memory.dll": "sha256-f2pwZs1veHufJYGAI2PAQcFZy0VK7DuAEWqkgn39res=",
Expand Down
Binary file modified docs/_framework/blazor.boot.json.br
Binary file not shown.
Binary file modified docs/_framework/blazor.boot.json.gz
Binary file not shown.
74 changes: 63 additions & 11 deletions src/OpenRpg.Demos.Web/Pages/Curves/ScalingFunctionComponents.razor
Original file line number Diff line number Diff line change
Expand Up @@ -105,32 +105,75 @@

<br/>

<CardSection>
<div class="columns">
<div class="column is-one-third">
<Markdown Containerless>
### Experience Required To Level Example
Given how easy this is to do now lets have another look at a useful example, experience required for each level.

Lets not do anything fancy, just make it scale linearly with us having 20 levels with the maximum xp threshold
being 10000, that means its about 500 extra per level when done linearly.
</Markdown>
</div>
<div class="column is-one-third">
<ScalingFunctionChart Title="Experience Per Level" ScalingFunction="XpToLevelScalingFunction" XAxisName="Level" YAxisName="Experience Required" ChartColor="#2ecc71" />
</div>
<div class="column is-one-third">
<div class="field">
<label class="label">Level</label>
<div class="control">
<input class="input" type="text" @bind="InputValue3">
</div>
</div>
<div class="field">
<label class="label">Experience Required</label>
<div class="control">
<a class="button is-primary" @onclick="RefreshOutputValue3">Plot Value</a>
<label class="label">@OutputValue3</label>
</div>
</div>
</div>
</div>
</CardSection>

<br/>

<CardSection>
<div class="columns">
<div class="column is-one-third">
<Markdown Containerless>
### Experience Required To Level Example
Given how easy this is to do now lets have another look at a useful example, experience required for each level.
### Inverse Value Scaling
So lets look at something which you may need to do but dont know it yet, and this is a real world problem I faced
when doing some work in Unity.

Say you have to have an `AttackSpeed` stat, and you want `Effects` to bump that value up so you can attack faster,
it sounds great until you come to implement it as to attack faster you want LESS of a cooldown between attacks.

Lets not do anything fancy, just make it scale linearly with us having 20 levels with the maximum xp threshold
being 10000, that means its about 500 extra per level when done linearly.
This is a scenario where you want to inversely scale the input value as they are both pulling in different directions,
so far both values have being going up together at their own rate of scale, but in this case we want to go the opposite
way, so lets use an `InverseLinear` preset and set input range as 0-100 as 100 seems pretty high for attack speed, then
set the output scaling as between 0.5 and 2.

> As this is using an INVERSE curve the max and min are effectively flipped so the maximum input value would yield
> the minimum output value, give it a go.
</Markdown>
</div>
<div class="column is-one-third">
<ScalingFunctionChart Title="Experience Per Level" ScalingFunction="XpToLevelScalingFunction" XAxisName="Level" YAxisName="Experience Required" ChartColor="#2ecc71" />
<ScalingFunctionChart Title="Attack Cooldowns" ScalingFunction="AttackSpeedScalingFunction" XAxisName="Attack Speed" YAxisName="Cooldown In Seconds" ChartColor="#3498db" />
</div>
<div class="column is-one-third">
<div class="field">
<label class="label">Level</label>
<label class="label">Attack Speed</label>
<div class="control">
<input class="input" type="text" @bind="InputValue3">
<input class="input" type="text" @bind="InputValue4">
</div>
</div>
<div class="field">
<label class="label">Experience Required</label>
<label class="label">Attack Cooldown</label>
<div class="control">
<a class="button is-primary" @onclick="RefreshOutputValue3">Plot Value</a>
<label class="label">@OutputValue3</label>
<a class="button is-primary" @onclick="RefreshOutputValue4">Plot Value</a>
<label class="label">@OutputValue4</label>
</div>
</div>
</div>
Expand All @@ -148,9 +191,13 @@
public float OutputValue2 { get; set; }

public ScalingFunction XpToLevelScalingFunction = new ScalingFunction(PresetCurves.Linear, 0, 10000, 0, 20);
public float InputValue3 { get; set; } = 10;
public float InputValue3 { get; set; } = 1;
public float OutputValue3 { get; set; }

public ScalingFunction AttackSpeedScalingFunction = new ScalingFunction(PresetCurves.InverseLinear, 0.5f, 2, 0, 100);
public float InputValue4 { get; set; } = 35;
public float OutputValue4 { get; set; }

public void RefreshOutputValue1()
{
OutputValue1 = ConstitutionToHealthScalingFunction1.Plot(InputValue1);
Expand All @@ -165,4 +212,9 @@
{
OutputValue3 = XpToLevelScalingFunction.Plot(InputValue3);
}

public void RefreshOutputValue4()
{
OutputValue4 = AttackSpeedScalingFunction.Plot(InputValue4);
}
}

0 comments on commit 14582de

Please sign in to comment.