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

Modify QM distance calculation configurably. #195

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

jt-traub
Copy link
Contributor

  • Added a new config value for transport to use linear connected distance (with a cross-level penalty for going through a shaft)
  • Wrote a new a* search linear connected distance function.
  • modified the evaluation of the order to compute the distance using either the old or new function based on the config.
  • store the distance on the transport order for payment later rather than recomputing it a second time.
  • Since I changed world creation to test connected distance across planes, other tests which relied on random data updated

* Added a new config value for transport to use linear connected
  distance (with a cross-level penalty for going through a shaft)
* Wrote a new a* search linear connected distance function.
* modified the evaluation of the order to compute the distance using
  either the old or new function based on the config.
* store the distance on the transport order for payment later rather
  than recomputing it a second time.
@jt-traub jt-traub force-pushed the jt-qm-range-config-change branch from be0dbe9 to af423ee Compare June 19, 2024 21:23
};

// This doesn't really need to be on the ARegionList but, it's okay for now.
int ARegionList::get_connected_distance(ARegion *start, ARegion *target, int penalty, int maxdist) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using functions in the graphs.h or extending that file with the new features?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that A* should go to the graphs.h in one way or another and use stuff there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't, but I will. I looked at them this morning and they are a bit complex in some ways more than I think was needed, but I also kind of see why you did it that way. I also need them to actually return the distance/exit early if the target isn't within the distance, so it might need another 'variant' of those. Either way, yes, it's possible to revamp them to use it, but I might want to defer that to a followup PR/work after I get the other things I must have for the current game (victory condition work and map generation work). Are you ok with deferring it?

@jt-traub jt-traub merged commit 3072317 into master Jun 21, 2024
10 checks passed
@jt-traub jt-traub deleted the jt-qm-range-config-change branch June 21, 2024 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants