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

[BUG] Shipyards never stop working #239

Open
Scott-TT opened this issue Jul 11, 2022 · 2 comments
Open

[BUG] Shipyards never stop working #239

Scott-TT opened this issue Jul 11, 2022 · 2 comments
Assignees
Labels
bug:unconfirmed All new bug reports that are yet to be confirmed (eg. by providing more details) bug All bug reports

Comments

@Scott-TT
Copy link

Scott-TT commented Jul 11, 2022

Version: latest/master

Hello, real bug this time as far as I can tell :)

Apologies for very poor PHP skills. Learning on the fly.

In short the shipyards never ever stop working, even when their queue is actually empty, "accumulating" production time while inactive, and then being able to instantly pop out massive amounts of ships. Debug/investigation isn't fun, due to time-sensitive reproduction, but issue can be quickly observed with some manual debugging.

This check is the root cause of the issue, and fails to properly detect that a queue is indeed empty.
Adding a basic debug log error_log("Queue is non-0: adding production time = $ProductionTime") ; right inside the body and refreshing the shipyard page of any inactive planet show that each refresh adds production time.
Requesting ship construction while this buffer is high enough leads to instant build queues (up until the buffer is fully consumed), which is particularly noticeable with a higher game speed multiplier : hours worth of production are typically instantaneous.

Proposed fix : replace with if (!empty($ThePlanet['shipyardQueue'])) . Confirmed to work for shipyards, but NOT retroactive : the buffer will still need to be consumed.

Side note:

While the core issue is that this time leads to (I believe) improper build time mechanics, a fun side-effect is that with enough accumulated time (not much), accessing the overview Page throws this highly funky stack in the logs (but appears just fine to the user)

[11-Jul-2022 23:47:50 UTC] PHP Fatal error:  Uncaught Error: Class "UniEngine\Engine\Common\Exceptions\UniEngineException" not found in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php:13
Stack trace:
#0 C:\Apache24\htdocs\UniEngine\includes\helpers\_includes.php(14): include()
#1 C:\Apache24\htdocs\UniEngine\generate_sig.php(29): include('C:\\Apache24\\htd...')
#2 {main}
  thrown in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php on line 13
[11-Jul-2022 23:47:50 UTC] PHP Fatal error:  Uncaught Error: Class "UniEngine\Engine\Common\Exceptions\UniEngineException" not found in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php:13
Stack trace:
#0 C:\Apache24\htdocs\UniEngine\includes\helpers\_includes.php(14): include()
#1 C:\Apache24\htdocs\UniEngine\generate_sig.php(29): include('C:\\Apache24\\htd...')
#2 {main}
  thrown in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php on line 13

I have no idea why, nor do I believe it worth investigating further at this point.

Regards,
Scott

@Scott-TT Scott-TT added bug All bug reports bug:unconfirmed All new bug reports that are yet to be confirmed (eg. by providing more details) labels Jul 11, 2022
@mdziekon
Copy link
Owner

Hi @Scott-TT, please provide full steps to reproduce, including the testing conditions and environment details, as described in the Bug template that Github should suggest on each new issue creation.

I'm unable to reproduce this issue on my end. Using the debugger breakpoint at the "root cause" you've pointed out doesn't yield any unexpected results, as in - when the queue is empty, it correctly determines that the condition is not true, and does not go into the code block which is responsible for additional work time accumulation.

Therefore, it's either some specific edge case that I'll need to reproduce, or maybe you're using a different runtime environment altogether which behaves differently than my own testing env (eg. newer version of PHP interpreter, which had a looot of breaking changes since the release of the most recent version supported by this Engine).

@Tearow
Copy link

Tearow commented Jan 27, 2023

Proposed fix : replace with if (!empty($ThePlanet['shipyardQueue'])) . Confirmed to work for shipyards, but NOT retroactive : the buffer will still need to be consumed.

This worked for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unconfirmed All new bug reports that are yet to be confirmed (eg. by providing more details) bug All bug reports
Projects
None yet
Development

No branches or pull requests

3 participants