Author Topic: Scientific interface for MegaGlest?  (Read 6227 times)

mikepreuss

  • Guest
Scientific interface for MegaGlest?
« on: 13 March 2012, 15:59:54 »
Dear guys,

some years ago, a group of students of TU Dortmund in Germany
was carrying out a project with Glest, trying to improve the AI in
various ways (see here: http://www.ciingames.de/ ).

After that, Simon Wessing and me tried to scientifically investigate
a reactive unit building scheme, but didn't really succeed because it
was impossible to stop the AI from steadily changing the build order
stack according to some weird rules. The whole code was not very
well structured, and no proper game loop and no proper data
structures existed, so that after weeks of trying to just make it
build what we wanted it to build, we gave up (but we continued
to scientifically work in games, see here for our recent stuff:
http://ls11-www.cs.tu-dortmund.de/rudolph/cig ).

We are very pleased to see that Glest is much more developed now,
and ask ourselves if it would be possible to use MegaGlest for the
kind of (automated) experiments that failed in 2009. Any advice is
appreciated...    We have also compiled some more specific questions
and suggestions, please don't hesitate to give us your opinion:

Has the AI structure been improved so that such 'mods' would
be possible? And I'd also be interested in knowing how you did
the balancing between the 7? races. Very interesting, I don't know
any other example of so many, balancing must be a hell. We would
also like to investigate that, but would need some interfaces:

a) I presume you read the unit properties from some file, e.g. XML,
this is needed to try out other values automatically.

b) We would need the possibility to automatically start a game with
a specific setting in some kind of batch mode (via command line?),
and there shall be some result file we can read so that we know who
won.

Is that possible already or would it be possible to create such an
interface without great hassle?

Cheers, Mike


softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #1 on: 13 March 2012, 16:09:34 »
We have improved the AI a little bit, but most of the code is similar to regular Glest, just a few optimizations in AI behaviour and pathfinding. Both still could use a lot of improvement, our focus has mainly been adding more network features and stability. If you are truly serious to work with megaglest we are definitely able to help you, as we surely could use help from anyone who is willing.

All unit data, upgrades, skills etc are all read from XML files. There is some old code from original glest which seems like it was intended for automated testing, with the possibility to log some results to log files. Regardless, we are willing to help as we have time to add interfaces where required to help you if you are willing to spend some time working with us.

P.S. Megaglest will be in the software repos in the next Ubuntu and Debian (replacing Glest). Our build system works on many platforms, please read our wiki for more details:

https://docs.megaglest.org/MegaGlest

Thanks
« Last Edit: 18 June 2016, 18:46:52 by filux »

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #2 on: 13 March 2012, 17:29:56 »
Of course we (at least me) are willing to spend some time on working with you and MegaGlest. But we can't really do very much until we have the possibility to auto-start games from the command line and read some result parameters from a file. E.g, it shall contain information about who was the winner, and how many points each faction achieved. If a properties-file style is used, this is especially easy to read (as e.g. "winner=1 \n points.1=527 \n points.2=630 " etc, these are just examples, I have to admit that I don't remember realistic levels). Are there any points at all? But you get the meaning: we need some indicator for the predominance of the winner: was it tight or clear? Last standings in resources may also be interesting. You may know better than me what kind of values are available, we can adapt to this. Ah, and game time would also be nice. We could also measure it from the outside but you'll have a pointer anyway (can also be in cycles or whatever, just for relative comparison).

Do you think you could provide us with a very basic interface (including command line options for specifying a map and the faction setup)? Everything else could then be developed from this. And what do you think, how long would this take?

Mike

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #3 on: 13 March 2012, 17:39:29 »
I'll get you more details soon, but to start:

Code: [Select]
./megaglest --help
will show the loads of options you have :)

Code: [Select]
./megaglest --autostart-lastgame
To start a new game using the game settings stored in ~/.megaglest/lastCustomGamSettings.mgg
Each game that file gets over-written with the selected game settings selected by the user just before he starts.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Scientific interface for MegaGlest?
« Reply #4 on: 14 March 2012, 01:35:38 »
« Last Edit: 18 June 2016, 18:46:01 by filux »
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #5 on: 14 March 2012, 09:55:17 »
Ah, nice, thanks! The option "--preview-map=x" does not load a map, does it? But we could change the map file itself I guess (by renaming). Does the game also stop when it would usually pop up the "exit game" dialog (played a bit yesterday, very nice)? That would be absolutely necessary, we can't start/stop everything manually. And then there shall be a result file with the informations on the end game screen, that would be great (could also be XML or any table format, as csv).

Mike

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Scientific interface for MegaGlest?
« Reply #6 on: 14 March 2012, 14:47:27 »
Hi Mike,

I'll try to provide an overview of what's already possible with v3.6.0.3, and how.

a) I presume you read the unit properties from some file, e.g. XML, this is needed to try out other values automatically.

I'll start with a simplified overview of how the game data is structured.

MegaGlest game data can be one of:
  • techtrees
  • maps
  • tilesets
  • scenarios
A techtree contains (amongst other) one or more factions. A faction contains (amongst other) one or more units.

The default game data (the Megapack techtree mostly) is installed directly into the installation directory, giving you this directory structure:

Code: [Select]
tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first
blender/           core                    megaglest.ico
data/              editor.ico              megaglest_uninstall.ico
docs/              g3dviewer.ico           servers.ini
lib/               glest.ini               start_megaglest
maps/              glestkeys.ini           start_megaglest_configurator
scenarios/         megaglest               start_megaglest_g3dviewer
techs/             megaglest.bmp           start_megaglest_mapeditor
tilesets/          megaglest_configurator  uninstall-megaglest.sh
tutorials/         megaglest_editor
configuration.xml  megaglest_g3dviewer

tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first techs/
megapack/

tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first techs/megapack/
commondata/  factions/  resources/  megapack.xml

tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first techs/megapack/factions/
egypt/  indian/  magic/  norsemen/  persian/  romans/  tech/

tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first techs/megapack/factions/egypt/
music/  units/  upgrades/  egypt.xml  loading_screen.jpg

tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first techs/megapack/factions/egypt/units/
air_pyramid/     desert_camp/  mummy/    pyramid/  snake/         sphinx/
anubis_warrior/  farm/         obelisk/  scarab/   spearman/      temple/
chicken/         ibis/         priest/   slave/    spearthrower/

tomreyn@atibox:~/megaglest-3.6.0.3$ ls -p --group-directories-first techs/megapack/factions/egypt/units/mummy/
images/  models/  sounds/  mummy.xml

As the file name indicates, mummy.xml is a plain text file with an XML structure:
Code: [Select]
tomreyn@atibox:~/megaglest-3.6.0.3$ cat techs/megapack/factions/egypt/units/mummy/mummy.xml
<?xml version="1.0" standalone="no"?>

