1 (edited by Dune 2018-11-05 16:23:46)

Topic: [TUTORIAL] How to Compile Teeworlds Under Windows

Warning: this post is old and not up-to-date to the last version requirements. You may want to follow the guide in the wiki instead. // Dune

http://img834.imageshack.us/img834/5128/howtocompiletwunderwind.png
Before starting this tutorial, I want you to know some stuff.
1) This tutorial works only on Windows, I may create a Linux tutorial later
2) theanomaly gave me the idea of this tutorial on this page.
3) This tutorial works on 6.x Teeworlds Versions, and probably on 7.x
4) For who don't know, this is a tutorial for mod creators.
5) There is an Linux topic as well, created by theanomaly, here.
6) There is a video version, you can see it here.
_______

Download and install this softwares:

Visual Studio Express 2010
Python 3.2.1
Bam 4.0 (Need to be compiled)
Teeworlds Source (This is the original one, on zip)
_______

Compiling Bam 4.0

Create a folder on C:\ and call it bam
Than Drop all the Bam 4.0 zip file under this folder
Now go to the console (cmd) and write:

cd C:\bam
make_win32_msvc.bat

Now wait. The bam will compile himself.
_______

Compiling Teeworlds

Create a folder on C:\ and call it tws
Than Drop the source of Teeworlds under this folder
Now go to the console (cmd) and write:

For 32 Bit PCs:
%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

For 64 Bit PCs:
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

Than:

cd c:\tws
c:\bam\bam release

You can try to use c:\bam\bam debug or just c:\bam\bam if you want to.
_______

Done! Your Teeworlds is now compiled! Congratz!
Any problem or error on my topic? Give a comment! smile

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

2 (edited by Dune 2012-12-04 14:02:30)

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

You could also have linked the official documentation on how to compile since it's quite the same, and includes all platforms support.

Not Luck, Just Magic.

3

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Wen you do that...whats the difference ?

If you want a perfect map for your own server you can PM me to make you one ^^

Please also try play nodes you may download it here!. And as always.Have a nice day

4 (edited by Volibar 2012-06-07 17:19:12)

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

I'm gonna be 100% honest.

What does compiling do or what do you get from it? is it to mod gametypes?
(Then i mean exactly what does it give you?)

5 (edited by 2012-06-07 17:26:46)

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Volibar wrote:

I'm gonna be 100% honest.

What does compiling do or what do you get from it? is it to mod gametypes?
(Then i mean exactly what does it give you?)

When we say "compile", it means we are taking all of the game's source files and combining them together into something we can use (teeworlds.exe or teeworlds_srv.exe). That's how teeworlds is made. The method for compiling this is what we are describing.

Thanks HeroiAmarelo. GREAT JOB! I'm going to bookmark this.

Each time I have to compile, I have to re-run "%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86" so it was annoying to have to change a 9.0 to 10.0 lol i'm just lazy.

6

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Full Face Tee wrote:

Each time I have to compile, I have to re-run "%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86" so it was annoying to have to change a 9.0 to 10.0 lol i'm just lazy.

Do you realize you can put that in a simple bat file, so you won't have to copy paste it in the console?

Not Luck, Just Magic.

7

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Dune wrote:
Full Face Tee wrote:

Each time I have to compile, I have to re-run "%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86" so it was annoying to have to change a 9.0 to 10.0 lol i'm just lazy.

Do you realize you can put that in a simple bat file, so you won't have to copy paste it in the console?

Yes, but like I said. I'm lazy tongue

8

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Full Face Tee wrote:
Dune wrote:
Full Face Tee wrote:

Each time I have to compile, I have to re-run "%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86" so it was annoying to have to change a 9.0 to 10.0 lol i'm just lazy.

Do you realize you can put that in a simple bat file, so you won't have to copy paste it in the console?

Yes, but like I said. I'm lazy tongue

Well, because programmers are lazy people they make scripts to do stuff for them. Like compiling.
Here's mine:

@echo off
color 0a

:: Check if we already have the tools in the environment
if exist "%VCINSTALLDIR%" (
    goto compile
)


