Integrated Nightly Build

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

I basically just followed the Wiki intructions (at http://wiki.openttd.com/index.php/Compiling_on_MinGW )

Just what isn't mentioned there is that you have to install libpng if you want PNG support (for screenshots), but it is just the same as installing zlib.

I installed all the files linked there, being MinGW in C:\MinGW; and MSYS in C:\MinGW\msys\1.0

Then I downloaded the SVN commandline client, installed it in C:\MinGW\svn, and made a batch file to download the trunk to C:\MinGW\msys\1.0\home\OpenTTD

Here is the code for C:\MinGW\Get Newest OpenTTD.bat

Code: Select all

@ECHO OFF
ECHO Starting to download updated code...
SET PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\svn\bin;%PATH%
CD \MinGW\msys\1.0\home\OpenTTD
IF EXIST .svn GOTO UPDATE
svn checkout svn://svn.openttd.com/trunk/ C:\MinGW\msys\1.0\home\OpenTTD
GOTO EXIT
:UPDATE
svn update
:EXIT
ECHO.
PAUSE
Everything else is then run from inside MSYS. I call MSYS through a batch also, so SVN is included in the path
C:\MinGW\Run MSYS.bat

Code: Select all

@ECHO OFF
SET PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\bin;C:\MinGW\svn\bin;%PATH%
CD \MinGW\msys\1.0
C:\MinGW\msys\1.0\msys.bat
Also, attached below I include the Makefile.config I used.
Attachments
Makefile.config.zip
(1.18 KiB) Downloaded 191 times
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

Thx, I'll give it another shoot then ;)

EDIT: I made it without any problems but I didn't use your batch files, I used MSYS :) btw is there any way to change the output directory? :roll:
Uncle Dex Says: Follow the KISS Principle!
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Good idea.

I just researched into that and discovered about 'make install' (oh, duh... hehe :roll: ).

So, I edited my Makefile.config so the compiled stuff go into C:\MinGW\msys\1.0\home\build now, when I use the 'make install' command.
To clean the intermediary files, I use 'make clean' and, tadah!, sources folder is clean again. 8)

To make the routine easier, I made a bash script, and called it build.sh
This is the script I use:

Code: Select all

#!/bin/sh

red='\e[0;31m'
NC='\e[0m' # No Color
DC='\e[0;38m' # Default color

echo -e "${red}Compiling Source...${DC}"
make
echo -e "${red}Done. Now copying it on install dir...${DC}"
make install
echo -e "${red}Cleaning up...${DC}"
make clean

cd ../build
echo -e "${red}Packing executable with UPX...${DC}"
upx --best -q openttd.exe
Notice that I am using UPX to pack the final executable (just for fun :) ), so if you don't want that, just remove the last lines.

The paths you need to setup on the Makefile.config are pretty tricky (needed some trial and error to do it right), so I am uploading the config I'm using (wich makes all files end up in /home/build), and included the bash.sh script aswell, all attached below.
Attachments
Makefile.config_build.sh.zip
Makefile.config and build.sh to compile to /home/build
(1.5 KiB) Downloaded 197 times
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7595
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

there are load sof cool patches on sourceforge that would be good. Theres an electric rails one for example
Image
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

LKRaider thanks, I'll try that later ;)
Born Acorn wrote:there are load sof cool patches on sourceforge that would be good. Theres an electric rails one for example
But the problem might be that they are for very old revisions no? :?
Uncle Dex Says: Follow the KISS Principle!
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Post by Horse »