<unit>
    <parameters>
        <size value="1"/>
        <height value="2"/>
        <max-hp value="600" regeneration="0"/>
        <max-ep value="0"/>
        <armor value="10"/>   
        <armor-type value="organic"/>
        <sight value="12"/>
        <time value="25"/>   
        <multi-selection value="true"/>   
        <cellmap value="false"/>
        <levels/>
        <fields>
            <field value="land"/>
        </fields>   
        <properties/>
            <light enabled="false"/>
        <unit-requirements/>
        <upgrade-requirements/>
        <resource-requirements>
            <resource name="gold" amount="45"/>
            <resource name="food" amount="1"/>               
        </resource-requirements>
        <resources-stored/>
        <image path="images/daemon.bmp"/>
        <image-cancel path="../spearman/images/tech_cancel.bmp"/>
        <meeting-point value="false"/>
        <selection-sounds enabled="true">
            <sound path="sounds/mummy_select1.wav"/>
            <sound path="sounds/mummy_select2.wav"/>
            <sound path="sounds/mummy_select3.wav"/>
            <sound path="sounds/mummy_select4.wav"/>
            <sound path="sounds/mummy_select5.wav"/>
            <sound path="sounds/mummy_select6.wav"/>
            <sound path="sounds/mummy_select7.wav"/>
        </selection-sounds>
        <command-sounds enabled="true">
            <sound path="sounds/mummy_ack1.wav"/>
            <sound path="sounds/mummy_ack2.wav"/>
            <sound path="sounds/mummy_ack3.wav"/>
            <sound path="sounds/mummy_ack4.wav"/>
            <sound path="sounds/mummy_ack5.wav"/>
        </command-sounds>

    </parameters>

    <skills>
   
        <skill>
            <type value="stop"/>
            <name value="stop_skill"/>       
            <ep-cost value="0"/>
            <speed value="1000"/>
            <anim-speed value="40"/>
            <animation path="models/mummy_standing.g3d"/>
            <sound enabled="false"/>
        </skill>
       
        <skill>
            <type value="move"/>
            <name value="move_skill"/>       
            <ep-cost value="0"/>
            <speed value="250"/>
            <anim-speed value="120"/>
            <animation path="models/mummy_walking.g3d"/>
            <sound enabled="false"/>
        </skill>

        <skill>
            <type value="attack"/>
            <name value="attack_skill"/>       
            <ep-cost value="0"/>
            <speed value="100"/>
            <anim-speed value="100"/>
            <animation path="models/mummy_attacking.g3d"/>
            <sound enabled="true" start-time="0.0">
                <sound-file path="sounds/mummy_attack11.wav"/>
                <sound-file path="sounds/mummy_attack12.wav"/>
                <sound-file path="sounds/mummy_attack13.wav"/>
                <sound-file path="sounds/mummy_attack14.wav"/>
                <sound-file path="sounds/mummy_attack10.wav"/>
                <!--sound-file path="sounds/mummy_attack1.wav"/>
                <sound-file path="sounds/mummy_attack2.wav"/>
                <sound-file path="sounds/mummy_attack3.wav"/>
                <sound-file path="sounds/mummy_attack4.wav"/>
                <sound-file path="sounds/mummy_attack5.wav"/>
                <sound-file path="sounds/mummy_attack6.wav"/>
                <sound-file path="sounds/mummy_attack7.wav"/>
                <sound-file path="sounds/mummy_attack8.wav"/>   
                <sound-file path="sounds/mummy_attack9.wav"/-->   
            </sound>
            <attack-strenght value="70"/>
            <attack-var value="40"/>
            <attack-range value="1"/>
            <attack-type value="slashing"/>
            <attack-fields>
                <field value="land"/>
            </attack-fields>
            <attack-start-time value="0.3"/>
            <projectile value="false"/>
            <splash value="false"/>
        </skill>
   
        <skill>
            <type value="die"/>
            <name value="die_skill"/>       
            <ep-cost value="0"/>
            <speed value="120"/>
            <anim-speed value="20"/>
            <animation path="models/mummy_dying.g3d"/>
            <sound enabled="true" start-time="0">
                <sound-file path="sounds/mummy_die1.wav"/>
                <sound-file path="sounds/mummy_die2.wav"/>
                <sound-file path="sounds/mummy_die3.wav"/>
                <sound-file path="sounds/mummy_die4.wav"/>
            </sound>           
            <fade value="false"/>
        </skill>
    </skills>
   
    <commands>
       
        <command>
            <type value="stop"/>
            <name value="stop"/>
            <image path="../spearman/images/tech_stop.bmp"/>
            <unit-requirements/>
            <upgrade-requirements/>
            <stop-skill value="stop_skill"/>
        </command>

        <command>
            <type value="move"/>
            <name value="move"/>
            <image path="../spearman/images/tech_move.bmp"/>
            <unit-requirements/>
            <upgrade-requirements/>
            <move-skill value="move_skill"/>
        </command>

        <command>
            <type value="attack"/>
            <name value="attack"/>
            <image path="images/mummy_attack.bmp"/>
            <unit-requirements/>
            <upgrade-requirements/>
            <move-skill value="move_skill"/>
            <attack-skill value="attack_skill"/>
        </command>

    </commands>
</unit>

Obviously you could edit these values by scripting, or you could create additional tech trees / factions in a test techtree which use modified values. Generally you should not modify the default game data (installed in the games' installation directory), but you can store additional (custom) data where the INI directive UserData_Root points to. On Linux, this is usually ~/.megaglest/, where you have the same directory structure as within the main installation directory, i.e. there is a techs subdirectory there. The game creates checksums on custom data and caches it, so if you modify it then you should (possibly, to be sure, delete the cache, located at UserData_Root/cache/ and) restart the game to have it recalculate the checksums.

To deduplicate data, file references in XML files may point to other existing techtrees (assuming you know their name and the names of factions/units they contain). This allows you, for example, to have a megapack2 techtree which is an exact clone of the existing megapack techtree but only changes the properties (XML files) of one faction and one unit inside of it, which can considerably cut down on disk space (and time involved in copying stuff around).

So if you want to run tests with ten variations of the 'mummy' unit, I can think of two ways to achieve it:
  • Create deduplicated clones of the Megapack techtree, modifying files as needed, and place these in UserData_Root/; then run your tests referencing a different one of these techtrees in every pass
  • Create a single deduplicated (or not) clone of the Megapack techtree and place it in UserData_Root/; then run your tests referencing always this one cloned techtree in every pass, but using scripting (sed -i) and/or file system properties (symlinks) to apply changes to the game data as needed
On a side note, scenarios may also be of interest to you, as they allow for some LUA scripting.

b) We would need the possibility to automatically start a game with a specific setting in some kind of batch mode (via command line?), and there shall be some result file we can read so that we know who won.