:: Check for Visual Studio
if exist "%VS100COMNTOOLS%" (
    set VSPATH="%VS100COMNTOOLS%"
    goto set_env
)
if exist "%VS90COMNTOOLS%" (
    set VSPATH="%VS90COMNTOOLS%"
    goto set_env
)
if exist "%VS80COMNTOOLS%" (
    set VSPATH="%VS80COMNTOOLS%"
    goto set_env
)

echo You need Microsoft Visual Studio 8, 9 or 10 installed
pause
exit

:: Setup the environment
:set_env
call %VSPATH%vsvars32.bat
ping -n 1 localhost >nul

::Check for bam
if exist "../bam-0.4.0/bam.exe" (
    set BAM="../bam-0.4.0/bam.exe"
    goto setbampar
)
if exist "../bam/bam.exe" (
    set BAM="../bam/bam.exe"
    goto compile
)
if exist "bam.exe" (
    set BAM="bam.exe"
    goto compile
)
if exist "../bam/src/bam.exe" (
    set BAM="../bam/src/bam.exe"
    goto compile
)
if exist "../bam-0.2.0/src/bam.exe" (
    set BAM="../bam-0.2.0/src/bam.exe"
    goto compile
) else goto nobam
pause

:nobam
cls
echo.
echo [ERROR]No bam found!
echo.
pause >nul
exit

:: Compile
:compile
@echo === Building Teeworlds Server===
@call %BAM% server_release -j 4
@echo === Finished ===
echo.

:: Ending/Or not :D
echo Press any Key to Compile again...
pause >nul
color 0c
echo === Again :D ===
ping -n 2 localhost >nul
color 0a
cls
goto compile
exit

Just copy-paste it in a .bat file and run put the file in your sourcefolder.
Put bam.exe in C:\Windows\system32 and you can call it from everywhere.

9

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

BotoX wrote:
Full Face Tee wrote:
Dune wrote:

Do you realize you can put that in a simple bat file, so you won't have to copy paste it in the console?

Yes, but like I said. I'm lazy tongue

Well, because programmers are lazy people they make scripts to do stuff for them. Like compiling.
Here's mine:

@echo off
color 0a

:: Check if we already have the tools in the environment
if exist "%VCINSTALLDIR%" (
    goto compile
)


:: Check for Visual Studio
if exist "%VS100COMNTOOLS%" (
    set VSPATH="%VS100COMNTOOLS%"
    goto set_env
)
if exist "%VS90COMNTOOLS%" (
    set VSPATH="%VS90COMNTOOLS%"
    goto set_env
)
if exist "%VS80COMNTOOLS%" (
    set VSPATH="%VS80COMNTOOLS%"
    goto set_env
)

echo You need Microsoft Visual Studio 8, 9 or 10 installed
pause
exit

:: Setup the environment
:set_env
call %VSPATH%vsvars32.bat
ping -n 1 localhost >nul

::Check for bam
if exist "../bam-0.4.0/bam.exe" (
    set BAM="../bam-0.4.0/bam.exe"
    goto setbampar
)
if exist "../bam/bam.exe" (
    set BAM="../bam/bam.exe"
    goto compile
)
if exist "bam.exe" (
    set BAM="bam.exe"
    goto compile
)
if exist "../bam/src/bam.exe" (
    set BAM="../bam/src/bam.exe"
    goto compile
)
if exist "../bam-0.2.0/src/bam.exe" (
    set BAM="../bam-0.2.0/src/bam.exe"
    goto compile
) else goto nobam
pause

:nobam
cls
echo.
echo [ERROR]No bam found!
echo.
pause >nul
exit

:: Compile
:compile
@echo === Building Teeworlds Server===
@call %BAM% server_release -j 4
@echo === Finished ===
echo.

:: Ending/Or not :D
echo Press any Key to Compile again...
pause >nul
color 0c
echo === Again :D ===
ping -n 2 localhost >nul
color 0a
cls
goto compile
exit

Just copy-paste it in a .bat file and run put the file in your sourcefolder.
Put bam.exe in C:\Windows\system32 and you can call it from everywhere.

Nice script. When I do something constantly, yea, I'll make a script. But I've just been compiling mods to help people upon request. So I might make my own.

Don't you need to add some other files to system32 too, cuz doesn't bam need some other stuff?

10

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Full Face Tee wrote:

Yes, but like I said. I'm lazy tongue
Nice script. When I do something constantly, yea, I'll make a script. But I've just been compiling mods to help people upon request. So I might make my own.

