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

CrewContracts - onUpdateBB #5596

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zonkmachine
Copy link
Member

@zonkmachine zonkmachine commented Jul 15, 2023

Introduce onUpdateBB to the CrewContracts module.

Some points:

  • It's unclear to me what happens when a character is deleted when it's busy in an interview (onChat) but I believe another character gets removed (the next in line) instead when the character is employed and taken off the list. In any case the crew ad update doesn't seem to interfere with the onChat action with a candidate and it can be employed and will show up on the payroll.

Fixes #5510

@impaktor
Copy link
Member

The speed at which the table changes depends on the number of applicants which means most time will be spent in a lower number of crew applicants.

I'm not suggesting any changes to the PR (haven't looked at the code, yet), but if you want to see how number of available ships in the market place was done, I wrote a post on that in #3243, assuming you're facing something similar here, with number of crew contracts, and how these are updated / churn

@zonkmachine
Copy link
Member Author

I wrote a post on that in #3243,

Those plots are mesmerizing...

@zonkmachine
Copy link
Member Author

zonkmachine commented Jul 16, 2023

@Gliese852 Thanks for the review! I'm currently looking into the algorithm @impaktor linked to above. May need to rewrite this. I like this one though.

@zonkmachine
Copy link
Member Author

zonkmachine commented Jul 17, 2023

Number of applicants over about two and a half months game time. There is no affinity to any mean number but just a free running capitalistic hell. System Administration Resting has max applicants of 11 and Cydonia 39. In these scenarios I have modified the chance of reseeding after hitting zero from one in ten to one in a hundred. That's maybe a bit too long of a wait but I think it should be pretty high. Sometimes things just go bad. :)

graph4

@zonkmachine zonkmachine marked this pull request as draft July 18, 2023 19:21
@zonkmachine
Copy link
Member Author

@impaktor OK, trying your way. I haven't tweaked the values to fit the human market yet.

@zonkmachine
Copy link
Member Author

zonkmachine commented Jul 19, 2023

Graph redone for 2.5 months of human galactic migration. This is with the same variables as for the ship market. Please note that the population base is different between master and this PR. Crew Ad used Game.system.population and the one from the ship market uses station.path:GetSystemBody().parent.population. There is more drama in the earlier code.

graph5

@zonkmachine
Copy link
Member Author

Rebased. When you have the 'Crew for hire" add open, the add isn't refreshed when the available crew changes.

@ollobrains

This comment was marked as off-topic.

@ollobrains

This comment was marked as off-topic.

@zonkmachine
Copy link
Member Author

Rebased on master

@zonkmachine
Copy link
Member Author

zonkmachine commented Jan 4, 2025

Rebased. When you have the 'Crew for hire" add open, the add isn't refreshed when the available crew changes.

This is the only issue I can find, otherwise the code adopted from @impaktor works well here.

To test the issue:

  • Start a game at Barnard's Star (as it frequently sees a crew of 0 which helps in assessing the issue). Make sure to have space for one crew.
  • Set game speed to max.
  • Open the 'CREW FOR HIRE' ad and select one of the applicants to open the dialog. Watch the output of the command-line and see when Info: #nonPersistentCharactersForCrew: 3 goes to 0. Now there should be no applicants available but you still have the dialog open.
  • Press "Make offer of position ..."
  • The applicant is now in the crew.

It's not super clean and not all clear what's going on but maybe it's not a problem when the debug line is removed and we're not reminded of it. Essentially the character seem to be still applicable when the crew list goes to zero. The alternative would be to see the dialog window close on that event and this to me sounds possibly messy. Maybe this is ready for review?

@zonkmachine zonkmachine marked this pull request as ready for review January 4, 2025 23:23
@fluffyfreak
Copy link
Contributor

I cannot claim to understand the maths 😆 but having followed the discussion and at least tried to read the code I think that this is good and I'd like to see it reviewed and merged 👍
As it's Lua, and maths, I'll leave it to someone who can give it a proper review on those grounds

@zonkmachine
Copy link
Member Author

I cannot claim to understand the maths

Me neither. The core of it is by @impaktor taken from here and here. It should perhaps be commented in the code more clearly.

@impaktor
Copy link
Member

I don't intend to review the math, if it's just copied from SpaceStation it should be correct, and the graphs above demonstrate it should be fine (baring edge cases of parameters). As @zonkmachine mentioned, it's documented in detail in SpaceStation under the comment "Dynamics of ship adverts in ShipMarket"

Let available crew change over time.
Function copied from the Ship Market.

Co-Authored-By: Karl F <karlfogel@gmail.com
@zonkmachine
Copy link
Member Author

Squashed down to one commit. Debug code removed. Commented and commit message fixed up.

@impaktor
Copy link
Member

Btw, I'm not sure if we'll merge non-bugfix PRs before the bugfix release.

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.

Crew for Hire BBS ad doesn't dynamically spawn
5 participants