Basically Softcoder already answered the first part of this question by pointing out that there is a mechanism (--autostart-lastgame) which allows you to start a game using the last games' settings which are stored in UserData_Root/lastCustomGamSettings.mgg. This file is a plain text file, looking something like this:
Code: [Select]
Description=8-players-only-1-will-win
MapFilterIndex=8
Map=8-players-only-1-will-win
Tileset=evergreen
TechTree=megapack
DefaultUnits=1
DefaultResources=1
DefaultVictoryConditions=1
FogOfWar=1
AdvancedIndex=0
AllowObservers=1
FlagTypes1=2
EnableObserverModeAtEndGame=1
AiAcceptSwitchTeamPercentChance=30
PathFinderType=0
EnableServerControlledAI=1
NetworkFramePeriod=20
NetworkPauseGameForLaggedClients=1
FactionThisFactionIndex=0
FactionCount=8
FactionControlForIndex0=7
ResourceMultiplierIndex0=5
FactionTeamForIndex0=0
FactionStartLocationForIndex0=0
FactionTypeNameForIndex0=*Random*
FactionPlayerNameForIndex0=tomreyn
FactionControlForIndex1=3
ResourceMultiplierIndex1=10
FactionTeamForIndex1=1
FactionStartLocationForIndex1=1
FactionTypeNameForIndex1=indian
FactionPlayerNameForIndex1=AI1
FactionControlForIndex2=1
ResourceMultiplierIndex2=0
FactionTeamForIndex2=2
FactionStartLocationForIndex2=2
FactionTypeNameForIndex2=magic
FactionPlayerNameForIndex2=AI2
FactionControlForIndex3=1
ResourceMultiplierIndex3=0
FactionTeamForIndex3=3
FactionStartLocationForIndex3=3
FactionTypeNameForIndex3=norsemen
FactionPlayerNameForIndex3=AI3
FactionControlForIndex4=5
ResourceMultiplierIndex4=5
FactionTeamForIndex4=6
FactionStartLocationForIndex4=4
FactionTypeNameForIndex4=persian
FactionPlayerNameForIndex4=???
FactionControlForIndex5=1
ResourceMultiplierIndex5=0
FactionTeamForIndex5=5
FactionStartLocationForIndex5=5
FactionTypeNameForIndex5=romans
FactionPlayerNameForIndex5=AI4
FactionControlForIndex6=1
ResourceMultiplierIndex6=0
FactionTeamForIndex6=6
FactionStartLocationForIndex6=6
FactionTypeNameForIndex6=tech
FactionPlayerNameForIndex6=AI5
FactionControlForIndex7=1
ResourceMultiplierIndex7=0
FactionTeamForIndex7=7
FactionStartLocationForIndex7=7
FactionTypeNameForIndex7=*Random*
FactionPlayerNameForIndex7=AI6

MegaGlest also supports a headless game(server) mode which stores these settings in UserData_Root/lastHeadlessGamSettings.mgg instead. It comes with additional options which may be of use for your work: If you start a headless gameserver by invoking the game with --headless-server-mode=vps,exit it will automatically exit (the process exiting) after the last connected client disconnects, writing out game statistics to standard output:
Code: [Select]
tomreyn@atibox:~/megaglest-3.6.0.3$ ./megaglest --headless-server-mode=vps,exit
Disabled reading from console [vps]
Forcing quit after game has completed [exit]
megaglest v3.6.0.3
Compiled using: GNUC: 40401 [64bit] on: Jan 24 2012 13:33:42
SVN: [Rev: 3080] - using STREFLOP
Waiting for players to join and start a game...
Headless server is now running...
Starting a new game...
New game has started...
Game ending with stats:
-----------------------
Description: Conflict
Faction count: 2
Game duration (mins): 1
Max Concurrent Units: 27
Total EndGame Concurrent Unit Count: 27
player #0 AI1 (CPU (Easy) x 0.5) faction: Egypt Team: 0 victory: 0 # kills: 5 # enemy kills: 4 # deaths: 1
# units produced: 3 # resources harvested: 12
player #1 tomreyn (Network) faction: Indian Team: 1 victory: 1 # kills: 0 # enemy kills: 0 # deaths: 4
# units produced: 3 # resources harvested: 325
-----------------------

Headless server is about to quit...
tomreyn@atibox:~/megaglest-3.6.0.3$

However, it is not currently possible to combine --headless-server-mode=vps,exit and --autostart-lastgame so that, so far, you still need to manually connect a client to the server, make it load the last games' settings, make it start the game, and make it quit the game, all of which currently requires user interaction. You can also not achieve this in single player (non-headless) mode, since then, while you can automatically start the game, you cannot make the process exit automatically, nor will game statistics be written to standard output. And then, having graphic output is probably undesirable since it might impact (falsify) your test results.

So more work would be needed in this area, but much is already possibl, surely more than in Glest 2.0. ;-)

atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #7 on: 15 March 2012, 12:53:12 »
Hi guys,

