Questions about Wargus and evolutionary algorithm

Asked by Rodrigo Pereira on 2011-10-18

I'm Rodrigo de Freitas Pereira, a graduate student in computer science from USP - Universidade de Sao Paulo - Brazil.
I'm about to start an undergraduate research in artificial intelligence in games.
When researching open source games to work, I came across Wargus.
I wonder if you could help me on some issues related to Wargus.

How can I run several times without the graphical interface and no need to start the game every time a battle is ended?
I'm having problems in the middle and the end of the game because sometimes it crashes, you had the same problem? Could it be because I increased the speed of the game?
And how can I get the output files to see who won a battle with statistics?

I would be very grateful if you help me.

Graciously

Rodrigo de Freitas Pereira

Question information

Language:
English Edit question
Status:
Answered
For:
Wargus Edit question
Assignee:
No assignee Edit question
Last query:
2011-11-02
Last reply:
2013-02-06

This question was reopened

And where is the C/C++ files? I think that I'll need to modify it.

Kyran Jackson (erstmap) said : #2

Hi Rodrigo,

1. I don't know if its possible the run the game without the graphical interface. I'm sure the others will know though.

2. Those crashes are caused by the goldmine. That bug has been fixed in the trunk version. Another option is to use the most stable version of Wargus: 2.4 - http://sourceforge.net/projects/wargus/files/wargus/ (this version is very old though)

3. Results are graphically displayed at the end of a match. It should be a simple matter of finding the relevent variables and printing them to the console/file.

4. You can access all the files using Bazaar. You can browse the code online here http://bazaar.launchpad.net/~stratagus/stratagus/trunk/files and http://bazaar.launchpad.net/~stratagus/wargus/trunk/files

Thanks Kyran, I installed the 2.2.4 version and it works, but I'm still needing of the log files to see what the computer players have done on the match, in the 2.2.5 version I know that this files are generated, but with only the player actions.
The why i'm need to run the game without the graphical interface is because I need to do many test with many differents AI scripts, take the results in the log files e generate other script to run the game again, so I have to run the game automatically.

And where can I find the C/C++ project of the 2.2.4 version of wargus or stratagus?

Please, help me.

