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

Assertion failures when units and cities have 0 vision radius in the ruleset #2459

Open
XHawk87 opened this issue Dec 18, 2024 · 8 comments
Open
Labels
bug Something isn't working oddity Something that is strange or doesn't make sense server This issue requires changes to the server

Comments

@XHawk87
Copy link
Contributor

XHawk87 commented Dec 18, 2024

Describe the bug
The server console gets spammed with assertions when units and cities have 0 vision radius in the ruleset.

To Reproduce
Steps to reproduce the behaviour:

  1. Checkout this branch: https://github.com/XHawk87/LTT-LTX/tree/zero_vision_bug
  2. Start up the server
  3. Play the first turn and see console for errors

Expected behaviour
I wouldn't expect to see any assertion errors. Subsurface and Stealth vision radius should be automatically capped at the Main vision radius. Units with 0 vision radius should only be able to see their own tile, and that's it.

Logs

[critical] freeciv21-server (/home/xhawk87/sources/freeciv21/server/maphand.cpp:1004) - T001: Assertion plrtile->seen_count[V_INVIS] + !game.info.fogofwar <= plrtile->seen_count[V_MAIN] failed

[critical] freeciv21-server (/home/xhawk87/sources/freeciv21/server/maphand.cpp:1006) - T001: Assertion plrtile->seen_count[V_SUBSURFACE] + !game.info.fogofwar <= plrtile->seen_count[V_MAIN] failed

[critical] freeciv21-server (/home/xhawk87/sources/freeciv21/server/citytools.cpp:3270) - T001: Assertion (pcity->server.vision)->radius_sq[V_MAIN] >= (pcity->server.vision)->radius_sq[V_INVIS] failed

[critical] freeciv21-server (/home/xhawk87/sources/freeciv21/server/citytools.cpp:3270) - T001: Assertion (pcity->server.vision)->radius_sq[V_MAIN] >= (pcity->server.vision)->radius_sq[V_SUBSURFACE] failed

[critical] freeciv21-server (/home/xhawk87/sources/freeciv21/server/sanitycheck.cpp:136) - T001: Assertion plr_tile->seen_count[V_INVIS] <= plr_tile->seen_count[V_MAIN] failed
[critical] freeciv21-server (/home/xhawk87/sources/freeciv21/server/sanitycheck.cpp:136) - T001: (  82,   19) at "Lake"

Platform and version (please complete the following information):

  • OS: Linux
  • Freeciv21 version: 3.1-rc.1
  • Ruleset/Longturn game (if applicable): Chaos

Additional context
Discord

@XHawk87 XHawk87 added bug Something isn't working Untriaged This issue or PR needs triaging labels Dec 18, 2024
@XHawk87
Copy link
Contributor Author

XHawk87 commented Dec 18, 2024

Blocks longturn/rules-of-chaos#16

@lmoureaux lmoureaux added server This issue requires changes to the server and removed Untriaged This issue or PR needs triaging labels Dec 23, 2024
@lmoureaux
Copy link
Contributor

Why should Subsurface and Stealth be capped to Main?

@XHawk87
Copy link
Contributor Author

XHawk87 commented Dec 23, 2024

If they were higher, it would mean being able to detect spies or submarines in tiles you can't see.

@lmoureaux
Copy link
Contributor

Airport radars can see 100km away, I guess that's about a modern city's working area... capping might make sense but I'm still not fully convinced.

The assertion is caused by an effect that's implicitly added to the ruleset for backward compatibility because +Vision_Layer is not part of the effects.ruleset capabilities (this is documented here). Adding the capability solves the issue in your case.

@XHawk87
Copy link
Contributor Author

XHawk87 commented Dec 23, 2024

Is the client capable of showing units in tiles that are in fog? I don't have a problem with it, per se. One unit could give vision of the tile, and you could know about hidden units there due to another, I guess.

The assertion is caused by an effect that's implicitly added to the ruleset for backward compatibility because +Vision_Layer is not part of the effects.ruleset capabilities (this is documented here). Adding the capability solves the issue in your case.

I used the VisionLayer option in effects.ruleset in my Chaos test (after being told that +VisionLayer isn't a thing, despite what the docs claim). Is it really +Vision_Layer?

@lmoureaux
Copy link
Contributor

Is the client capable of showing units in tiles that are in fog?

I don't know, most likely not...

Is it really +Vision_Layer?

Nice finding, the capability is called Vision_Layer and the docs are wrong (the + means the ruleset needs the server to support it). The requirement type is called VisionLayer without underscore.

@XHawk87
Copy link
Contributor Author

XHawk87 commented Dec 23, 2024

Well, if it doesn't cause problems, I would suggest removing the assertions that Stealth vision and Subsurface vision can't exceed Main vision, since in that case they're not valid assertions.

If it does cause problems that can't easily be addressed, it might be better to cap them to Main vision.

@lmoureaux
Copy link
Contributor

I don't see anything in the server code that would require this limitation, but I also can't make it work, so I assume the assertions make sense.

I believe this should "just work" without clipping or anything like that, so my current plan is to document the limitation and open an issue for it.

@lmoureaux lmoureaux added the oddity Something that is strange or doesn't make sense label Dec 23, 2024
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Dec 23, 2024
* Warn that Stealth and Subsurface must be smaller than Main
* Fix the ruleset option name Vision_Layer

See longturn#2459.
jwrober pushed a commit that referenced this issue Dec 24, 2024
* Warn that Stealth and Subsurface must be smaller than Main
* Fix the ruleset option name Vision_Layer

See #2459.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working oddity Something that is strange or doesn't make sense server This issue requires changes to the server
Projects
None yet
Development

No branches or pull requests

2 participants