thanks for all the information. You're right, the interface has developed a lot since the old Glest days. However, we can't really do much without automated start and stop, of which, as far as I understand, we can have either one or the other, but not both. To give you some more background: what we would like to do first (as a start, let's say), is to use the game as some sort of simulator (black box) that runs games under the parameters we set up. Then we wrap around some optimization procedure that automatically calls the game. We are speaking of let's say 1000 or more evaluations (games), where this number is rather low now and it may be necessary to increase it as we have stochastic (random) effects in the game.

What we can optimize first is e.g. the balancing of units (first for two factions only, but doing several at once would be scientifically challenging and interesting) by supplying different values for the unit properties. We would need to write some code dealing with reading and writing the MegaGlest configuration XML files and the result text files. As far as I understand, what we would need from you is the possibility to stop the process (and not return to the main menu) if the game is exited due to victory, e.g. controlled with a command line flag (is a draw possible? we would need a solution for that, otherwise we wait forever and the whole optimization stalls), and to write out the result table you plot onto the end screen as text file. That's all. I don't know the internal organization of your project too well, but I guess this is doable. Sorry if I sound too demanding, just want to make clear that we cannot do anything with a loop we cannot close... But it is perfectly OK if you say this takes so and so long or you don't want to do it at all, I'd just like to know.

Mike

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #8 on: 15 March 2012, 14:26:21 »
All of what you are asking for is going to be very easy to do. 90% of things are already automated and the code to automate games was already in place in original Glest. We have added many ways to control the game behaviour and recently we have added the ability to 'save games' to XML file which gives you nearly all game state information at any moment (including stats like who is winning etc).

I will work on adding and refining the items you have asked for and will let you know when its ready.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #9 on: 17 March 2012, 08:27:45 »
Ok if you compile using the code in svn, I've now got some things for you to try.

Code: [Select]
--auto-text=x,y,z  Run in auto test mode.
                             Where x is an optional maximum # seconds to play.
                             If x is not specified the default is 1200 seconds (20 minutes).
                             Where y is an optional game settings file to play.
                             If y is not specified (or is empty) then auto test cycles through playing scenarios.
                             Where z is the word exit indicating the game should exit after the game is finished or the time runs out.
                             If z is not specified (or is empty) then auto test continues to cycle.

For example, to load a game settings file (which should be setup with only AI players) and limit the game to 60 seconds and exit the application while saving the contents of the game state to a file in ~/.megaglest/saved/megaglest-auto-saved_yyyymmdd_hhmmss.xml

Code: [Select]
megaglest/trunk/build$ ../mk/linux/megaglest --auto-test=60,../mk/linux/mydata/lastCustomGamSettings.mgg,exit
To have it play random lua scenarios continuously (and save each game after the max time has elapsed of 5 minutes) without exiting the application (But instead cycling through scenarios):

Code: [Select]
megaglest/trunk/build$ ../mk/linux/megaglest --auto-test=300
*Updated:

I added the ability to enable AI behaviour logging. Add this to glestuser.ini:

Code: [Select]
AiLog=10
And each AI player will have a logfile created called aiX.log where X is the ai player number. This logfile contains a lot of info about what the AI player is trying to do.

P.S. I just added some more smart handling of resource decisions for the AI in svn.
« Last Edit: 17 March 2012, 19:24:42 by softcoder »

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #10 on: 17 March 2012, 14:56:08 »
Wow, that sounds good. Are you working on Windows or Linux? I'd prefer Windows as we have several Windows machines available. Would it be feasible if you put a windows executable somewhere? Sorry for the hassle, but I remember that it took ages to set up Glest for compiling everything allright some years ago (maybe this has improved?) and I doubt I have all tools installed I would need (we would do the wrapping stuff and optimization software in Java and/or Python).

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #11 on: 17 March 2012, 16:18:16 »
If you are serious about helping i would suggest it is critical for you to learn how to compile megaglest. It compiles on Windows, Linux Mac and other platforms.

It is EXTREMELY easy to compile megaglest, we have batch files that do most of the work once you have the compiler and window dll's dependency archive in place, all are documented here:

Code: [Select]
https://docs.megaglest.org/MG/Development
If you require any help feel free to ask. I do wonder how you would be able to contribute AI help to megaglest without compiling the source :)

« Last Edit: 18 June 2016, 18:44:15 by filux »

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Scientific interface for MegaGlest?
« Reply #12 on: 17 March 2012, 22:32:00 »
Actually I did just build on Windows and wanted to make this available anyways. However, this build is before Softcoder added the new options for your research, so you'll want to build yourself nevertheless. And hey, even I can do it, so it's really easy. ;-)
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #13 on: 17 March 2012, 23:39:46 »
Yes, I'll try, don't worry. Just some years ago, it was really difficult to get it built. But I guess this changed now.

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #14 on: 21 March 2012, 14:02:24 »
Hi again,

