Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-sync main (oops) #4

Merged
merged 58 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
3648cb5
Use exp array idx for job levels
WorkingRobot Sep 26, 2023
9dc83be
Fix crash when rendering macros and unable to craft recipe
WorkingRobot Sep 26, 2023
36b9e4f
Add HQ consumables to crafting log
WorkingRobot Sep 28, 2023
d9e7816
Updates for v9, begin ui rework
WorkingRobot Oct 1, 2023
cfb5c53
Make crafting log ui nicer, remove redundant code
WorkingRobot Oct 2, 2023
e6081f5
Remove crafty namespace from solver
WorkingRobot Oct 2, 2023
c0f579f
Split solver into MCTS and algorithms
WorkingRobot Oct 2, 2023
42a1bc1
Use TPL when solving with all algorithms
WorkingRobot Oct 3, 2023
6bfff06
Implement max thread count setting using semaphores
WorkingRobot Oct 3, 2023
bdabbbd
API9 updates
WorkingRobot Oct 10, 2023
7327a1a
Add MaxThreadCount default
WorkingRobot Oct 10, 2023
65adab7
Add multi-execution helper for simulator
WorkingRobot Oct 10, 2023
f8f876d
Implement macro scoring and suggesting
WorkingRobot Oct 10, 2023
9a924c8
Ignore if semaphore is used after task is cancelled
WorkingRobot Oct 11, 2023
1da2acc
Finish crafting log helper window
WorkingRobot Oct 11, 2023
398c7f0
Remove old windows
WorkingRobot Oct 11, 2023
234eb3a
1.9.0.0 (Testing) Release
WorkingRobot Oct 17, 2023
6f5c6b6
Fix internal name
WorkingRobot Oct 17, 2023
8db4007
Fix /crafteditor command
WorkingRobot Oct 17, 2023
39e9530
1.9.0.1
WorkingRobot Oct 17, 2023
3836fbe
Disable esc key on RecipeNote window
WorkingRobot Oct 24, 2023
889d074
Fix copying macro to clipboard, and using /nextmacro
WorkingRobot Oct 24, 2023
cd0fbac
Don't move to another macro if it's only going to have one step
WorkingRobot Oct 24, 2023
56383d4
Add macro chain is missing error
WorkingRobot Oct 24, 2023
c0ba440
Add force notification warning
WorkingRobot Oct 24, 2023
60a939e
1.9.0.2 Bump
WorkingRobot Oct 24, 2023
a81b6b3
(1.9.0.3) Fix blank line when copying to macros
WorkingRobot Oct 24, 2023
281b0d2
Allow empty text and hashing for GroupPanel
WorkingRobot Oct 25, 2023
c6c950d
Add internal InputTextEx
WorkingRobot Oct 25, 2023
2462346
Change copy icon to paste
WorkingRobot Oct 25, 2023
f364b09
Add importing of ffxivteamcraft macros
WorkingRobot Oct 25, 2023
2f36093
Add craftingway macro support
WorkingRobot Oct 25, 2023
fe187d9
Clean up aggregate exception handling
WorkingRobot Oct 25, 2023
c7f8097
1.9.1.0
WorkingRobot Oct 25, 2023
a8dcc9f
Add test project
WorkingRobot Oct 31, 2023
a382da0
Add tests CI/CD
WorkingRobot Oct 31, 2023
439a174
Change ActionSet to use pragmas
WorkingRobot Oct 31, 2023
a4dfcc4
Fix typo
WorkingRobot Oct 31, 2023
9f46eff
Change test artifact name
WorkingRobot Oct 31, 2023
706f5c9
Switch to Ubuntu
WorkingRobot Oct 31, 2023
23c49d4
Fix test artifact name
WorkingRobot Oct 31, 2023
256a72d
Add more actionset tests
WorkingRobot Oct 31, 2023
239f71d
Add unofficial builds
WorkingRobot Nov 2, 2023
74195b5
Fix failed to install
WorkingRobot Nov 2, 2023
ac109ae
Fix ActionSet
WorkingRobot Nov 2, 2023
2f727f7
Move accepted actions to ActionSet
WorkingRobot Nov 4, 2023
9ca83bf
Simulator tests (will fail!)
WorkingRobot Nov 4, 2023
d08fedb
Use fixed point arithmetic for progress/quality
WorkingRobot Nov 4, 2023
4f953f2
Add benchmarking and trace build config
WorkingRobot Nov 4, 2023
269a7f9
Optimize trace build, add trace sim code
WorkingRobot Nov 5, 2023
5bee396
Fixed stepwise solver never finishing
WorkingRobot Nov 5, 2023
bfc8708
Update solver scoring; remove byregot adjustment
WorkingRobot Nov 5, 2023
3167b0d
No more byregot for scoring >:c
WorkingRobot Nov 5, 2023
e07617f
Remove tracing
WorkingRobot Nov 5, 2023
a44b15a
RecipeNote layout changes
WorkingRobot Nov 5, 2023
80a758e
Release 1.9.2.0
WorkingRobot Nov 5, 2023
9a490c1
Rename test project folder
WorkingRobot Nov 7, 2023
f8c5f9c
Fix viewport offset on RecipeNote
WorkingRobot Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ dotnet_diagnostic.CA1841.severity = suggestion
dotnet_diagnostic.CA1845.severity = suggestion
dotnet_diagnostic.MA0011.severity = silent
dotnet_diagnostic.MA0076.severity = silent
dotnet_diagnostic.MA0046.severity = silent
dotnet_diagnostic.MA0002.severity = silent
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto detect text files and perform LF normalization
* text eol=crlf
*.png binary
27 changes: 27 additions & 0 deletions .github/create_unofficial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import shutil, os, subprocess, zipfile, json, sys

