Latest Posts

Topic: AI patch suggestion

einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2014-04-29, 09:08

I have one question: are the changes merged to the main code? With which bzr version? I would like to test old and new AI and don't know how... face-smile.png (I hope it is not a stupid question)


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

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2014-04-29, 10:24

You will have to get and compile Tibor's branch, because it will only be merged when it's done:

bzr branch lp:~tiborb95/widelands/tiborb-ai

Busy indexing nil values

Top Quote
PkK

Joined: 2012-01-06, 11:19
Posts: 236
Ranking
Widelands-Forum-Junkie
Posted at: 2014-04-29, 15:59

Would your AI modificatons prevent the vineyard building rage (an empire AI building putting all its efort into building vineyards after a few hours)? See also https://wl.widelands.org/forum/topic/1484/

Philipp


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-04-29, 17:31

Hi all, I will upload my latest changes to launchpad tonight so everybody will be able to test it.

PkK: I tested it only with barbarians face-smile.png


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-04-29, 21:20

revision 6962 just uploaded.

Few comments:
AI is very sensitive and complex group of equations and tests and tresholds and so on. One change can fix something but make something else unbalanced. SO - this works somehow, technically it is very aggressive AI, building very strong economy and is expanding slowly. So it work better in restricted rooms. Big free plains are problem (so far). This is something that must be enhanced. My intend is to have some soft treshold, f.e. when player has 100 production buildings, building new production buildings will be slowed down. Of course the threshold (100) should depend on map size or so. This is my intend. It needs testing.

Anyway, feedback is welcomed

Installation:

bzr branch lp:~tiborb95/widelands/tiborb-ai


and further step should be the same as when compiling trunk.
Top Quote
einstein13
Avatar
Joined: 2013-07-28, 23:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2014-04-29, 22:42

Ok,

maybe I'am to stupid with my Ubuntu, but I can't compile it.

Using the page: https://wl.widelands.org/wiki/BuildingWidelands/#the_fastest_way_to_build_widelands_terminal_use and your clues.

After downloading and moving to the folder ~/tibor-ai/ trying to compile it by ./compile.sh

Then the error accured:

CMake Error at CMakeLists.txt:81 (message): Build-directory and source-directory are the same!

How can I solve the problem? Sorry, but I really don't like Linux systems face-tongue.png I don't understand them face-sad.png


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

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-04-30, 05:15

Hi,

I hope I will not confuse you even more, but I am using slightly modified installation procedure, and using this script:

#!/bin/bash

SOURCE_DIR=/var/widelands/BZR/tiborb-ai/
INST_DIR=/var/widelands/installed2904/

cd $SOURCE_DIR || exit 3

mkdir -p build/compile && cd build/compile
     
cmake ../.. -DCMAKE_BUILD_TYPE=Debug \
            -DCMAKE_INSTALL_PREFIX=$INST_DIR  \
            -DWL_INSTALL_PREFIX=$INST_DIR \
            -DWL_INSTALL_DATADIR=share/widelands \
            -DWL_INSTALL_BINDIR=bin || exit 4

echo "cmake done 1/2 ($SECONDS sec)"

make || exit 1
echo  "Installing [make install] ($SECONDS sec)"
rm -rf ${INST_DIR}* || mkdir $INST_DIR
make install
echo "make install done 2/2 ($SECONDS sec)"


you just need to edit first two variables (directories) and once installed - you must get last line on console if succesfull, run widelands with /var/widelands/installed2904/bin/widelands (as example).

The script can be put anywhere, as it is doing 'cd'
Top Quote
SirVer

Joined: 2009-02-19, 14:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2014-04-30, 06:15

For profiling I recommend looking into http://goog-perftools.sourceforge.net/doc/cpu_profiler.html which is pretty useful and will give you more information about what you actually want (time spent in functions vs number of CPU cycles spend in functions). If you want to profile with valgrind, you have to use its callgrind tool. A tutorial that I always reference is this: http://matt.eifelle.com/2009/04/07/profiling-with-valgrind/


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-04-30, 19:39

SirVer wrote:

For profiling I recommend .....

Thanks, I haven't a time to test it but I will do in short time I believe...


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-04-30, 19:45

PkK wrote:

Would your AI modificatons prevent the vineyard building rage (an empire AI building putting all its efort into building vineyards after a few hours)? See also https://wl.widelands.org/forum/topic/1484/

Philipp

I am far from being finished or satisfied with my modifications to AI, and I have not looked at this problem closer yet.

But it would be trivial to code a crude solution like limiting count of the same buildings (f.e. 50 buildings of the type), or limiting proportion of buildings of the same type to all buildings, for example 'no new building of type x if count_of_x>count_of_all_buildings * 0.3'


Top Quote