you're right, compiling is dead easy. So I have a local version now with the new auto-test features. So far, this runs well, many thanks! However, I did not manage to start a game without human AI, for some reason player 1 is always overwritten with the values from the Glest/Start Game menue (but map and the other values are taken). Here is the test.mgg file I used:

Code: [Select]
Description=eight_gradient
MapFilterIndex=8
Map=eight_gradient
Tileset=evergreen
TechTree=megapack
DefaultUnits=1
DefaultResources=1
DefaultVictoryConditions=1
FogOfWar=1
AdvancedIndex=0
AllowObservers=1
FlagTypes1=2
EnableObserverModeAtEndGame=1
AiAcceptSwitchTeamPercentChance=0
PathFinderType=0
EnableServerControlledAI=1
NetworkFramePeriod=20
NetworkPauseGameForLaggedClients=1
FactionThisFactionIndex=0
FactionCount=8
FactionControlForIndex0=3
ResourceMultiplierIndex0=0
FactionTeamForIndex0=0
FactionStartLocationForIndex0=0
FactionTypeNameForIndex0=tech
FactionPlayerNameForIndex0=AI0
FactionControlForIndex1=3
ResourceMultiplierIndex1=0
FactionTeamForIndex1=1
FactionStartLocationForIndex1=1
FactionTypeNameForIndex1=indian
FactionPlayerNameForIndex1=AI1
FactionControlForIndex2=3
ResourceMultiplierIndex2=0
FactionTeamForIndex2=2
FactionStartLocationForIndex2=2
FactionTypeNameForIndex2=magic
FactionPlayerNameForIndex2=AI2
FactionControlForIndex3=3
ResourceMultiplierIndex3=0
FactionTeamForIndex3=3
FactionStartLocationForIndex3=3
FactionTypeNameForIndex3=norsemen
FactionPlayerNameForIndex3=AI3
FactionControlForIndex4=3
ResourceMultiplierIndex4=0
FactionTeamForIndex4=6
FactionStartLocationForIndex4=4
FactionTypeNameForIndex4=persian
FactionPlayerNameForIndex4=AI7
FactionControlForIndex5=3
ResourceMultiplierIndex5=0
FactionTeamForIndex5=5
FactionStartLocationForIndex5=5
FactionTypeNameForIndex5=romans
FactionPlayerNameForIndex5=AI4
FactionControlForIndex6=3
ResourceMultiplierIndex6=0
FactionTeamForIndex6=6
FactionStartLocationForIndex6=6
FactionTypeNameForIndex6=tech
FactionPlayerNameForIndex6=AI5
FactionControlForIndex7=3
ResourceMultiplierIndex7=0
FactionTeamForIndex7=7
FactionStartLocationForIndex7=7
FactionTypeNameForIndex7=egypt
FactionPlayerNameForIndex7=AI6

(it is only slightly modified from the one tomreyn posted). Is there a manual for how to switch off the human player and let only the AI play?

Screen output is very nice! But I didn't find the output XML file. Where is it written to under Windows?


softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #15 on: 21 March 2012, 15:00:35 »
All writable files (logs etc) on windows are under:

Code: [Select]
%AppData%\megaglest

Saved games go under:

Code: [Select]
%AppData%\megaglest\saved
each version of windows may have %AppData% located differently. From a command prompt type:

Code: [Select]
SET
to see alist of all environment variable and you should see where appdata is located. If you install megaglest using the windows installer (which i beleive you did not as you compiled it yourself) we install a link in the menu to the appdata folder. This is a folder where we are guranteed to have write access under normal conditions. You may change the location of writable data via the command line option:

Code: [Select]
--log-path=x Sets the game logs path to x
                example:
                        megaglest --log-path=~/game_logs/

*UPDATE: I forgot to answer about human players part of this post. Normally it is required to have at least 1 human player in a slot. In order to NOT have a human playing you can do this:

Set the human player to be an 'observer' which means no player is in that slot (in the mgg file like this)
Code: [Select]
FactionTypeNameForIndex0=*Observer*
FactionControlForIndex1=11
« Last Edit: 21 March 2012, 15:22:13 by softcoder »

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Scientific interface for MegaGlest?
« Reply #16 on: 21 March 2012, 15:12:30 »
Mike, whenever something fails, can you please tell us exactly which options you used to run the game (i.e. copy + paste your command line)? Thanks!
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #17 on: 21 March 2012, 15:19:48 »
Yes, sure, sorry for forgetting that. My command line was:

./megaglest --auto-test=60,../experiments/settings/test.mgg,exit

(note that I use cygwin under Windows, so that I have a bash shell)

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Scientific interface for MegaGlest?
« Reply #18 on: 21 March 2012, 15:46:17 »
Thanks. Also the revision # you built from is good to know in the future (not now).