Just one more question: Is there a way to put only computer players(NPC's) playing on a map? I just wanna see they playing without the need for me to be in the match.

Thanks

Joris Dauphin (joris-dauphin) said : #5

Some other people have done some research using stratagus/wargus but they seem not shared there change :(

With the previous links from bazaar, you get access to source of stratagus/wargus with all its history (and release version are labeled).

It is not possible to launch stratagus without UI (I think it is lot of "easy" changes if you hard coded this)
It should be possible to play NPC vs NPC (you may change map properties and trigger to avoid defeat :-) )

Does anyone knows how to put NPC vs NPC? I tried to put all the players as computer on the editor, but when I loaded the map the game is closed

Kyran Jackson (erstmap) said : #7

Some of the research done on Wargus:

Ponsen, M. J. V., Lee-Urban, S., Muoz-Avila, H., Aha, D. W., & Molineaux, M. Stratagus: An open-source game engine for research in real-time strategy games. Technical Report AIC-05-127, Naval Research Laboratory, Navy Center for Applied Research in Artificial Intelligence. 2005.

Ponsen, M., Muñoz-Avila, H., Spronck, P., & Aha, D. W. Automatically Generating Game Tactics with Evolutionary Learning. AI Magazine. 2006, Vol. 27, 3.

Molineaux, M., Aha, D.W., & Ponsen, M.J.V. Defeating novel opponents in a real-time strategy game. Reasoning, Representation, and Learning in Computer Games: Papers from the IJCAI Workshop (Technical Report AIC-05-127). 2005.

Chan, H., Fern, A., Ray, S., Wilson, N., & Ventura, C. Extending Online Planning for Resource Production in Real-Time Strategy Games with Search. Proceedings of the ICAPS Workshop on Planning in Games. 2007.

Marthi, B., Russell, S., & Latham, D. Writing Stratagus-Playing Agents in Concurrent ALisp. Proceedings of IJCAI-05 Workshop on Reasoning, Representation, and Learning in Computer Games. 2005.

Ponsen, M.J.V., Spronck, P., & Tuyls, K. Hierarchical Reinforcement Learning with Deictic Representation in a Computer Game. 18th Benelux Conference on Artificial Intelligence (BNAIC). 2006.

Thanks Kyran, I tried to compile it, but it need of SLD and Zlib libraries, I downloaded it, but I don't know how to install in VC++.

Could you help me?

Sorry, I clicked in Solved unintentionally

Joris Dauphin (joris-dauphin) said : #11

* Get source from Bazaar,
Basic instructions to compile are in doc/install.html

  + With recent source 2.2.5+, you should use CMake

  For visual :
  cmake -DCMAKE_INSTALL_PREFIX=/path/to/3rd/ -G "Visual Studio 8 2005" -DENABLE_STATIC=ON

  with path/to/3rd containing bin/, lib/ include/ of 3rd party
  -G supports also other version of IDE (see cmake documentation)

  + With older source, source should contain a .sln for visual

  you may have to correct includeDir, libDir of 3rd Party.

* http://stratagus.sourceforge.net/msvc-libs.zip contains the lib used by stratagus for visual.

Humm, I tried it, I downloaded the msvc-libs.zip and the first time that I compiled the project,
it generated many errors, cause couldn't find the 'SDL.h', but when I did it again, it was generated other errors
about the database, that couldn't be opened, I changed one property about Debug information Format, compiled and
sometimes occurs a error of Linkage, but sometimes not, and when I tried to execute the .exe generated nothing happens, I put the
.exe on the wargus directory and two .txt files are created, one is telling about the stratagus.lua, but I don't know
what it is. Well, I try the generate a Release version many errors about 'cannot open SDL.h' is shown.

Have someone the same problems?

Joris Dauphin (joris-dauphin) said : #13

You have to fix include dir and linkdir
Properties -> C/C++ (-> General) -> Additional Include Directories : add path to SDL.h
Properties -> Linker (-> General) -> Additional Library Directories : add path to SDL.lib

You should also modify
Properties -> Debugging -> Command Arguments : add '-d path/to/data'
path/to/data/scripts/stratagus.lua should exist

stratagus.lua is the main script used to define the game (UI, rules, AI, preferences...)

Thansk Joris, now it been compiled withou errors, but at the and of compiling a fatal error is given.

fatal error LNK1000: Internal error during IncrBuildImage

Why of this?

And , can I run the stratagus.exe generated directly in the directory? or it need to be on wargus directory?

and when I try to run the stratagus.exe, a error occurs, a window pops up saying that I need the msvcp90d.dll, and I don't find it.

Joris Dauphin (joris-dauphin) said : #16

Properties... -> Linker (-> General) -> Enable Incremental Linking : set at No

you can launch stratagus exe from anywhere, but
- SDL.dll should be in the same directory or somewhere in $(PATH)
- you should use
stratagus.exe -d path/to/data/

Sorry Joris, but what is path/to/data ?
Should I open stratagus from command line?

take look this, http://imageshack.us/photo/my-images/94/vcwargus.jpg/

is it right?

Joris Dauphin (joris-dauphin) said : #18

path/to/data/ is the directory containing game data.
to be more specific, path/to/data/scripts/stratagus.lua should exist.

In your case,
- you should put "" around your path because of the space.
- I think you should removed scripts
so
Command Argument : -d "c:\Program Files(x86)\Wargus\"

humm, I compiled it, and first time is said that the stratagus.exe is beeing used, but when I compile again no errors are generated,
but when I try to run stratagus.exe a stdout.txt is created with the text below:

c:\users\rodrigo\desktop\teste wargus\stratagus-2.2.4\src\stratagus\iolib.cpp:577: File `scripts/stratagus.lua' not found
Maybe you need to specify another gamepath with '-d /path/to/datadir'?

I did what you said about the Command Argument putting -d "c:\Program Files(x86)\Wargus\" on debuggin property

Well, now I changed some parts of iolib.cpp, and put the name os the directory of stratagus.lua, and when executed other stdout.txt is created with this:

[string "C:\Program Files (x86)\Wargus\scripts\strat..."]:82: attempt to call global 'SetFullGameName' (a nil value)
stack traceback:
 [string "C:\Program Files (x86)\Wargus\scripts\strat..."]:82: in main chunk

What can it be?

Joris Dauphin (joris-dauphin) said : #22

You should use compatible (and so, same) version of stratagus and wargus.

(SetFullGameName has been introduced just before 2.2.5.2)

But I'm using the same version of wargus (2.2.4) for the code and the game, but now the error is :

Maybe you need to specify another gamepath with '-d /path/to/datadir'?

I don't know what to do.

Where can I find the stratagus 2.2.4 installer?
I think that can be it.

Sorry guys, but I'm still having this f****** problem,

Maybe you need to specify another gamepath with '-d /path/to/datadir'?

I can't understand.
The version os the project and the game are the same (2.2.4)

http://imageshack.us/photo/my-images/844/wargus.jpg/

Take a look on Commands Arguments:
http://imageshack.us/photo/my-images/844/wargus.jpg/
Inside the Wargus folder, has another named "scripts" and inside it has the stratagus.lua
but the stratagus can't find it. I'm going crazy with this, I need to run it to show to my master.

Please, can anyone try to compile on MSVC and take a screenshot to show me what I have to do, or a video, or whatever ?

Kyran Jackson (erstmap) said : #25

Could you not just take your executable file and copy and paste it into the Wargus directoy and see if that works? That should bypass the need for /path/to/datadir all together.

Kyran Jackson (erstmap) said : #26

If that doesn't work, email your execuatable to me and I'll see if I can do anything with it.

Kyran Jackson (erstmap) said : #27

Even if you can't manage to figure it out there is always BOS Wars, which is very similar to Stratagus (easier to compile, better community support). Their documentation is much better, and they've even got chatrooms with people generally in them. The game itself is a bit more complex then Wargus, but you don't need any commerial files to run it.

Kyran Jackson (erstmap) said : #28

I had a look at your binary.

If I run the default executable with - stratagus.exe -d "data" - it works...

However, when I run your executable with that command it starts to load (terminal looses focus), but it doesn't finish loading.

So your executable does find the file, there is just something else wrong.

Ohh shit, now it will be an Odyssey to find this problem.
Well, anything I ask later.

I removed the -d "bla bla bla" on the Command arguments on project, compiled, I took the release version of MSVC , put on the wargus directory, and try to run by command line, the stdout.txt is ok , i think: "Stratagus default config file loading ... "

but the stderr.txt shows that:

Can't open file 'preferences.lua': No such file or directory
[string "scripts/stratagus.lua"]:308: attempt to index global 'preferences' (a nil value)
stack traceback:
 [string "scripts/stratagus.lua"]:308: in main chunk

no matter what I put the argument -> -d "\wargus\" or -d "\wargus\scripts" or whatever

It's strange cause I haven't the preferences.lua, I know that the 2.2.5 version has it, but not the 2.2.4

Can someone give me a compiled project that is working?

Kyran Jackson (erstmap) said : #31

I think the -d argument is suppose to be 'data', the scripts file being in \wargus\data\scripts...

It should load even without the preferences.lua, I believe that is generated when a new setting is used. Just in case I've emailed it to you. Put it in /wargus/wc2/

I tried to execute your executable and now the errors are:

Stratagus default config file loading ...

Can't open file `ui/click.wav'
Can't open file `human/basic_voices/ready.wav'
Can't open file `human/basic_voices/help/1.wav'
Can't open file `human/basic_voices/help/2.wav'
Can't open file `human/basic_voices/dead.wav'
Can't open file `orc/basic_voices/ready.wav'
Can't open file `orc/basic_voices/help/1.wav'
Can't open file `orc/basic_voices/help/2.wav'
Can't open file `orc/basic_voices/dead.wav'
Can't open file `misc/building_construction.wav'
Can't open file `ships/sinking.wav'
Can't open file `units/catapult-ballista/acknowledgement/1.wav'
....

And so on.
I put the preferences.lua in the root of wargus directory cause it haven't a wc2 directory on wargus.
How did you do to run your executable?
what you put on arguments?
send a picture if not asking too much.

thanks Kyran

Kyran Jackson (erstmap) said : #33

Ok, this is odd.

So you installed Wargus 2.2.4 using the installer. It's extracted all the images and sounds from the Warcraft 2 cd perfectly fine, and the game ran fine.

But, when you compile your own executable and put it in that same folder it throws up all those errors?

Joris Dauphin (joris-dauphin) said : #34

preferences.lua is a generated file where your "preferences" are saved (resolution, sound, ...) in a global table 'preferences'.
It is not present the first time you launch stratagus, and it should be present after.
preferences.lua is saved in the "user game" directory (something like .stratagus-2.2/wc2/ )

You should have a directory containing at least :
- scripts/ : with lot of lua file which "define" the game.
- graphics/ : with all graphics of the game.
- maps/ : with some maps.
- campaign/ : where there are data for solo mode.
you may have also :
- sound/ : with game sounds.
- music/ : with game musics.
- videos/ : with intro videos.

Note:
wargus doesn't contain directly the game data, you should extract data from war2 CD.

yes kyran, the game is running fine, the extract of WC2 files too, no errors occours.

Ow, now looking at you picture I see that I was putting a wrong argument.
Now puttin the -d "data" with stratagus.exe it works, but don't with my and your executable, yet no errors is charged on stdout.txt and stderr.txt, nothing occours, the game doesn't start.
very strange, cause i'm using the dos version of WC2.

A picture of cmd
http://imageshack.us/photo/my-images/163/wargus.jpg/

I think that our executable is findding the game data, cause if I put other path the errors occours, but don't with -d "data"
But now nothing happen.

Kyran Jackson (erstmap) said : #38

I think we'll just have to give up trying to get 2.2.4 to compile. The issue could be anything, a library that is too new for example.

Your best bet would be to use the latest trunk of Wargus, or go with BOS Wars (http://www.boswars.org).

Fantastic, the BOS Wars worked in the first time that I compiled, but the complexity is substantially reduced, cause has only a few units.
I'll try one more time to run wargus.
Where can I find the source of 2.2.5.4 for MSVC?

Launchpad Janitor (janitor) said : #40

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Pali (pali) said : #41

Source code for all (new) versions is on https://launchpad.net/wargus/+download (tarballs contain cross-platform support)

Pali (pali) said : #42

Marked as answered

Can you help with this problem?

Provide an answer of your own, or ask Rodrigo Pereira for more information if necessary.

To post a message you must log in.