How to Build Polyworld for Windows
- Get Qt and MinGW
Download qt-sdk-win-opensource-2010.02.1.exe
Install to d:\work\tools\qt - Get GSL for Windows
Download gsl-1.8-bin.zip and gsl-1.8-lib.zip files
Extract to d:\work\tools\gnu32 - Get CVS
Download cvs-1-11-22.zip
Extract to d:\work\tools\cvs - Get Boost
Download boost_1_43_0.zip
Extract to d:\work\tools\boost - Start the Qt Command Prompt
start > all programs > qt sdk by nokia v2010.02.1 (open source) > qt command prompt - Set up your path
path=%path%;d:\work\tools\gnuwin32\bin;d:\work\tools\cvs - Download polyworld
cvs -d:pserver:anonymous@polyworld.cvs.sf.net:/cvsroot/polyworld checkout -P polyworld
Copy to d:\work\polyworld - Get a Project File and a World File
Dowload polyworld-modified.zip
Extract to d:\work\polyworld-modified
Copy d:\work\polyworld-modified\polyworld.pro to d:\work\polyworld
Copy d:\work\polyworld-modified\debug\worldfile to d:\work\polyworld\debug - Genrate a Makefile
Go to d:\work\polyworld
Double check that all the directories in polyworld.pro are correct for you.
qmake - Edit the souce code
See instructions below - Build
Go to d:\work\polyworld
mingw32-make
- Some header files are in a different place for MinGW
Look for the files in d:\work\tools\qt\2010.02.1\mingw - Some header files are not available for MinGW
Put a #ifdef linux and #endif around them. - Some functions are not available for MinGW
MinGW does not have drand48().
Instead use double( rand() ) / double( RAND_MAX )
MinGW does not have alloca().
Instead use boost shared arrays
For the rest, put a #ifdef linux and #endif around them.
There are some big chunks where you'll have to do this but you won't affect the simulation too much.
There are some functions for file writing that won't work because Polyworld uses a few commands only available on Linux and Mac. Use the worldfile in polyworld-modified.zip to disable most of them. - Some functions will cause a crash
There are a few lines in the genome::crossover() that will cause a crash. - There are a few more small changes you'll need to make but I hope this guide has helped you with most of the big ones.
- If you have trouble modifying the code, I've included the modifications in polyworld-modified.zip
- If you have trouble building the code, I've included polyworld.exe and all of the dependencies in polyworld-modified.zip
- Use the dynamic link libraries in d:\work\tools\qt\2010.02.1\qt\bin and not d:\work\tools\qt\2010.02.1\bin
- http://www.beanblossom.in.us/larryy/BuildingPolyworld.html
- http://wiki.yak.net/634
- http://wiki.yak.net/630
why don't they just build this and put this in the section that says windows seriosly
ReplyDeleteHi Anonymous,
ReplyDeleteI hope you've had good luck building Polyworld.
The libraries that Polyworld uses has progressed immensely. This has made it easier to port to Windows.
how do you edit the source code? I don't understand it at all. what coding language is it? polyworld keeps crashing.
ReplyDeleteWhen I execute the "mingw32-make" command in qt it says: "mingw32-make: *** [debug] error 2"
Hi Anonymous,
ReplyDeleteYou can edit the source code with most text editors. I use emacs but I recommend Notepad++ for most people.
The source code is in C++.
I'm not sure why Polyworld is crashing for you. Are you trying to run the version I built in polyworld-modified.zip? You have to run it from the Qt command prompt with modifications to the path I described above so that Polyworld can find the dynamic link libraries it needs.
Are you calling mingw32-make to build Qt or Polyworld? You don't need to build Qt because it is already built. You may need to generate a Makefile for Polyworld using qmake as I've described above.
Hang in there. It is usually only a few small things that get in the way. Please let me know if you have further questions.
Ok, I've downloaded cvs sources and built them under VC2005. It seems to run fine, except for slow window reaction. Hmm.. What do I do with it now? Should I upload binaries somewhere?
ReplyDeleteHi Anonymous,
ReplyDeleteI'm glad that you were able to build and run the Polyworld code.
The version you've got is a small modification of Larry Yaegar's code to work on Windows.
I've been working on a version of Yaegar's code for a while now and it's quite different. I'll be uploading the binaries for that soon. I'm currently integrating Bullet code for physics and OGRE code for graphics into my version.
You options depend on your intentions. What are you intending to do with the code? Make your own modifications? It would be great if you also had a place where you could upload your binaries and write about what you're doing.
Thanks for the instructions, Binh. I was able
ReplyDeleteto build from a new cvs version for windows except for the worldfile loading, which I used the old code for, as you also did.
You're welcomed Tom. I hope you get a lot out of working with Polyworld as I have.
ReplyDeleteHow exactly do you go about linking the dynamic link libraries?
ReplyDeleteHi Anonymous,
ReplyDeleteYou don't need to do anything extra to use the dynamic link libraries. You include Qt header files in your code, compile, and link.
At run time your program will look through the paths you specified for the dynamic link libraries.
YES! With this, I will finally be able to show that I am AWESOME INCARNATE! Ty Binh... Any problems I'll let you know. XD
ReplyDeleteWell...
ReplyDeleteDidn't think I'd run into a problem this fast, but it appears I don't have d:\work\tools\qt, nor do I know how to make it. So, how do I make it?
Hi Archulous,
ReplyDeleteAlways good to hear from more people using Polyworld.
You can get d:\work\tools\qt by specifying to Qt that directory during the installation process.
Or you can create those directories yourself using Windows Explorer and then move Qt there.
Moving Qt is a little tricky. I've written up two guides to help you do this.
http://tb-nguyen.blogspot.com/2010/10/how-to-move-qt-install-library.html
http://tb-nguyen.blogspot.com/2011/01/how-to-move-qt-install-library-version.html
Best of luck and let me know how you go.
I'm a little confused about editing the source code. I'm not sure which files I need to change, hopefully not all of those files in qt\mingw\include, but if that's what it takes, I'll probably do it. Thanks for the help.
ReplyDeleteHi Anonymous (7/11/11),
ReplyDeleteYou can use the error messages you get when you compile and run the program to guide your editing of the source code.
All the error messages are straightforward. Good luck!
Hello,
ReplyDeleteI have little to no experience with C++. I think I have done pretty well even with that slight handicap, but I am stuck with a couple of things. For the first one I have looked around on the internet, but that didn't help. I can't figure out what's wrong except that about everything is "#ifdef"ed in the "#define"
Here's what the prompt gives me:
app\simulation.cp: in member function 'void TSimulation::init{const char*)*':
app\simulation.cp:1503: error: expected primary-expression before '}' token
app\simuation.cp:1503: error: expected ';' before '}' token
I'm also not sure whether I need to do anything about warnings similar to this:
utils/Queue.h:131: warning: ignoring #pragma omp atomic
Thank you for your help.
just turn it into a exe file for the benefit of all enthusiasts!!!!!!!!!
ReplyDeleteI'm thinking about regularly releasing executables of the simulation I've been working on.
DeleteI don't think people understand why releasing an .exe is a bad idea... do you people even know why you need to edit the source code every so often and how hard would be to code an executable that lets you mess with -everything- in the source?
ReplyDeleteI'd prefer if that person worked on whatever important he has working on atm rather than making executables for every person that just wants to stare at polygons evolving. When the program gets to 100% completion you can then ask for an executable and mess with it as much as you like. Till then take the source and help work on it.
Binh, thank you very much for all your hard work! After a bit of fussing around, I was able to build this using Qt 5.x on windows. If anyone is interested in checking out the codebase I am working on, here is a link to the source on github.
ReplyDeletehttps://github.com/rockhowse/polyworld-modified
Hey rockhowse,
DeleteYou're welcomed and well done on getting it to work with Qt. I've always found Qt challenging to use.
And thank you for fixing up the code and putting it up on github :)
Delete