Latest Posts

Topic: the boat transport still needs working on

Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2015-07-22, 18:14

New branch? Go to some directory, get source and branche it

bzr branch lp:widelands/trunk
bzr branch trunk feature-xxx


then you can 'cd feature-xxx' and compile as ussual

I think no partner for play is needed. Even you yourself dont need to play - I believe. I usually have a lot of printf in code, and am watching the screen and comparing what is in terminal and what in game...

most c files are in src/economy/ and src/logic/ folders, names are quite explanatory

You can start with src/economy/router.cc

/**
 * Calculate a route between two nodes.
 *
 * The calculated route is stored in route if it exists.


there is logic (part of it) that generates path between two nodes (flags usualy)

also look at src/economy/economy.cc:

/**
 * Find the supply that is best suited to fulfill the given request.
 * \return 0 if no supply is found, the best supply otherwise
*/
Supply * Economy::_find_best_supply
	(Game & game, const Request & req, int32_t & cost)


This function gets request for ware and iterates over all avaible wares and calculated paths and picks the best one (if any).

Just ask if you have further questions





Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2015-07-22, 18:21

today I found a place in code that under some circumstances sends a ship to the same port - ignoring the ship scheduler - and this seem to be the culprit of misbehaviour as reported above... - I understand why it is there (for safety reasons) and also understand that on small maps it is no big issue... I will try to fix it... in proper way face-smile.png


Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2015-07-23, 19:23

Please test who is interested...



I improved also port debug window - now you can see if port is waiting for ship (there are some wares and workers waiting for transport), info about fleet and m_act_pending means that scheduler (it manages entire fleet) is scheduled to run in short time.

If port is waiting for ship but m_act_pending=false - then there is probably some inconsistency. Or from broader perspective, if any of ports is waiting for ship and m_act_pending=false - there is a problem. (m_act_pending is variable of fleet, not port)

EDIT:

also 'port needs ship' must correspond to 'wares and workers waiting'

EDIT2:

another exemption: m_act_pending can be 'false' and port still requesting a ship, because ship is just on the way to the port.... bit complicated, but it is complicated :)

Edited: 2015-07-23, 22:25

Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-07-23, 21:35

Tibor wrote:

Please test who is interested...

Great work, Tibor!

What exact changed have you managed to do? What is current behaviour of ships? For sure I will have some time this weekend and I will test it to see currently solved problems!


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2015-07-23, 22:17

Well, now it should be obvious when a ship moves - why it goes there where it goes. It is not 100%, because especially if two ships are idle at the same time, they can go to the same port requesting a ship, but it is not frequent.

Also please look at some serious problems, like seafaring completely stuck and so on.

Also run it from terminal, just to see any logs or crash reports.... might be usefull....


Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-07-24, 00:12

While compiling everything crashed:

