[Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/seafaring-ai into lp:widelands has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Thanks, Tibor. I will take care of the merging :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> SirVer - I added such test: > test_rip_portdock_with_worker_and_ware_in_transit.lua My apologize. I did not remember/see it in the branch. I think this is great then. The other test case you describe is indeed harder to do. You would need to construct a map with military buildings of another player ordered in such a way that as soon as they are all manned, the port has no more space for its dock. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Bug report, so we won't forget: https://bugs.launchpad.net/widelands/+bug/1421107 -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
SirVer - I added such test: test_rip_portdock_with_worker_and_ware_in_transit.lua It is bit lost among other tests, because they all uses the word "portdock" when in fact they mean "port" Though situation when portdock is lost but cannot be restored and port itself has to be destroyed is not tested in any test. I was not sure how to do it - if there was lua interface to remove ownership from field(s) where portdock is - this could be used... or place an enemy military building that would take ownership from fields where portdock is located (and not affect the port building itself) so indeed such test would be usefull. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Approve Time to merge then. The one issue that concerns me still in this branch is that there is no new test for a warehouse that needs to recreate it's port dock. I feel this corner case can easily regress without a test. But since this branch has been sitting for so long, I think it should be merged now. Maybe you can add a test in a later branch, tibor? -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I just completed tests on my debian PC - all passed - I just dont know -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Approve All tests now run without problems on my machine, so IMO this branch is good to go now :) Since the test that's still failing does so only on your machine and for trunk as well, I expect that there's something about your setup that Widelands doesn't like. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
you can run regression tests again. I will look at this one failing test. Also I am testing the game with AI-only players, I will let you know if everything looks alright. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
OK, I moved forward. I reworked the restoration of portdock, returned a bit to initial design and now test_rip_first_port_with_*_in_portdock.lua passed, but test_rip_second_port_with_ware_in_portdock.lua still crashes with that boost error. (As I said it crashes when game is shutting) Generally it is not a showstopper as in a normal game this is stable (talking about linux). I will push the changes tonight or tomorrow for your review. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I will look at this as well of course, but generally I would like to learn and understand how things work there. Also boost is a complication here, because it is a black box and I am not able to undestand a backtrace from it... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Have you tried (temporarily)reverting the change that recreates port docks? It seems the most likely culprit for me. > Am 09.02.2015 um 15:57 schrieb TiborB : > > I spent quite a lot of time on this today, both issues points to > workers/carriers. This part of code I am not familiar at all... but I will > keep looking at it. > -- > https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 > You are reviewing the proposed merge of > lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I spent quite a lot of time on this today, both issues points to workers/carriers. This part of code I am not familiar at all... but I will keep looking at it. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Yes, trunk runs all the tests successfully (I tested twice and did a fresh compile on a fresh branch and tested again and it's OK, and it works for SirVer as well), so the boost problem you're having must be a different problem. Your test explicitly fails, our test just hangs. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
GunChleoc - I test mainly the script *SECOND* not FIRST port with portdock But FIRST... behaves as you described. You are still sure that trunk behaves differently? Both compiled with the same environment... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Probably boost is involved to some degree, but I started tracking down what is triggering the crash. It seem this situation is it: when a builder is in shipping state, left on a ship with no ports remaining and following function http://bazaar.launchpad.net/~widelands-dev/widelands/seafaring-ai/view/head:/src/logic/worker.cc#L1644 is used - it crashes. It need further investigation and also I am not very glad to have to tinker with these parts of code. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Test won't run at all with ./regression_test.py -r test_rip_first_port_with_worker_in_portdock - I get a file not found. Tibor's method works though, here is the relevant output: Trying to run: map:scripting/init.lua: done Trying to run: test/maps/ship_transportation.wmf/scripting/test_rip_first_port_with_worker_in_portdock.lua: done MO(1,ship): ship_update: No destination anymore. Forcing flag at (16, 17) Message: adding (wh) (warehouse) 1 MO(4,port): Setting up port dock fields MO(4,port): Found 1 fields for the dock Message: adding (wh) (warehouse) 1 Forcing flag at (13, 17) Forcing flag at (16, 17) Clearing for road at (14, 17) Clearing for road at (15, 17) Forcing flag at (16, 3) Message: adding (wh) (warehouse) 1 MO(12,port): Setting up port dock fields MO(12,port): Found 1 fields for the dock Forcing flag at (18, 5) Forcing flag at (18, 5) Forcing flag at (16, 5) Clearing for road at (17, 5) Forcing flag at (16, 5) Forcing flag at (16, 3) Clearing for road at (16, 4) MO(6,fleet): Fleet::act MO(5,portdock): set_need_ship(true) MO(5,portdock): ... trigger fleet update MO(5,portdock): set_need_ship(true) MO(6,fleet): Fleet::act MO(6,fleet): Port 5 needs ship MO(6,fleet): ... ship 1 takes care of it MO(1,ship): set_destination to 5 (currently 0 items) MO(1,ship): ship_update: Go to dock 5 Message: removing warehouse (player 1) MO(23,carrier): init_auto_task: become fugitive MO(23,carrier): [fugitive]: found a flag connected to warehouse(s) MO(23,carrier): [fugitive]: try to move to flag Script requests save to: port1_just_removed Autosave: save requested : port1_just_removed Game: Writing Preload Data ... took 7ms Game: Writing Game Class Data ... took 0ms Game: Writing Player Info ... took 1ms Game: Writing Map Data! Writing Elemental Data ... took 0ms Writing Player Names And Tribe Data ... took 0ms Writing Port Spaces Data ... took 1ms Writing Heights Data ... took 0ms Writing Players Unseen Data ... took 4ms Writing Scripting Data ... took 8ms Writing Objective Data ... took 0ms MapSaver::save() took 36ms Game: Writing Map Data took 36ms Game: Writing Player Economies Info ... took 1ms Game: Writing Command Queue Data ... took 8ms Game: Writing Interactive Player Data ... took 0ms GameSaver::save() took 53ms SaveHandler::save_game() took 53ms Autosave: save took 62 ms MO(23,carrier): [gowarehouse]: Got transfer MO(23,carrier): [transfer]: starting task [movepath] and setting location to road 9 MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. MO(1,ship): ship_update: No destination anymore. Looks like the carrier never reaches the warehouse in line 26 of the lua script, so the port isn't built again. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I'm still on Boost 1.54 -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Tino, the patch seems to be aplied... I can do one test though, insert some printf into warelist.cc and run a test game to see whether that piece of code is used during running of widelands at all. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I am not sure if this is related: https://github.com/boostorg/signals2/pull/8/files When i was updating my build environment a few days ago i had to apply this patch to boost 1.5.7 to make it work with widelands. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
boost version: 1.57.0 (installed, it is arch linux, and also widelands reports this version when compiling) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
the file is test_rip_second_port_with_worker_in_portdock.lua After some investigation I found that folowing command will run just particular script: ./widelands --verbose=true --datadir=. --disable_fx=true --disable_music=true --language=en_US --scenario=test/maps/ship_transportation.wmf --script=test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_worker_in_portdock.lua and based on this I was able to get backtrace from gdb, here it is: Program received signal SIGABRT, Aborted. 0xb7fdcbcc in __kernel_vsyscall () (gdb) bt #0 0xb7fdcbcc in __kernel_vsyscall () #1 0xb7805f47 in raise () from /usr/lib/lib/libc.so.6 #2 0xb7807589 in abort () from /usr/lib/lib/libc.so.6 #3 0xb77ff027 in __assert_fail_base () from /usr/lib/lib/libc.so.6 #4 0xb77ff0ab in __assert_fail () from /usr/lib/lib/libc.so.6 #5 0x0877261f in boost::signals2::mutex::lock (this=0xa9b3d14) at /usr/include/boost/signals2/detail/lwm_pthreads.hpp:60 #6 0x08775874 in boost::signals2::detail::unique_lock::unique_lock (this=0xbfffefdc, m=...) at /usr/include/boost/signals2/detail/unique_lock.hpp:29 #7 0x0105 in boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()() ( this=0xa9b3d08) at /usr/include/boost/signals2/detail/signal_template.hpp:229 #8 0x08886f63 in boost::signals2::signal, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()() (this=0xa9b3c30) at /usr/include/boost/signals2/detail/signal_template.hpp:718 #9 0x088c9690 in Widelands::WareList::remove (this=0xa9b3c30, i=8 '\b', count=1) at ../src/logic/warelist.cc:80 #10 0x08adc7df in Widelands::Economy::remove_workers (this=0xa9b3c08, id=8 '\b', count=1) at ../src/economy/economy.cc:401 #11 0x088cdcdd in Widelands::Worker::set_economy (this=0xa9976c0, economy=0x0) at ../src/logic/worker.cc:1168 #12 0x088cf2cc in Widelands::Worker::shipping_pop (this=0xa9976c0, game=...) at ../src/logic/worker.cc:1644 #13 0x0880ba6e in Widelands::Bob::do_pop_task (this=0xa9976c0, game=...) at ../src/logic/bob.cc:283 #14 0x0880be0c in Widelands::Bob::reset_tasks (this=0xa9976c0, game=...) at ../src/logic/bob.cc:388 #15 0x088cdef2 in Widelands::Worker::cleanup (this=0xa9976c0, egbase=...) at ../src/logic/worker.cc:1220 #16 0x08841ee2 in Widelands::MapObject::remove (this=0xa9976c0, egbase=...) at ../src/logic/instances.cc:369 #17 0x08841514 in Widelands::ObjectManager::cleanup (this=0xb490, egbase=...) at ../src/logic/instances.cc:161 #18 0x08772be8 in Widelands::EditorGameBase::cleanup_objects (this=0xb47c) at ../src/logic/editor_game_base.h:180 #19 0x0882a7a7 in Widelands::Game::run (this=0xb47c, loader_ui=0xb2b4, start_game_type=Widelands::Game::NewSPScenario, script_to_run="test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_worker_in_portdock.lua", replay=false) This was trunk... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
./regression_test.py -r test_rip_first_port_with_worker -r searches for the given regular expression in the test name (combination of map + lua file). -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I just grabbed myself a fresh trunk and the tests still go through there. Is there a way to run test_rip_first_port_with_worker_in_portdock.lua without running the whole testsuite? ./widelands --scenario=test/maps/ship_transportation.wmf doesn't work. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Maybe try updating boost? Seems like a boost bug in what you see there. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
so I checked on actual trunk - the same problem ? -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
with me it does not hang, just prints out FAIL for that test. I dont have a good network here and have only some older trunk (half year old about) on harddisk, but tested this trunk and current seafaring and both have similar behaviour, this is my testing session: $python2.7 ./regression_test.py -b ./widelands -r test_rip_second_port_with_worker_in_portdock.lua -k Using './widelands' binary. test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_worker_in_portdock.lua ... Running Widelands ... FAIL == FAIL: test/maps/ship_transportation.wmf/scripting/test_rip_second_port_with_worker_in_portdock.lua -- Traceback (most recent call last): File "./regression_test.py", line 99, in runTest self.verify_success(stdout, stdout_filename) File "./regression_test.py", line 122, in verify_success "Widelands exited abnormally. %s" % common_msg AssertionError: Widelands exited abnormally. Analyze the files in /tmp/widelands_regression_testbVVt4p to see why this test case failed. Stdout is /tmp/widelands_regression_testbVVt4p/stdout_00.txt -- Ran 1 test in 21.740s FAILED (failures=1) Content of log file: $cat /tmp/widelands_regression_testKNpEbT/stdout_00.txt [.] MO(5,portdock): set_need_ship(false) MO(5,portdock): ... trigger fleet update # All Tests passed. <= NOTE HERE WareList: 1 items of 8 left. widelands: /usr/include/boost/signals2/detail/lwm_pthreads.hpp:60: void boost::signals2::mutex::lock(): Assertion `pthread_mutex_lock(&m_) == 0' failed. I will double check with actual trunk tonight -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I see the same as SirVer - tests work in trunk. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> BUT - I compiled trunk, run the tests and they failed on the very test. So no > regression here... not what I see - the test passes for me on trunk and hangs forever in seafaring-ai. It could be something in the new logic of re-adding the portdock to a warehouse. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Resubmit I thought these are brand new tests you just created, nevermind... :) BUT - I compiled trunk, run the tests and they failed on the very test. So no regression here... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
So I looked at your tests - I liked them much, two comments about the issue: 1.) I think this is not AI related - at all 2.) I would say the lua is not correct, and I am not sure what is to be tested. When you extend the sleeps - you can see how the ship picks a worker from port1 and if port2 is destroyed before ships arrives, the worker is returned to port1. But I am not sure if this is what is to be tested. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Hi, does it makes a sense - to have a worker in a portdock? workers and wares are transfered port <-> ship, portdock is not involved I think -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Needs Fixing Houston, we have e problem: test_rip_first_port_with_worker_in_portdock.lua hangs. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Approve ship it! (see what I did there :)) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Approve I have moved the ScoutingDirection enum into ship.h and fixed up the code so it won't get used as boolean. Everything else LGTM. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
rephrasing :) : I will try to mitigate the hurting effect of save/load cycle, but AI has too many internal variables/data structures... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
hi just found a small bug that prevents compilation here, I will push a fix tonight. But I can tell you right now if you are just working on it... I understand... I will try to circumvent it (in next turn), but it is not good... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> Would it be possible to save&load some data? Not objects, only f.e. unordered > sets of integers? It would help much... Of course you could save state, but it won't help: We support right now that two humans start playing a game, later one of them loads it and fills the other slot with an AI. You will still have the case of late initialization then. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Resubmit I fixed most of comments. And I realized that save/load is quite hurting to AI. A lot of internal info of AI is just lost. Some of them will be restored, but I need to do some deeper analysis. But not in this branch. Would it be possible to save&load some data? Not objects, only f.e. unordered sets of integers? It would help much... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
HEY, after some painfull debugging I found that on load restored immovables are not sending notes to players, but instead a player is scanning for them as a part of late_initialization, see here: http://bazaar.launchpad.net/~widelands-dev/widelands/seafaring-ai/view/head:/src/ai/defaultai.cc#L574 So I am working for similar code to scan for ships and will push it to the branch once it is tested and polished ... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I found that when a ship is loaded from savefile no note is sent at all. It is send only when ship is initiated. with playerimmovable it is called from other place. So I will try to find better place to sent a note about new ship from... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> But is seems that there is some mechanism that take care of NoteImmovable > messages and is not in effect for NoteShipMessages. I do not believe that is correct - if it where late_initialization would not be needed. Loading would then just be a very fast way of gaining tons of map objects. I therefore believe that the original designer of the AI code decided to build late_initialization() to create the invariants that the AI relies on. You can check if the buildings vector is also filled if you skip most work in late_initialization. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
@SirVer So I did some simple tests and it is BAD. List of ships is empty after load. So AI will not manage them at all. But his is analogous to productionsites, militarysites vectors when loading game - so I tested militarysites and these are properly initialized = AI knows about all of them after load. (I tested both single player and mulitiplayer game). Though, when I removed 'if (player_ == nullptr)' test for NoteImmovable it crashed for netwok game and survived for single player game. But is seems that there is some mechanism that take care of NoteImmovable messages and is not in effect for NoteShipMessages. What do you think? -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Needs Fixing I did a codereview now and I identified one bug in the AI: it will not work properly after loading. See code review comments. I think this is not ideal, but not critical. After the NOCOMs are removed this should be merged and a new branch should deal with the design issue. Maybe a new bug can be opened to track the problem. All the changes outside of ai/ lgtm. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
of course I tested only AI-only games, because I dont have enough time for a real game... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I'll prioritize looking over this tomorrow. There are some changes outside of ai/ that I'd like to think through before they hit trunk. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
@GunChleoc first NOCOM is perhaps a mistake?? and second one was discussed with SirVer and I think this is no problem and I might remove it. But I will wait for another review and comments -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
My testing was done to see if anything crashes, and to check if behaviour is OK. I think it is OK for now - I just decided to give detailed feedback so we know what can be improved further. Once the 2 remaining NOCOMS are fixed, I think this branch is ready to be merged :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
so to your comments: The main problem is that seafaring is based on one-water assumption. There is no scanning and analysis of map to identify individual distinct waters and making decision which one is worth seafaring. This would have to include cheating probably. I have couple of maps (mine usually) that are one-water-only and used these for testing. Ai builds strictly one shipyard only. If there are 2-3 portspaces available for AI nearby, it will succed to use at least one for port. This can be improved but there are limitations - like AI not in control of layout of roads and so on. As unfinished ship decays the building of ship starts when shipyard is fully stocked - you mentioned this problem probably. If AI finds a portspace it scans the vicinity in some radius - if it runs into other player - the spot is ignored - this was probably what you encountered. The idea behind is that expedition would not be succesfull anyway. But this can be finetuned as well. The result of this is that last expedition lasts forever. This is inefficiency, because a stock on ship and ship itself could be used for transport. But easy to fix/modify. I used my maps spider lake, cristobals sea and soutfall islands for testing - I recommend to use one of them to see seafaring at its bests :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I added a NOCOM - there is also a second NOCOM that I don't have an answer for. I also did some testing, and got no crashes. - On the Fellowships map, 1/3 AIs managed to start building a shipyard and port about 30 minutes into the game. The shipyard was correctly stopped until the port got finished, but then never restarted. The other 2 AIs built something else on the port space. - On the Swamp Island map, 2/3 AIs managed to start building a Port around 30 minutes into the game. On of the ports got overrun by the friendly neighbour, the other AI started building ships in a lake. Maybe we can add a check in the future if the port is reachable from the shipyard's body of water. - Long, long way: I spotted the first Port construction site around 18 minutes into the game. Ships were successfully built, but there was no gold for the expeditions. - Twin Lagoons: First port got built around 1:30 into the game. Both started an expedition. One of the AIs was successful. The second AI failed to build a second port, because there were some port spaces that both AIs kept rejecting. I think we should merge this soon and deal with any remaining issues in new, smaller branches. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
So I pushed another small tweak - now it counts mine fields of the same material type in vicinity - when positioning new mines. In other words it pushes mines in the middle of area of the same material. Before, location was more random and mine could be build on the edge of area (it might have been and edge of mountains or so). I hope no one is just doing the review now... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Review: Resubmit So it seems I am done. I failed to invoke the bug again and I think I am just wasting my time. I removed printfs and nocoms, so it is again ready for your review. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
short update:) I just want to inform you that I am hunting that mysterious bug - so many hours of tests and no crash. I added some printfs for case it crashes, but nothing. I dont know, but I am not sure it is gone... But I would say this bug was not introduced with my changes. Also I added some statistics on command line - this is intended for map creators when testing performance with AI players for what resources are missing or where are the botlenecks, the output looks like: 3: Buildings: Pr: 39, Ml: 9, Mi: 4, Wh: 1, Po: 0. Missing: stone, corn, bread, meat, 2: Buildings: Pr: 76, Ml: 18, Mi: 6, Wh: 1, Po: 0. Missing: stone, wheat, bread, meat, 5: Buildings: Pr: 72, Ml: 14, Mi: 5, Wh: 2, Po: 1. Missing: coal, log, marble, stone, wheat, grape, bread, meat, 4: Buildings: Pr: 63, Ml: 19, Mi: 6, Wh: 2, Po: 1. Missing: marble, stone, wheat, grape, bread, meat, 7: Buildings: Pr: 68, Ml: 16, Mi: 7, Wh: 1, Po: 0. Missing: coal, marble, stone, 6: Buildings: Pr: 69, Ml: 16, Mi: 6, Wh: 2, Po: 0. Missing: coal, log, wheat, meat, now src/ai/defaultai.cc must be edited (there is a variable) to have it printed out (by every 60 minutes now), but if you find it usefull, I can imagine command line switch like '--stats'. By default it will be disabled, of course. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
"I think these tests should be done for all players" - I am not 100% sure, but this does not bother me now. I had another crash today - again on the same place in code. It seems to me that unders some circumstance there can be portdock with no fleet associated to it. I am not sure if the fault is in my changes - might be. But I am going to learn all that object oriented mess related to ports, portdocks and fleets. It will take time... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I think these tests should be done for all players - what you describe can happen for a human player too if he presses the same button twice while the command is still distributed to other players in the game. Can easily happen in slow network games. Your code saveguards against that and should not disturb in any other way. You can doublecheck by running the regression_test.py - it exercises the UI for ships too. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
few words to rev. 7245 I think the crashes of seafaring were due to the command queue, especially when it grows big and it takes too long for a command to be processed. AI does not know whether there is a relevant command in the queue and issues another one based on actual status of the ship. When the first command is executed, the status might have changed and second command might crash the game. So I want to add following check: http://bazaar.launchpad.net/~widelands-dev/widelands/seafaring-ai/view/head:/src/logic/playercommand.cc#L787 (+ 2 similar test below) I thinks (based on testing) it does the job, but I would like to limit the test only to computer player - I just dont know how to find out if the current player is an AI player. I think these tests might interfere with GUI control of ships. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Correct, your type is the enum class name now. If you don't give the enum class itself an explicit type, it will default to int, which would be fine in this case. You also don't need to assign numbers to the members, this is entirely optional and should only be done when you explicitly depend on a member having a specific value. So, get: enum class FleetStatus { kNeedShip, kEnoughShips, kDoNothing }; which will do the job nicely :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Oh, I believed uint8_t is the type. Then 'uint8_t' is not needed at all, is it? -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
//NOCOM - how is it, when I added class here I have to cast everything Because enough_ships isn't of the enum class' type. You will get rid of the cast if you do something like this: enum class FleetStatus: uint8_t {kNeedShip = 0, kEnoughShips = 1, kDoNothing = 2 }; FleetStatus enough_ships = FleetStatus::kDoNothing; etc... Note that I also renamed fleetStatus to FleetStatus, because it's an Object class. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Alright, I fixed what remained. Yet there is one NOCOM with question :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Thanks, this makes the diff a lot smaller :) Give us a shout when you're ready again. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Alright, I merged the trunk once more and resolved conflicts... There is one NOCOM as a reminder for myself... I will change that enum (in defaultai.cc), it is defined within a function so it should not be that dangerous however... -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Neither can I, seems to be gone or hiding. It was about changing the enum to an enum class - the change has the advantage that there is less danger of another enum using the same name and the code jumping on the wrong enum. We are planning to move from enums to enum classes in general. https://bugs.launchpad.net/widelands/+bug/1367725 -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I cannot see it. What line number? -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/seafaring-ai. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I think it is a viable suggestion to work from both ends. I didn't know about the roads problem - maybe it would help to have some sort of safety margin around the port plots where no flags can be set - or if there's a road there, set the flag and dismantle it, so that the road will disappear? That might leave buildings stranded though - tricky. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
We have handfull of seafaring-ready maps. So reworking them should not be too lot of work.But mainly we needs new ones. Your suggestion is viable. But this is still not 100% quarantee of a success. Trees can grow there, or roads can be built there (AI does not control exact layout of roads, it uses underlying algorithm) Let other say what seem the best solution. Maybe both solutions are to be used - cheating via blocking all port fields, and setting a 'standard' that one headquarters needs multiple ports nearby. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
2. Your approach means that mapmakers will have to change their maps so the AI can deal with them. Check out get_port_spaces() in map.h, this will give you a list of all port spaces on the map, so it could be used to let the AI "cheat". Add them to the list of blocked fields for everything else but building a port until the economy has a portdock. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
@GunChleoc Thanks for testing:) 1. In fact the ship algorithm (I mean not part of AI) sometimes incorectly reports islandcircumnavigated (signal), even though nothing were circumnavigated, only banks are too close. And AI is not able to find out the the signal is errorneous. When I tested seafaring AI I edited all such spots on my maps where ships got stucked - making passages wider. 2. Indeed AI "looks" only on owned spots. So it is not aware of port spots even close beyond border. My approach - few port spaces should be available for every headquarters. If probability of making use of portspace is 50 %, 3-4 portspaces (in reasobale spacing) would be enough. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I have done some testing now. I ran into 2 issues: 1. Fellowships: The space is too tight for the AI to manoeuvre the ships. Pathfinding is always tricky though, so I don't think we need to fix it in this branch. 2. Together We're Strong: By the time the AI had build enough military buildings, the port space had already been covered with trees/roads. I think the only good way to solve this would be to let the AI cheat and know where all the port spaces are beforehand. So if an economy has no port yet, building anything else on port spaces (including roads) is blocked. If it is blocked by trees, build a lumberjack nearby. I have also started working on removing all those iterators (they irk me), but this is something for a separate branch. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> No more big branches, this is why I enjoyed these two (or three) small > branches I did lately (including this one and tha LUA resource think - though > this gone wild from one-line change). This has happened to me too and will keep happening - one day I will learn that there are no quick fixes. I sometimes find it frustrating at first as well, but when the branch is finished, I am happy, because the code is better. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I found it yet :) No more big branches, this is why I enjoyed these two (or three) small branches I did lately (including this one and tha LUA resource think - though this gone wild from one-line change). I have 2 fixes for AI in may mind (both military-related) but I will wait till this one is merged. Having too many branches and multitasking between them is another think that I dont like much :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I think you can maximize the fun by making smaller branches. They are faster to merge, clean and review. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I have, I like the 'productive' work, but all that overhead, cleaning the code and what I like the least is conflict resolution - I am never sure if I make it right - all right it will compile, but will the functionality be exactly preserved? It would take further tens of hours of testing to say... But generally I like it, I would not be 'here' otherwise. :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Say, Tibor, are you having fun working on Widelands? You seem unhappy in most of your comments about procedure, overhead or comments. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
So I implemented comments I saw there, merged trunk, resolved conflicts :( -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> //ref_cast const>(b).building().name().c_str()); > dynamic_cast((b).building().name().c_str())); > > commented out is before, the second one is what I want to use. Before it used > to compile, now it complains: > > defaultai.cc:3766:48: error: 'const class Widelands::Building' has no member > named 'building' > > Can you see any problem here? You are casting everything instead of just the construction site. Try this: dynamic_cast(b).building().name().c_str()); -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
This is mystery to me, see two lines: //ref_cast(b).building().name().c_str()); dynamic_cast((b).building().name().c_str())); commented out is before, the second one is what I want to use. Before it used to compile, now it complains: defaultai.cc:3766:48: error: 'const class Widelands::Building' has no member named 'building' Can you see any problem here? -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
> @GunChleoc - re observers - there is one point why vectors are suitable - they > are ordered and have a front member that can be moved to the back. This is > used when doing various kinds of check - like check one building every 10 > seconds. That's a valid point, so ignore my comment for that :) -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
correction: allships is a list, not a vector, as I believed, sorry -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
@GunChleoc - re observers - there is one point why vectors are suitable - they are ordered and have a front member that can be moved to the back. This is used when doing various kinds of check - like check one building every 10 seconds. Usually a player has couple of ships, but quite a lot of buildings, but most of all - a lot of roads and flags. These would be best candidates for optimization, but these also needs an order, because they are accessed similarly like buildings. So this is not that straightforward. BTW, I started to use unordered_set where suitable (as you probably noticed) - exactly for performance point of view. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Running clang-format is good :) Doesn't work on my system though :( -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
next time just put a comment into diff here whenever you see someting that needs fixing - it will be easier for me to get what you mean -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
@GunChleoc - yes, there was one error left unfixed in defaultai.cc - fixed cosmetic changes happened on files out of ai directory (like ship.cc) that I had not touched before. And were caused by clang-format. Next time somebody will work on them and run clang-format on them, there will be no cosmetic changes, of course. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
I will have to look at this in detail later, my brain's not working properly today. Codecheck still comes up with an error, could you please always run codecheck over the complete code base before submitting a merge request? This way, we won't have cosmetic changes in the diff in the future. I also saw that there are commented out lines of code in the diff, they should go before a merge. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
Also I run codecheck over couple of files that I had edited, therefore the diff shows quite a lot of cosmetic changes. -- https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/seafaring-ai into lp:widelands
TiborB has proposed merging lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/seafaring-ai/+merge/242271 Hi, after some time this is ready for review, read the branch info for more info. Tested a lot as AI-only games, I would welcome a human players tests and feedback. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/seafaring-ai into lp:widelands. === modified file 'src/ai/ai_help_structs.h' --- src/ai/ai_help_structs.h 2014-10-30 20:24:57 + +++ src/ai/ai_help_structs.h 2014-11-19 21:19:43 + @@ -32,6 +32,8 @@ #include "logic/player.h" #include "logic/world/terrain_description.h" #include "logic/world/world.h" +#include "logic/ship.h" +#include namespace Widelands { @@ -227,10 +229,10 @@ int16_t military_stationed_; // stationed (manned) military buildings nearby int16_t military_unstationed_; - // some buildings must be postponed bit - int32_t prohibited_till_; - // and then some must be forced - int32_t forced_after_; + bool is_portspace_; + // bool portspace_nearby_; // to prohibit buildings near a portspace Not needed? + bool port_nearby_; // to increase priority if a port is nearby, + // especially for new colonies std::vector consumers_nearby_; std::vector producers_nearby_; @@ -261,7 +263,9 @@ military_loneliness_(1000), military_in_constr_nearby_(0), military_presence_(0), - military_stationed_(0) { + military_stationed_(0), + is_portspace_(false), + port_nearby_(false) { } }; @@ -310,12 +314,14 @@ bool plants_trees_; bool recruitment_; // is "producing" workers? bool is_buildable_; - bool need_trees_; // lumberjack = true - bool need_stones_; // quarry = true - bool mines_water_; // wells - bool need_water_; // fisher, fish_breeder = true - bool is_hunter_; // need to identify hunters - bool is_fisher_; // need to identify fishers + bool need_trees_; // lumberjack = true + bool need_stones_; // quarry = true + bool mines_water_; // wells + bool need_water_; // fisher, fish_breeder = true + bool is_hunter_;// need to identify hunters + bool is_fisher_;// need to identify fishers + bool is_port_; + bool is_shipyard_; bool space_consumer_; // farm, vineyard... = true bool expansion_type_; // military building used that can be used to control area bool fighting_type_; // military building built near enemies @@ -327,7 +333,6 @@ int32_t mines_; // type of resource it mines_ uint16_t mines_percent_; // % of res it can mine - uint32_t current_stats_; std::vector inputs_; @@ -372,6 +377,25 @@ bool enemies_nearby_; }; +struct TrainingSiteObserver { + Widelands::TrainingSite* site; + BuildingObserver* bo; +}; + +struct WarehouseSiteObserver { + Widelands::Warehouse* site; + BuildingObserver* bo; +}; + +struct ShipObserver { + Widelands::Ship* ship; + Widelands::Coords expedition_start_point_; + std::unordered_set visited_spots_; + bool island_circ_direction = true; // a ship circumvents all island in the same direction + bool waiting_for_command_ = false; + int32_t last_command_time = 0; +}; + struct WareObserver { uint8_t producers_; uint8_t consumers_; === modified file 'src/ai/defaultai.cc' --- src/ai/defaultai.cc 2014-11-03 06:45:32 + +++ src/ai/defaultai.cc 2014-11-19 21:19:43 + @@ -6,7 +6,7 @@ * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful,n * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. @@ -31,7 +31,9 @@ #include "base/macros.h" #include "economy/economy.h" #include "economy/flag.h" +#include "economy/portdock.h" #include "economy/road.h" +#include "economy/wares_queue.h" #include "logic/constructionsite.h" #include "logic/findbob.h" #include "logic/findimmovable.h" @@ -39,15 +41,19 @@ #include "logic/map.h" #include "logic/militarysite.h" #include "logic/player.h" +#include "logic/playercommand.h" #include "logic/productionsite.h" +#include "logic/ship.h" #include "logic/trainingsite.h" #include "logic/tribe.h" #include "logic/warehouse.h" #include "logic/world/world.h" #include "profile/profile.h" + // Building of new military buildings can be restricted constexpr int kPushExpansion = 1; + constexpr int kResourcesOrDefense = 2; constexpr int kDefenseOnly = 3; constexpr int kNoNewMilitary = 4; @@ -59,6 +65,10 @@ // building of the same building can be started after 25s at earliest constexpr int kBuildingMinInter