Don't you need to add some other files to system32 too, cuz doesn't bam need some other stuff?

You couldn't have said something more contradictory. You're lazy so you're not copying the line of code to a simple bat file that would allow you not to do it at each execution? That's anti-laziness.

Not Luck, Just Magic.

11

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Dune wrote:
Full Face Tee wrote:

Yes, but like I said. I'm lazy tongue
Nice script. When I do something constantly, yea, I'll make a script. But I've just been compiling mods to help people upon request. So I might make my own.

Don't you need to add some other files to system32 too, cuz doesn't bam need some other stuff?

You couldn't have said something more contradictory. You're lazy so you're not copying the line of code to a simple bat file that would allow you not to do it at each execution? That's anti-laziness.

No, I would call that the epitome of laziness lol
All in all, I love how everyone does what they do.
KEEP UP THE GREAT JOB GUYS!

12

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Bam doesn't need any additional files.
It's ok if you just use the executable file.
The other stuff in the bam folder is only the source and the objects, nothing more.

13

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Ok thanks all. ONE MORE QUESTION!

-- with x86 and x86_64 architectures, does bam handle that automatically? Cuz it's hard to tell cuz there is not verbose for like "oh, found you have a 64 bit OS, let's compile it for 64bit then" or like the executable name doesn't reflect the OS arch.

14

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

you need to compile bam for 64bit and then compile everything with this x64 bam.
If you use a 64bit commandline and the 32bit bam binary you wont be able to compile for x64, you need both the x64 bam and the x64 command line.

15

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

BotoX wrote:

you need to compile bam for 64bit and then compile everything with this x64 bam.
If you use a 64bit commandline and the 32bit bam binary you wont be able to compile for x64, you need both the x64 bam and the x64 command line.

Ok, that's what I figured. Thanks!!!!

16

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

dremy and Volibar, compiling, in a easy way to explain, is this:
http://img696.imageshack.us/img696/77/compiled.png

Playing Teeworlds since 2011!
"I will always be topless for you"
                  - Günther Branlutte

17 (edited by theanomaly 2012-06-11 22:33:49)

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

LOL in a nutshell.

18

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Looks like the compiler has destroyed the source files after compiling.
One-way-compiler. Nice Idea.

19

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

BotoX wrote:

Looks like the compiler has destroyed the source files after compiling.
One-way-compiler. Nice Idea.

It's semi-open source, one use only. Like disposable cameras :D

Not Luck, Just Magic.

20

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

BotoX wrote:

Looks like the compiler has destroyed the source files after compiling.
One-way-compiler. Nice Idea.

Well, looks like whoever made the graphic was just really lazy and just downloaded the source and then downloaded the release package tongue but a one way compiler would be nice. easy enough to do with an encrypted makefile

21 (edited by Dune 2012-06-12 19:09:28)

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Full Face Tee wrote:

Well, looks like whoever made the graphic was just really lazy and just downloaded the source and then downloaded the release package tongue but a one way compiler would be nice. easy enough to do with an encrypted makefile

True that, very few people need to test their binaries before releasing, not like the sources would be useful when you already have the binaries.

Not Luck, Just Magic.

22

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Dune wrote:

True that, very few people need to test their binaries before releasing, not like the sources would be useful when you already have the binaries.

Yup. What do people think about a linux tutorial too? Mainly need: a compilation of websites to get the needed packages.

23

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Full Face Tee wrote:
Dune wrote:

True that, very few people need to test their binaries before releasing, not like the sources would be useful when you already have the binaries.

Yup. What do people think about a linux tutorial too? Mainly need: a compilation of websites to get the needed packages.

Or just read the official documentation, nearly everything is copied from there.

Not Luck, Just Magic.

24

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

Dune wrote:

Or just read the official documentation, nearly everything is copied from there.

Well, some of them are real package names, others can't be found in the repos.

25

Re: [TUTORIAL] How to Compile Teeworlds Under Windows

HeroiAmarelo wrote:
cd c:\tws
c:\bam\bam release

You can try to use c:\bam\bam debug or just c:\bam\bam if you want to.

I have a problem....

If i type in the path of the tw source, everything works great, but then doesn't work and the other ones, too.  It says that i typed in soemthing wrong or that the command isn't avaible.

Thx