from itertools import chain

PROJECT_NAME = sys.argv[1]
OFFICIAL_ZIP = f"{PROJECT_NAME}/bin/x64/Release/{PROJECT_NAME}/latest.zip"
UNOFFICIAL_ZIP = f"{PROJECT_NAME}/bin/x64/Release/{PROJECT_NAME}/latestUnofficial.zip"

shutil.copy(OFFICIAL_ZIP, UNOFFICIAL_ZIP)

subprocess.check_call(['7z', 'd', UNOFFICIAL_ZIP, f"{PROJECT_NAME}.json"])

with zipfile.ZipFile(UNOFFICIAL_ZIP) as file:
members = [member for member in file.namelist() if member in (f"{PROJECT_NAME}.dll", f"{PROJECT_NAME}.deps.json", f"{PROJECT_NAME}.json", f"{PROJECT_NAME}.pdb")]

subprocess.check_call(['7z', 'rn', UNOFFICIAL_ZIP] + list(chain.from_iterable((m, m.replace(PROJECT_NAME, f"{PROJECT_NAME}Unofficial")) for m in members)))

with open(f"{PROJECT_NAME}/bin/x64/Release/{PROJECT_NAME}/{PROJECT_NAME}.json") as file:
manifest = json.load(file)

manifest['Punchline'] = f"Unofficial/uncertified build of {manifest['Name']}. {manifest['Punchline']}"
manifest['InternalName'] += 'Unofficial'
manifest['Name'] += ' (Unofficial)'
manifest['IconUrl'] = f"https://raw.githubusercontent.com/WorkingRobot/MyDalamudPlugins/main/icons/{manifest['InternalName']}.png"

with zipfile.ZipFile(UNOFFICIAL_ZIP, "a", zipfile.ZIP_DEFLATED, compresslevel = 7) as file:
file.writestr(f"{PROJECT_NAME}Unofficial.json", json.dumps(manifest, indent = 2))
55 changes: 39 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,76 @@
name: Build

on:
push:
tags:
- '*'
push

env:
PLUGIN_REPO: WorkingRobot/MyDalamudPlugins
PROJECT_NAME: Craftimizer
IS_OFFICIAL: ${{true}}

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0'

- name: Download Dalamud
run: |
Invoke-WebRequest -Uri https://goatcorp.github.io/dalamud-distrib/stg/latest.zip -OutFile latest.zip
Expand-Archive -Force latest.zip "$env:AppData\XIVLauncher\addon\Hooks\dev\"
wget https://goatcorp.github.io/dalamud-distrib/stg/latest.zip
unzip latest.zip -d dalamud/
echo "DALAMUD_HOME=$PWD/dalamud" >> $GITHUB_ENV

- name: Restore
run: |
dotnet restore -r win

- name: Build
run: |
dotnet restore -r win ${{env.PROJECT_NAME}}.sln
dotnet build --configuration Release
env:
DOTNET_CLI_TELEMETRY_OUTPUT: true
dotnet build --configuration Release --no-restore

- name: Test
run: |
dotnet test --configuration Release --logger "trx;logfilename=results.trx" --logger "html;logfilename=results.html" --logger "console;verbosity=detailed" --no-build --results-directory="TestResults"