[71/430] Linking CXX executable src/scripting/test/test_scripting
src/third_party/libthird_party_eris.a(loslib.c.o): In function `os_tmpname':
/home/widelands/Widelands/Test04-ship_sheduling/ship_scheduling/build/../src/third_party/eris/loslib.c:108: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
[72/430] Building CXX object src/wui/CMakeFiles/wui.dir/building_ui.cc.o
FAILED: /usr/bin/c++    -g -I../src -Isrc -isystem /usr/include/SDL2 -isystem /usr/include/GL     -std=c++11 -fext-numeric-literals  -g -DDEBUG -Wall -Wpedantic -Wdeprecated-declarations -Wextra -Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs -Wno-undef -Wold-style-cast -Woverlength-strings -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-promo -Wswitch-default -Wsync-nand -Wtrampolines -Wundef -Wunused -Wunused-macros -Werror=uninitialized -Werror=return-type -MMD -MT src/wui/CMakeFiles/wui.dir/building_ui.cc.o -MF "src/wui/CMakeFiles/wui.dir/building_ui.cc.o.d" -o src/wui/CMakeFiles/wui.dir/building_ui.cc.o -c ../src/wui/building_ui.cc
virtual memory exhausted: Cannot allocate memory
[72/430] Building CXX object src/wui/CMakeFiles/wui.dir/buildingwindow.cc.o
FAILED: /usr/bin/c++    -g -I../src -Isrc -isystem /usr/include/SDL2 -isystem /usr/include/GL     -std=c++11 -fext-numeric-literals  -g -DDEBUG -Wall -Wpedantic -Wdeprecated-declarations -Wextra -Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs -Wno-undef -Wold-style-cast -Woverlength-strings -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-promo -Wswitch-default -Wsync-nand -Wtrampolines -Wundef -Wunused -Wunused-macros -Werror=uninitialized -Werror=return-type -MMD -MT src/wui/CMakeFiles/wui.dir/buildingwindow.cc.o -MF "src/wui/CMakeFiles/wui.dir/buildingwindow.cc.o.d" -o src/wui/CMakeFiles/wui.dir/buildingwindow.cc.o -c ../src/wui/buildingwindow.cc
virtual memory exhausted: Cannot allocate memory
[72/430] Building CXX object src/wui/CMakeFiles/wui.dir/actionconfirm.cc.o
FAILED: /usr/bin/c++    -g -I../src -Isrc -isystem /usr/include/SDL2 -isystem /usr/include/GL     -std=c++11 -fext-numeric-literals  -g -DDEBUG -Wall -Wpedantic -Wdeprecated-declarations -Wextra -Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k -Winit-self -Winvalid-pch -Wlogical-op -Wmissing-include-dirs -Wno-undef -Wold-style-cast -Woverlength-strings -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-promo -Wswitch-default -Wsync-nand -Wtrampolines -Wundef -Wunused -Wunused-macros -Werror=uninitialized -Werror=return-type -MMD -MT src/wui/CMakeFiles/wui.dir/actionconfirm.cc.o -MF "src/wui/CMakeFiles/wui.dir/actionconfirm.cc.o.d" -o src/wui/CMakeFiles/wui.dir/actionconfirm.cc.o -c ../src/wui/actionconfirm.cc
virtual memory exhausted: Cannot allocate memory
ninja: build stopped: subcommand failed.

And really don't know why. I have 2 GB declared as available for Linux virtual machine.

Has something changed with needed packages? (between now and about 2 months ago: bzr7467)

Also there were several warinings like:

  • Use log() from base/log.h instead of printf.
  • Line is too long! Keep it < 110 chars (with tab width of 3)
  • A space is mandatory after ','.
  • Trailing whitespace at end of line

In files: fleet, portdock, battle, warehouse

Edited: 2015-07-24, 00:15

einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
Tibor

Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2015-07-24, 05:36

einstein13 wrote:

While compiling everything crashed:

virtual memory exhausted: Cannot allocate memory
ninja: build stopped: subcommand failed.

And really don't know why. I have 2 GB declared as available for Linux virtual machine.

Has something changed with needed packages? (between now and about 2 months ago: bzr7467)

Has your virtual machine changed? GB or RAM or number of CPU cores? 2GB is enough for 1 thread compilation. If ninja used more, that could easily lead to memory exhaustion. So you can

  • add RAM
  • uninstall ninja, to force cmake that compiles in 1 thread

I would say your ram should be 1.5GB*(CPU_cores+1) at least, if you want to use ninja

Also there were several warinings like:

  • Use log() from base/log.h instead of printf.
  • Line is too long! Keep it < 110 chars (with tab width of 3)
  • A space is mandatory after ','.
  • Trailing whitespace at end of line

In files: fleet, portdock, battle, warehouse

just codecheck warnings - it is work in progress, I will polish the code style before proposing for merge


Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-07-24, 09:16

thanks. So I switched from 2 to 1 processor, plus 2 to 4 GB of RAM. Now it is working.

If you know about the warnings- it is OK for me face-smile.png


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-07-24, 13:59

First problem spotted: ships don't have any debug window. (almost) No infrmation what they are doing.


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-07-24, 15:19

After few hours of AI-testing on your map (last map) I've noticed few issues:

  1. MAP: Red position has no iron (or hardly any, because whole economy stopped after few hours)
  2. SOLDIERS: They should be trained to high state, but they don't. I don't know if your branch is already merged, if so- something really bad happened.
  3. SHIPS: they don't have debug message
  4. SHIPS AI: computer doesn't produce much ships. They are expensive, but if you have 6 ports, 5 ships are not enough.

I can't test good behavior of your branch on this map, because it is too big and I can't see if ships are going right way (can't see 5 ships on such a large map). So I will test different map.


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote