Page 1 of 1

[StrangePan] [2.0.11] Unit commands seems not behaving properly.

Posted: Mon Oct 28, 2024 2:59 am
by heyqule
In test case 1, the group does "attack area" command, but they are not attacking. The attack area has a rocket silo. The group went to the target area and then hit moving_state.stale . They did not attack the rocket silo and the group completed the command as "success" in on_ai_command_completed.
udrunk..JPG
udrunk..JPG (289.82 KiB) Viewed 698 times
In test case 2 Compound command behavior seems not right. The group is supposed to go to area 1 and then attack area 2. The group only finished the first command. Then its moving_state hit "stale". The group command return as failure result in on_ai_command_completed event. The command chain was dropped from the group.

I draft 2 test cases here without other mods.
https://drive.google.com/file/d/1XxxrEL ... drive_link

Here is how you run the test.
Once you unzip the testcase mods to the mod folder. You load the scenario Factorio Test/Test as new game. Click the left top button to open the UI and run the test. You can change the game.speed in the hq_factorio_test/unit-group.lua file to observe their behavior.
RunTest.jpg
RunTest.jpg (286.97 KiB) Viewed 701 times

There are around 10 tests in my mod which are failing due to these unit command behaviors. Those tests run fine in 1.1. Any insight on these issue are appreciated.

I have another question. How does LuaCommandable's moving_state work? The units from both cases got the stale state.

Re: [2.0.11] Unit commands seems not behaving properly.

Posted: Mon Oct 28, 2024 4:11 pm
by cogito123
Similar issue reported under viewtopic.php?f=7&t=116916&p=623629#p623629

Re: [2.0.11] Unit commands seems not behaving properly.

Posted: Mon Oct 28, 2024 5:15 pm
by heyqule
I added a few more tests to test other command. Flee and build base failed too. Using compound command with wandering, then go to location work fine.

Here are the updated tests.
https://drive.google.com/file/d/1jFh72I ... drive_link

Re: [StrangePan] [2.0.11] Unit commands seems not behaving properly.

Posted: Wed Jan 29, 2025 3:27 pm
by StrangePan
heyqule wrote: Mon Oct 28, 2024 5:15 pm I added a few more tests to test other command. Flee and build base failed too. Using compound command with wandering, then go to location work fine.

Here are the updated tests.
https://drive.google.com/file/d/1jFh72I ... drive_link
Thank you for the report and the test cases; they proved useful in reproducing the problems and finding solutions. The compound command and attack area command bugs should be fixed in 2.0.34. Don't forget to check that the rocket silo reference is still valid in the tests before checking its health.

The base building test needs to set the "ignore_planner = true" flag, otherwise the attempt to build a base will fail.

There are still issues with ordering UnitGroups around after immediately spawning units into the group, so the fleeing test still fails, but this is a result of a deeper issue with unit groups that your other tests seem to already be accounting for.

Re: [StrangePan] [2.0.11] Unit commands seems not behaving properly.

Posted: Wed Jan 29, 2025 6:30 pm
by heyqule
Thank you. I'll review all my tests in 2.0.34.