- name: Create Unofficial Builds
if: ${{env.IS_OFFICIAL}}
run: python ./.github/create_unofficial.py ${{env.PROJECT_NAME}}

- name: Upload Artifact
uses: actions/upload-artifact@v2.2.1
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{env.PROJECT_NAME}}
path: ${{env.PROJECT_NAME}}/bin/x64/Release/${{env.PROJECT_NAME}}
if-no-files-found: error

- name: Upload Test Results
uses: actions/upload-artifact@v3
if: ${{ !cancelled() }}
with:
name: TestResults
path: TestResults

- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
id: release
with:
files: ${{env.PROJECT_NAME}}/bin/x64/Release/${{env.PROJECT_NAME}}/*

- name: Trigger Plugin Repo Update
uses: peter-evans/repository-dispatch@v1
uses: peter-evans/repository-dispatch@v2
if: ${{ steps.release.conclusion == 'success' }}
with:
token: ${{secrets.PAT}}
repository: ${{env.PLUGIN_REPO}}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vs/
obj/
bin/
*.user
*.user
BenchmarkDotNet.Artifacts/
97 changes: 97 additions & 0 deletions Benchmark/Bench.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using Craftimizer.Simulator;
using Craftimizer.Solver;

namespace Craftimizer.Benchmark;

[SimpleJob(RunStrategy.Monitoring)]
[MinColumn, Q1Column, Q3Column, MaxColumn]
public class Bench
{
private static SimulationInput[] Inputs { get; } = new SimulationInput[] {
// https://craftingway.app/rotation/loud-namazu-jVe9Y
// Chondrite Saw
new(new()
{
Craftsmanship = 3304,
Control = 3374,
CP = 575,
Level = 90,
CanUseManipulation = true,
HasSplendorousBuff = false,
IsSpecialist = false,
CLvl = 560,
},
new()
{
IsExpert = false,
ClassJobLevel = 90,
RLvl = 560,
ConditionsFlag = 0b1111,
MaxDurability = 80,
MaxQuality = 7200,
MaxProgress = 3500,
QualityModifier = 80,
QualityDivider = 115,
ProgressModifier = 90,
ProgressDivider = 130
}),

// https://craftingway.app/rotation/sandy-fafnir-doVCs
// Classical Longsword
new(new()
{
Craftsmanship = 3290,
Control = 3541,
CP = 649,
Level = 90,
CanUseManipulation = true,
HasSplendorousBuff = false,
IsSpecialist = false,
CLvl = 560,
},
new()
{
IsExpert = false,
ClassJobLevel = 90,
RLvl = 580,
ConditionsFlag = 0b1111,
MaxDurability = 70,
MaxQuality = 10920,
MaxProgress = 3900,
QualityModifier = 70,
QualityDivider = 115,
ProgressModifier = 80,
ProgressDivider = 130
})
};

public static IEnumerable<SimulationState> States => Inputs.Select(i => new SimulationState(i));

public static IEnumerable<SolverConfig> Configs => new SolverConfig[]
{
new()
{
Iterations = 100_000,
ForkCount = 32,
FurcatedActionCount = 16,
MaxStepCount = 30,
}
};

[ParamsSource(nameof(States))]
public SimulationState State { get; set; }

[ParamsSource(nameof(Configs))]
public SolverConfig Config { get; set; }

[Benchmark]
public async Task<float> Solve()
{
var solver = new Solver.Solver(Config, State);
solver.Start();
var (_, s) = await solver.GetTask().ConfigureAwait(false);
return (float)s.Quality / s.Input.Recipe.MaxQuality;
}
}
17 changes: 15 additions & 2 deletions Benchmark/Craftimizer.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.62">
<Compile Remove="BenchmarkDotNet.Artifacts\**" />
<EmbeddedResource Remove="BenchmarkDotNet.Artifacts\**" />
<None Remove="BenchmarkDotNet.Artifacts\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.8" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.92">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -20,4 +28,9 @@
<ProjectReference Include="..\Simulator\Craftimizer.Simulator.csproj" />
<ProjectReference Include="..\Solver\Craftimizer.Solver.csproj" />
</ItemGroup>

<PropertyGroup Condition="'$(IS_BENCH)'=='1'">
<DefineConstants>$(DefineConstants);IS_DETERMINISTIC</DefineConstants>
</PropertyGroup>

</Project>
Loading