Newly spawned peasants lose their sense of "home"

Bug #1094594 reported by Julio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stratagus
Fix Released
Undecided
cybermind

Bug Description

rev 8542

Test Map: 128x128 (attached as Archive.zip):

Using land_attack.lua logic:

Initial peasant builds hall where he stands, and farms in close proximity. Also gathers resources in close proximity to hall.

land_attack then asks for more peasants with: AiSet(AiWorker(), 4)

newly spawned peasants cross entire map to build barracks, and gather resources from great distances.

This impairs the AI player's ability "ramp-up" quickly and have a strong "home base".

I have also observed these spawned peasants lose their ability to re-enter their home hall and spend the remainder of the game wandering around resources in hand.

NOTE: If land_attack.lua is modified slightly to omit: AiSet(AiWorker(), 4), the initial peasant builds barracks within close proximity to hall, but as soon as AiSet(AiWorker(), x) is called, those newly spawned peasants lose their sense of "home" and begin to wander great distances for resources and to build.

Please contact me with any additional questions.

Related branches

Revision history for this message
Julio (artofwar) wrote :
Revision history for this message
cybermind (iddqd-mail) wrote :

it's because of my new addition of depot rearrangement system, where workers go to another depot if the current one is too far from resources. Will fix it soon

Changed in stratagus:
assignee: nobody → Joris Dauphin (joris-dauphin)
status: New → Confirmed
assignee: Joris Dauphin (joris-dauphin) → cybermind (iddqd-mail)
Revision history for this message
Julio (artofwar) wrote :

Thank you cybermind, my development with the LUA AI scripts is currently on hold due to this issue. Looking forward to a fix "soon".

Your efforts are appreciated!

Revision history for this message
Julio (artofwar) wrote :

Any news on this? Kinda makes the game unplayable (computer vs human)

Revision history for this message
cybermind (iddqd-mail) wrote :

Test it now (should be fixed)

Revision history for this message
Julio (artofwar) wrote : Re: [Bug 1094594] Re: Newly spawned peasants lose their sense of "home"

Hello,

Getting a compile error on 8635:

In file included from /Development/Stratagus_Wargus/stratagus.8635/src/game/game.cpp:57:
/Development/Stratagus_Wargus/stratagus.8635/src/include/netconnect.h:135:72: error: no matching function for call to 'max'
        static size_t Size() { return 1 + 1 + 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4 + std::max(256u, std::max(CNetworkHost::Size() * PlayerMax, CServerSetup::Size())); }
                                                                              ^~~~~~~~
/usr/include/c++/4.2.1/bits/stl_algobase.h:204:5: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned int' vs. 'unsigned long')
    max(const _Tp& __a, const _Tp& __b)
    ^
/usr/include/c++/4.2.1/bits/stl_algobase.h:246:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    max(const _Tp& __a, const _Tp& __b, _Compare __comp)
    ^
1 error generated.

On Mar 22, 2013, at 9:55 AM, cybermind <email address hidden> wrote:

> Test it now (should be fixed)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1094594
>
> Title:
> Newly spawned peasants lose their sense of "home"
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/stratagus/+bug/1094594/+subscriptions

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

Compile (on 64bit OS) issue should be fixed in 8636.

Revision history for this message
Julio (artofwar) wrote :
Download full text (4.1 KiB)

Compiled okay, but with warnings (see below). Bug appears to be fixed on test map, thank you!

Compile warnings:

/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:525:22: warning: use of logical '&&' with constant operand
      [-Wconstant-logical-operand]
        if ((ttdown & 0x10) && 1) {
                            ^ ~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:525:22: note: use '&' for a bitwise operation
        if ((ttdown & 0x10) && 1) {
                            ^~
                            &
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:525:22: note: remove constant to silence this warning
        if ((ttdown & 0x10) && 1) {
                           ~^~~~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:526:28: warning: use of logical '&&' with constant operand
      [-Wconstant-logical-operand]
                tile |= ((ttleft & 0x06) && 1) * 1;
                                         ^ ~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:526:28: note: use '&' for a bitwise operation
                tile |= ((ttleft & 0x06) && 1) * 1;
                                         ^~
                                         &
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:526:28: note: remove constant to silence this warning
                tile |= ((ttleft & 0x06) && 1) * 1;
                                        ~^~~~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:527:29: warning: use of logical '&&' with constant operand
      [-Wconstant-logical-operand]
                tile |= ((ttright & 0x09) && 1) * 2;
                                          ^ ~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:527:29: note: use '&' for a bitwise operation
                tile |= ((ttright & 0x09) && 1) * 2;
                                          ^~
                                          &
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:527:29: note: remove constant to silence this warning
                tile |= ((ttright & 0x09) && 1) * 2;
                                         ~^~~~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:530:20: warning: use of logical '&&' with constant operand
      [-Wconstant-logical-operand]
        if ((ttup & 0x20) && 1) {
                          ^ ~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:530:20: note: use '&' for a bitwise operation
        if ((ttup & 0x20) && 1) {
                          ^~
                          &
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:530:20: note: remove constant to silence this warning
        if ((ttup & 0x20) && 1) {
                         ~^~~~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:531:28: warning: use of logical '&&' with constant operand
      [-Wconstant-logical-operand]
                tile |= ((ttleft & 0x06) && 1) * 8;
                                         ^ ~
/Development/Stratagus_Wargus/stratagus.8636/src/map/map.cpp:531:28: note: use '&' for a bitwise operation
                tile |= ((ttleft & 0x06) && 1) * 8;
                               ...

Read more...

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

warnings should be fixed in rev.8674

Changed in stratagus:
status: Confirmed → Fix Committed
Revision history for this message
Julio (artofwar) wrote :

Compile error in rev.8674

[ 57%] Building CXX object CMakeFiles/stratagus.dir/src/network/net_message.cpp.o
/Development/Stratagus_Wargus/stratagus.8674/src/network/net_message.cpp:621:28: error:
      out-of-line definition of 'CNetworkChat::Size' differs from the declaration in the return type
unsigned int CNetworkChat::Size() const
                           ^
/Development/Stratagus_Wargus/stratagus.8674/src/include/net_message.h:372:9: note: previous
      declaration is here
        size_t Size() const;
               ^
1 error generated.
make[3]: *** [CMakeFiles/stratagus.dir/src/network/net_message.cpp.o] Error 1
make[2]: *** [CMakeFiles/stratagus.dir/all] Error 2
make[1]: *** [CMakeFiles/stratagus.dir/rule] Error 2
make: *** [stratagus] Error 2

Revision history for this message
Joris Dauphin (joris-dauphin) wrote :

compile should be fixed now in rev 8676 (Note that I don't have an OS 64bit)
Note that it is unrelated to main bug, so please open new bug for future compilation problem.
Thanks for report.

cybermind (iddqd-mail)
Changed in stratagus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.