Regarding your question on how to play an AI only game without a human player: I don't think this is currently possible - as far as I know a human player is mandatory. You may, however, make this human player an observer. This player does then still block one of the player slots (and take one of the start positions on the map) but it does not have any buildings or troops, so that there is less or no impact on the gameplay.

So, to rule out any influence, you can use an eight player map where the human player is an observer in the last slot, starting at any position on the map (it does not matter) and you have players 1 to 7 positioned in a way that they are evenly close to each other, so probably in a circle without blocking objects between them. Such a map does not yet exist, you would need to create this, yet. Eight Gradient gets somewhat close to this, though. The 'desert' tileset is one of the least computationally intensive on the GPU, so I usually choose this.

Here's an MGG file which should work this way:
Code: [Select]
Description=Eight Gradient
MapFilterIndex=8
Map=eight_gradient
Tileset=desert2
TechTree=megapack
DefaultUnits=1
DefaultResources=1
DefaultVictoryConditions=1
FogOfWar=1
AdvancedIndex=0
AllowObservers=1
FlagTypes1=2
EnableObserverModeAtEndGame=1
AiAcceptSwitchTeamPercentChance=0
PathFinderType=0
EnableServerControlledAI=1
NetworkFramePeriod=20
NetworkPauseGameForLaggedClients=1
FactionThisFactionIndex=7
FactionCount=8
FactionControlForIndex0=3
ResourceMultiplierIndex0=0
FactionTeamForIndex0=0
FactionStartLocationForIndex0=0
FactionTypeNameForIndex0=egypt
FactionPlayerNameForIndex0=AI1
FactionControlForIndex1=3
ResourceMultiplierIndex1=0
FactionTeamForIndex1=1
FactionStartLocationForIndex1=1
FactionTypeNameForIndex1=indian
FactionPlayerNameForIndex1=AI2
FactionControlForIndex2=3
ResourceMultiplierIndex2=0
FactionTeamForIndex2=2
FactionStartLocationForIndex2=2
FactionTypeNameForIndex2=magic
FactionPlayerNameForIndex2=AI3
FactionControlForIndex3=3
ResourceMultiplierIndex3=0
FactionTeamForIndex3=3
FactionStartLocationForIndex3=3
FactionTypeNameForIndex3=norsemen
FactionPlayerNameForIndex3=AI4
FactionControlForIndex4=3
ResourceMultiplierIndex4=0
FactionTeamForIndex4=4
FactionStartLocationForIndex4=4
FactionTypeNameForIndex4=persian
FactionPlayerNameForIndex4=AI5
FactionControlForIndex5=3
ResourceMultiplierIndex5=0
FactionTeamForIndex5=5
FactionStartLocationForIndex5=5
FactionTypeNameForIndex5=romans
FactionPlayerNameForIndex5=AI6
FactionControlForIndex6=3
ResourceMultiplierIndex6=0
FactionTeamForIndex6=6
FactionStartLocationForIndex6=6
FactionTypeNameForIndex6=tech
FactionPlayerNameForIndex6=AI7
FactionControlForIndex7=7
ResourceMultiplierIndex7=5
FactionTeamForIndex7=8
FactionStartLocationForIndex7=7
FactionTypeNameForIndex7=*Observer*
FactionPlayerNameForIndex7=Observer
[/code
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #19 on: 21 March 2012, 15:58:27 »
Great, that configuration is working, thanks! Observer is fine as long as he doesn't influence the game in any way, which seems to be the case. On the long run, it may be necessary to create several other maps, but I presume I'll start with a 1 on 1 situation anyway (so 1 on 1 plus 1 observer).

My version number is:
megaglest.exe v3.6.1-dev

Please note that if we start a set of experiments here we have to fix the AI, so no small changes should be made (well, you can do what you want of course, but we would not take over the changes during any experiment otherwise we loose comparability). So anybody of you has urgent AI changes in the queue that shall be added now, please go ahead, I will need some days to adapt the file I/O stuff for reading and writing conf and result files.

Update: Result files found, the XML is really huge. Do you have some manuals for the configuration files, e.g. these tag=value formats? I didn't find any.
« Last Edit: 21 March 2012, 16:13:42 by mikepreuss »

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Scientific interface for MegaGlest?
« Reply #20 on: 21 March 2012, 16:18:28 »
My version number is:
megaglest.exe v3.6.1-dev

Thanks, but this is just the version number, which is obvious and mostly static between releases. What I was referring to is the subversion repository revision number which your MegaGlest build is based on. You can get the current revision of the repository by running 'svn info ./' (svn info ./ | awk '/^Revision:/ {print$2}' precisely) in the topmost directory of your subversion working directory (i.e. the topmost directory which has a .svn subdirectory in it) or you may run /.megaglest --version which, depending on how you compiled, also lists the revision (3169 in this case) it was built from:
Code: [Select]
$ ./megaglest --version
megaglest v3.6.1-dev
Compiled using: GNUC: 40601 [64bit] on: Mar 21 2012 16:24:31
SVN: [Rev: 3169M] - using STREFLOP [SSE] - [no-denormals]
$

Since there is no problem now, we don't need to know your revision, I'm just explaining this for the future.

The glestuser.ini configuration options are, as mentioned in our FAQ, documented on the wiki. All relevant links are present on http://megaglest.org.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #21 on: 21 March 2012, 16:28:30 »
If all you care about are game statistics, you only need to care about the contents of the node:

Code: [Select]
<Stats description="1MV TEST" factionCount="8" thisFactionIndex="0" worldTimeElapsed="15.39" framesPlayed="13547" framesToCalculatePlaytime="2233" timePlayed="0" maxConcurrentUnitCount="130" totalEndGameConcurrentUnitCount="130">
<Player control="7" resourceMultiplier="1.00" factionTypeName="*Observer*" personalityType="1" teamIndex="8" victory="0" kills="0" enemykills="0" deaths="0" unitsProduced="0" resourcesHarvested="0" playerName="SoftCoder" playerColor="x [1] y [0] z [0]"/>
<Player control="4" resourceMultiplier="2.50" factionTypeName="Indian" personalityType="0" teamIndex="1" victory="0" kills="6" enemykills="6" deaths="12" unitsProduced="31" resourcesHarvested="4799" playerName="AI1" playerColor="x [0] y [0] z [1]"/>
<Player control="4" resourceMultiplier="2.50" factionTypeName="Magic" personalityType="0" teamIndex="2" victory="0" kills="29" enemykills="29" deaths="8" unitsProduced="26" resourcesHarvested="4059" playerName="AI2" playerColor="x [0] y [0.368627] z [0.12549]"/>
<Player control="1" resourceMultiplier="0.50" factionTypeName="Norsemen" personalityType="0" teamIndex="3" victory="0" kills="2" enemykills="2" deaths="17" unitsProduced="3" resourcesHarvested="50" playerName="AI3" playerColor="x [1] y [1] z [0]"/>
<Player control="2" resourceMultiplier="1.00" factionTypeName="Persian" personalityType="0" teamIndex="4" victory="0" kills="14" enemykills="14" deaths="22" unitsProduced="20" resourcesHarvested="1304" playerName="AI4" playerColor="x [1] y [1] z [1]"/>
<Player control="3" resourceMultiplier="1.50" factionTypeName="Romans" personalityType="0" teamIndex="5" victory="0" kills="22" enemykills="22" deaths="14" unitsProduced="22" resourcesHarvested="3630" playerName="AI5" playerColor="x [0] y [1] z [0.745098]"/>
<Player control="4" resourceMultiplier="2.50" factionTypeName="Tech" personalityType="0" teamIndex="6" victory="0" kills="17" enemykills="17" deaths="11" unitsProduced="26" resourcesHarvested="5544" playerName="AI6" playerColor="x [1] y [0.631373] z [0]"/>
<Player control="4" resourceMultiplier="2.50" factionTypeName="Magic" personalityType="0" teamIndex="7" victory="0" kills="11" enemykills="11" deaths="17" unitsProduced="9" resourcesHarvested="800" playerName="AI7" playerColor="x [1] y [0.631373] z [1]"/>
</Stats>

mikepreuss

  • Guest
Re: Scientific interface for MegaGlest?
« Reply #22 on: 21 March 2012, 16:30:08 »
Good hints, thanks! Could somebody point me to some documentation for the .mgg game configuration file? The one where the AI control is defined. I did not find any docu in the wiki. XML and INI are well documented.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,238
    • View Profile
Re: Scientific interface for MegaGlest?
« Reply #23 on: 21 March 2012, 16:39:26 »
We don't have docs for game settings and the XML's (the XML's are actually brand new within the last few weeks).

Nothing stops you from looking in the code of course, but here are the possible values for the Player Control Type:
(where the first is a value of 0, and ignore the networkCPU, they are for a special kind of developer testing). For you the Cpu* are AI players at different difficulty levels.

Code: [Select]
enum ControlType {
    ctClosed,
ctCpuEasy,
ctCpu,
ctCpuUltra,
ctCpuMega,
ctNetwork,
ctNetworkUnassigned,
ctHuman,

ctNetworkCpuEasy,
ctNetworkCpu,
ctNetworkCpuUltra,
ctNetworkCpuMega

};

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: Scientific interface for MegaGlest?
« Reply #24 on: 5 April 2012, 18:09:44 »
Mike, did you guys have a chance to try this, yet? Please keep us posted on any results, (at least but probably not only) I am curious.
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

 

anything