Dextro wrote:LKRaider thanks, I'll try that later ;)
Born Acorn wrote:there are load sof cool patches on sourceforge that would be good. Theres an electric rails one for example
But the problem might be that they are for very old revisions no? :?
Is Passenger destinations als too old to include :(
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

Horse wrote:
Dextro wrote:LKRaider thanks, I'll try that later ;)
Born Acorn wrote:there are load sof cool patches on sourceforge that would be good. Theres an electric rails one for example
But the problem might be that they are for very old revisions no? :?
Is Passenger destinations als too old to include :(
no, that patch got another problem..... nobody coded it yet, which is even worse than an old patch
LKRaider wrote:

Code: Select all

cd ../build 
This is not always home/build. You could try

Code: Select all

cd $home/build
or simply

Code: Select all

cd ~/build
since those two should link to the user's homedir
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

:shock: ????

Image
Uncle Dex Says: Follow the KISS Principle!
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

Photoshop!!!

if not, then somebody coded it, but where is the source for it???
I want to see it
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Post by Mek »

Bjarni wrote:Photoshop!!!

if not, then somebody coded it, but where is the source for it???
I want to see it
perhaps search the forums? http://www.tt-forums.net/viewtopic.php?t=9201
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

Uncle Dex Says: Follow the KISS Principle!
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

:lol: That's why I didn't want to use Passanger Destinations just yet ... hehe

Born Acorn : Thanks for the tip. I looked there and got some patches I will try to integrate (elrail included).

Bjarni : on MSYS, the $home variable doesn't point anywhere :(
Also, ~/build points to /home/USER/build; whereas I am currently using /home/build (I know, not orthodox...)

Anyways, that is simply for the UPX part of the script, wich probably most won't use, so is a local solution only.

I am now compiling with SDL support (dunno if there's any real difference) and also tried some Pentium 4 gcc "optimization" (odds are I am not optimizing much, but meh, it feels good :lol: )
The flags I am using are: -O3 -march=prescott -mfpmath=sse -mmmx -msse -msse2 -msse3
At least the final executable is playable here, but with no means to actually test it's speed, I can't tell the difference (apart from filesize).
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

LKRaider wrote::lol: That's why I didn't want to use Passanger Destinations just yet ... hehe

Born Acorn : Thanks for the tip. I looked there and got some patches I will try to integrate (elrail included).

Bjarni : on MSYS, the $home variable doesn't point anywhere :(
Also, ~/build points to /home/USER/build; whereas I am currently using /home/build (I know, not orthodox...)

Anyways, that is simply for the UPX part of the script, wich probably most won't use, so is a local solution only.

I am now compiling with SDL support (dunno if there's any real difference) and also tried some Pentium 4 gcc "optimization" (odds are I am not optimizing much, but meh, it feels good :lol: )
The flags I am using are: -O3 -march=prescott -mfpmath=sse -mmmx -msse -msse2 -msse3
At least the final executable is playable here, but with no means to actually test it's speed, I can't tell the difference (apart from filesize).
can you point me to where you find the information to optimize builds? I would like to try it out aswell :mrgreen:

PS: sorry to make so much questions, complete newbie here :oops:
Uncle Dex Says: Follow the KISS Principle!
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Hey, I am a noob too! :)
Well, I tried google first. The best results where from the gcc online docs itself ( http://gcc.gnu.org/onlinedocs/ )

More specifically, these two links:
> Optimize Options
> Intel and AMD options

Now, to include the optimizations, I edited the Makefile and Makefile.config (yet again :roll: )
Basically, I added an option called OPTP4, wich when enabled included the flags I posted before.

These are the enabled flags under #OS flags on my Makefile.config:

Code: Select all

WIN32:=1
MINGW:=1
OPTP4:=1
And, on Makefile, I added the following lines just before the "what to compile" stuff:

Code: Select all

ifdef WIN32
ifdef OPTP4
BASECFLAGS += -O3 -march=prescott -mfpmath=sse -mmmx -msse -msse2 -msse3
endif
endif

##############################################################################
#
# What to compile
# (users do not want to modify anything below)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Post by Zuu »

Just have to say, that if you optimize to much, your binaries will become unstable.

There are already enoght of scarry examples of people that have set a way to high optimization level for compilation of their systems. With broken and unstable systems as the result.

---

All programs that I have installed with emerge (tool to download and install programs) are compiled with plain

Code: Select all

-O2 -march=pentium3 -fomit-frame-pointer
(and I have an Intel celeron (p3 coppermine) processor)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

I understand the -O3 option may be too agressive, but I was willing to try it.

I have also built with the -O2 flag (wich seems to be default in OpenTTD anyways), and it results in a slightly smaller binary.

Stability and actual performance are still to be tested, but unfortunatelly I have no means to do that... :?
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

LKRaider wrote:I understand the -O3 option may be too agressive, but I was willing to try it.

I have also built with the -O2 flag (wich seems to be default in OpenTTD anyways), and it results in a slightly smaller binary.

Stability and actual performance are still to be tested, but unfortunatelly I have no means to do that... :?
try to enable autosaves every month and play a big map (I mean big, the largest you can :mrgreen: ), that should prove a good test 8)

I'll try to compile a PIV optimized build for myself and test it :)
Uncle Dex Says: Follow the KISS Principle!
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

Ok so here's what I'm using (I don't know if my P4 has SSE3 and Prescot so I took them out).

Makefile.config:

Code: Select all

WIN32:=1
MINGW:=1
OPTP4:=1
Makefile:

Code: Select all

ifdef WIN32
ifdef OPTP4
BASECFLAGS += -O2 -march=pentium4 -mfpmath=sse -mmmx -msse -msse2
endif
endif

##############################################################################
#
# What to compile
# (users do not want to modify anything below)
It's looking good untill now, but I'll have to test further. :)

And I'll try O3 as soon as this one works ok :)

PS: I don't know why but the window title doesn't show the revision in this compile... odd :?
Uncle Dex Says: Follow the KISS Principle!
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

zuu wrote:Just have to say, that if you optimize to much, your binaries will become unstable.

There are already enoght of scarry examples of people that have set a way to high optimization level for compilation of their systems. With broken and unstable systems as the result.

---

All programs that I have installed with emerge (tool to download and install programs) are compiled with plain

Code: Select all

-O2 -march=pentium3 -fomit-frame-pointer
(and I have an Intel celeron (p3 coppermine) processor)
I tried to optimise as much as possible and as a result, I did not the the tile highlighting when building tunnels or bridges. It also became really slow(!) when building those

Generally setting DEBUG to nothing in makefile.config should be enough optimisation. It do not break anything and it' fairly fast

Dextro wrote:PS: I don't know why but the window title doesn't show the revision in this compile... odd
I do. You need to install svn (subversion) and get the source through that. It needs to make the folder called .svn in your source dir. I don't know if all clients do that. To check it, you simply write "svnversion ." in the dir. If it fails, you do not have the needed stuff and OTTD will miss a revision tag


About the destination patch: I never realisted that somebody would post such a patch far into something, which already turned out as a just talk. Make a new topic or post it on SF if you want the developers to see it. It's not like I have time to code, test and read EVERYTHING on the forums on top of being a full time student :wink:
User avatar
Dextro
Chief Executive
Chief Executive
Posts: 701
Joined: 12 Jan 2005 21:56
Location: Lisboa, Portugal
Contact:

Post by Dextro »

Bjarni wrote:
Dextro wrote:PS: I don't know why but the window title doesn't show the revision in this compile... odd
I do. You need to install svn (subversion) and get the source through that. It needs to make the folder called .svn in your source dir. I don't know if all clients do that. To check it, you simply write "svnversion ." in the dir. If it fails, you do not have the needed stuff and OTTD will miss a revision tag


About the destination patch: I never realisted that somebody would post such a patch far into something, which already turned out as a just talk. Make a new topic or post it on SF if you want the developers to see it. It's not like I have time to code, test and read EVERYTHING on the forums on top of being a full time student :wink:
I noticed that it required the svn info but since I was using the download with complete source it didn't have the info, I'm trying to add the revision myself manually (see my topic in the development forum).

As for the patch I wish someone will carry it on but since it's not mine and I don't know anything about coding I'll just stand and watch :?
Uncle Dex Says: Follow the KISS Principle!
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 29 guests