hw1-5 / C-Hero-Calc

PvE Solver for Cosmos Quest
4 stars 2 forks source link

Cosmos Quest PvE Instance Solver

Summary

I took over the developement out of interest and educational purposes. Well, I also needed a good calculator and David's approach was a good place to start. My goal is to provide a Calculator that is usable even on difficult problems in respect to memory usage and calculation time.

Game forum and disscusuion thread here.

Other Repos and Places you might find interesting:

Features

What's New?

Bunch of Updates happend quietly in the background.

Usage

For most people, just downloading the exe and running it will be enough. For those who are not on Windows they will need to download all files and compile for themselves.

Input

Inputting your heroes:
Enter all of your heroes that you want the Calc to consider for a solution.

To enter a Hero type its name and a : followed by its level. Press enter to submit. (Example: geror:23)
Note: Hero names are always typed as one word, ignoring any special characters. (Sîgrun -> sigrun, Jack'o Knight -> jackoknight), Ascended Heroes are marked by an a in front of their name. (Ascended Geror -> ageror)

Once you have entered all your desired heroes you can either type done or press enter twice to finish.

Entering a lower Follower Limit:
This determines how expensive a monster needs to be in order for the calculator to consider it for a solution.
This feature is intended for users with a lot of followers or good heroes to ignore weak monsters.
Example: Entering 215000 will exclude e8 and cheaper monsters in the solution.

Special Values are: 0 for ALL monsters considered and -1 for NO monsters considered.

Entering an upper Follower Limit:
This determines how expensive the entire solution is allowed to be.
I only reluctantly put this option in because a lot of people asked for it. Note that as soon as calculation starts an upper bound is automatically generated by the Calc.
You can enter your followers here if you think that it speeds up calculation but then you won't be able to know how many followers you are missing to beat the lineup. Your choice.

Special Values are: -1 for unlimited followers.

Entering an enemy Lineup:
Lineups are what you will modify most often. Input here the Fight against which you want to win.

You can enter normal monsters by combining their element (Fire -> f, Earth -> e, Air -> a, Water -> w) with their tier number. Example: Kodama -> a1, Kraken -> w7

You can enter Heroes like you would your own.
You can enter Worldbosses just like Heroes.
If Units belong to the same Lineup they are separated with a ,.
Full Example: a13,geror:12,jackoknight:23,f2,groth:1,ladyoftwilight:1

Alternatively you can enter quests by tying quest, the questnumber, a - and the difficulty in a range from 1 to 3.
Example: quest34-1 will make the Calc look for a solution to quest 34 with 6 monsters, quest55-3 will make the Calc look for a solution for quest 55 with 4 monsters.

If you want to calculate a lot of lineups with the same settings you can do so by entering multiple lineups here and separating them with a space( ). The Calc will then solve every lineup without stopping inbetween.

Compiling

Personally I get it to compile by running: g++ -std=c++11 -Ofast -o CosmosQuest main.cpp inputProcessing.cpp cosmosData.cpp battleLogic.cpp base64.cpp from the command line.

Makefile: Base Makefile provided by BugsyLansky.

Macro Files

What are they?
Macro files are the future!

If this is too much for you please refer to Latas' UI or the Web Editor that will automatically generate macro files. If you do want to learn but still feel lost, here is a Imgur Album explaning how to make your own macro files.

How to use them? Multiple Options:

  1. Start the program normally. It will take the default.cqinput-file as input
  2. Start the program via command line like: CosmosQuest.exe macroFile instead of just CosmosQuest.exe and the program will read everything from the file you specified.
  3. Compile yourself and add your own default macro file name. This will stop you having to start the program via command line.

Input via command line

Input via command line is now mostly unavailable. Compiling yourself or removing default.cqinput from the folder will still give you access to it though.

Control Variables

If you want to use change any of those values you have to compile the program yourself!

Bugs, Warnings and other problems

Regarding non-optimal solutions

I feel like i need to put this up here because as many of you noticed, there are some situation where this calculator does in fact not give the optimal solution.
The reason for this is that old optimization code back from when this program was designed for only normal monsters is still in there and has bugs related to hero abilities. However this code is absolutely vital to keep the runtime of the program in managable regions.

On the user end, changing what heroes are enabled, what level they have, etc. can all affect the outcome of the calculation. Even small changes that I make in the code can be the reason why on one day it might suddenly give a worse or better solution than before. This is undesirable but will require heavy improvements on other ends or a completely new approach to fix.

Regarding RAM usage

The RAM usage as well as computation time heavily scales with available Heroes and Monsters, so I reccomend disabling as many Heroes as possible and setting an appropriate lower limit on Monster Cost.
If you calculate a high DQ-Level you probably wont need those Lv.1 Commons or anything cheaper than monster tier 5 after all.
Having only 15 or 20 Heroes is totally fine but if you enable all of them, your machine will probably run out of RAM.

Bugs that I'm aware of

No currently known unintended behaviours. Let me know if you find anything.

Potential Errors:

bad_alloc: You get this error when the program tries to use more RAM than your computer has available. There is no fix available for this, but I work hard to try and keep the general RAM usage to a minimum.

The programm outputs: "FATAL ERROR": If this happens you should leave a comment in the forums because this is not normal behaviour.