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

Make it possible to forcibly research a tech that is instantly researchable after TC due to tech leak #1753

Closed
daavko opened this issue Jan 18, 2023 · 8 comments · Fixed by #2210 or #2384
Assignees
Labels
enhancement New feature or request server This issue requires changes to the server
Milestone

Comments

@daavko
Copy link
Collaborator

daavko commented Jan 18, 2023

Is your feature request related to a problem? Please describe.
Currently, if RNGeezus wants, a player may end up in a situation where they have more bulbs stored than their current research target costs, due to tech leak. This happens due to player processing order, where a player might gain just-not-enough bulbs to research a tech, but a player processed later might have enough, causing the cost to drop due to tech leak. Sometimes you can then "force" the game to research the tech by switching to another one that's sufficiently expensive (so you don't insta-research it and lose your bulbs) and then switching back, forcing the server to process the research. This may not always be possible, forcing the player to wait until next TC.

Describe the solution you'd like
Two potential solutions:

  1. Make the server somehow find out if tech leak would affect players that have already been processed, and process their research again (this might do weird stuff with obsoletions and stuff, I don't know the exact sequence of events in the TC sequence)
  2. Quite a bit simpler, when the player sets their tech goal to the one they're currently researching, the server accepts this and processes it as if the player switched to any other tech. I'm pretty sure this would mean just removing lines 1020-1022 in techtools.cpp, but this is only from a cursory search. It does appear that the client sends the "switch research" packet even when the player clicks on a tech they're currently researching.

Describe alternatives you've considered
Leaving it as-is...

Additional context
No additional context

@daavko daavko added enhancement New feature or request Untriaged This issue or PR needs triaging labels Jan 18, 2023
@lmoureaux
Copy link
Contributor

Looks like techs are updated first, so obsoletions and so on shouldn't be affected.

@lmoureaux lmoureaux added server This issue requires changes to the server and removed Untriaged This issue or PR needs triaging labels Jan 19, 2023
@lmoureaux
Copy link
Contributor

I can see two options to take tech leak into account during TC:

  • Do multiple rounds of the current "lucky last" algorithm. This is easy to implement.
  • All players that can research their tech pay the full price, then we check again with the reduced prices. So always boost behind players more.

Both cases enable a lot of gambling and micromanagement, especially in team games with a lot of info available.

Should getting techs through diplomacy also update other players' research?

@jwrober
Copy link
Collaborator

jwrober commented Jan 23, 2023

Need to figure out a way to easily reproduce this event as it typically only happens on LT multiplayer games.

@jwrober
Copy link
Collaborator

jwrober commented Feb 18, 2024

Should getting techs through diplomacy also update other players' research?

My thinking here is that any time a tech is "researched" even if its given in a diplomacy treaty is the same as if the player researched the old fashioned way.

jwrober added a commit to jwrober/freeciv21 that referenced this issue Feb 24, 2024
lmoureaux pushed a commit that referenced this issue Mar 26, 2024
@jwrober jwrober reopened this Aug 2, 2024
@jwrober
Copy link
Collaborator

jwrober commented Aug 2, 2024

Re-opening this issue. The PR doesn't do what is expected.

@lmoureaux
Copy link
Contributor

The following check in the server code prevents the player_research packet from refreshing the current tech:

if (research->researching == tech) {
return;
}

@jwrober
Copy link
Collaborator

jwrober commented Sep 10, 2024

Any I'll effects if we remove it?

@lmoureaux
Copy link
Contributor

None that I could find by reading the code, but I haven't tried

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This issue requires changes to the server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants