Difference between revisions of "Windows Development"

From Armagetron
m (Updating code::blocks version.)
(Ditched svn, bent references over to 0.4.)
Line 21: Line 21:
 
== Satisfying Dependencies ==
 
== Satisfying Dependencies ==
  
Satisfying dependencies in Windows is very easy.  You just download the most recent release of the winlibs.zip file to build the trunk, generally.  Sometimes that won't work, such as when the trunk requires new libraries that aren't required by the most recent release.  If you're building from the trunk, you'll want to checkout the winlibs module from BZR or SVN to go along with the current sources.
+
Satisfying dependencies in Windows is very easy.  You just download the most recent release of the winlibs.zip file to build the trunk, generally.  Sometimes that won't work, such as when the trunk requires new libraries that aren't required by the most recent release.  If you're building from the 0.4, you'll want to checkout the winlibs module from BZR to go along with the current sources.
  
This is early to talk about checking out the source, but it's needed. The directory structure you need looks like this:
+
This is early to talk about checking out the source, but it's needed. The directory structure you need looks like this:
  
 
* Armagetron Project directory (you create it, you name it what you want)
 
* Armagetron Project directory (you create it, you name it what you want)
Line 29: Line 29:
 
** winlibs  (needs to be named exactly that)
 
** winlibs  (needs to be named exactly that)
  
You'll create this directory structure by either unzipping a source release and a winlibs archive, or by using subversion or bzr to checkout the two modules listed. For reference, the svn URIs for the modules are:
+
You'll create this directory structure by either unzipping a source release and a winlibs archive, or by using subversion or bzr to checkout the two modules listed.
  
 
*armagetronad
 
*armagetronad
**bzr: https://code.launchpad.net/~armagetronad-dev/armagetronad/trunk-armagetronad-work
+
**bzr: https://code.launchpad.net/~armagetronad-dev/armagetronad/0.4-armagetronad-work
**svn: https://armagetronad.svn.sourceforge.net/svnroot/armagetronad/armagetronad/trunk/armagetronad
 
 
*winlibs
 
*winlibs
**bzr: https://code.launchpad.net/~armagetronad-dev/armagetronad/trunk-winlibs-work
+
**bzr: https://code.launchpad.net/~armagetronad-dev/armagetronad/0.4-winlibs-work
**svn: https://armagetronad.svn.sourceforge.net/svnroot/armagetronad/armagetronad/trunk/winlibs
 
  
You will need to rename trunk-winlibs-work to winlibs if you get it over bzr.
+
You will need to rename 0.4-winlibs-work to winlibs if you get it over bzr.
  
That's all there is to it. You can also just check out the full trunk:
+
All that only works when someone actually cares about the Windows build process enough to keep it running. Most developers work on Unix or the Mac.
;https://armagetronad.svn.sourceforge.net/svnroot/armagetronad/armagetronad/trunk/winlibs
 
That will have everything side by side just as needed.
 
  
All that only works when someone actually cares about the Windows build process enough to keep it running. Most developers work on Unix or the Mac.
+
If you want trunk builds (much less likely to work), replace "0.4" with "trunk" in the above.
  
 
== Building Armagetron Advanced ==
 
== Building Armagetron Advanced ==

Revision as of 16:58, 17 December 2015

Here's straightforward instructions on how to set up a complete windows environment for building a distribution. If you just want to hack on the game, you only need these instructions up to big step 3. These are here to help newcomers to get into hacking the trunk quickly, but their also here to document how releases are built for windows.

There are 4 big steps, each comprising of many little steps. Each step is for building the trunk. Building a release tarball based on the trunk should follow logically from here, but may not. Consult specific release documentation for more information on building a release tarball, if it's there.

Installing the IDE

We use Code::Blocks. The trunk and 0.4 should be built with the latest available version (currently 13.12, probably best to stick to that one. Pre-sdl2 versions used 10.05).

0.2.8 builds are done with the ancient 1.0RC2; The original instructions can be found here.

To build and run the game, you will need Python and Code::Blocks. Code::Blocks itself requires MingW, and additional tools available from MingW will be needed to build the trunk. Here's a list, in no particular order.

  • Code::Blocks with mingw (best just install the combined package)
  • Python. 2.4 is known to work, as is 2.7.
  • NSIS is needed to build installers.
  • If you don't want to be restricted to building released, zipped sources, a way to fetch our current source. Two choices:
    • Subversion client. Tortoise-SVN gives you a nice GUI around SVN, but is considered optional. Note however that svn support on the trunk is on its way out and you should rather pick
    • bazaar. Again, Tortiose-BZR is a GUI you can use.
  • Old entry: "You'll need gcc, bison, and swig, at the very least to build the trunk. A release tarball may not need bison and swig." Z-Man can't remember installing bison, gcc is part of mingw which comes with code::blocks, and swig is not currently needed. So feel free to ignore this.

Satisfying Dependencies

Satisfying dependencies in Windows is very easy. You just download the most recent release of the winlibs.zip file to build the trunk, generally. Sometimes that won't work, such as when the trunk requires new libraries that aren't required by the most recent release. If you're building from the 0.4, you'll want to checkout the winlibs module from BZR to go along with the current sources.

This is early to talk about checking out the source, but it's needed. The directory structure you need looks like this:

  • Armagetron Project directory (you create it, you name it what you want)
    • armagetronad (can actually be named as you please and you can have multiple versions side by side)
    • winlibs (needs to be named exactly that)

You'll create this directory structure by either unzipping a source release and a winlibs archive, or by using subversion or bzr to checkout the two modules listed.

You will need to rename 0.4-winlibs-work to winlibs if you get it over bzr.

All that only works when someone actually cares about the Windows build process enough to keep it running. Most developers work on Unix or the Mac.

If you want trunk builds (much less likely to work), replace "0.4" with "trunk" in the above.

Building Armagetron Advanced

Building the game isn't as straightforward as the last step. Sorry. Here's what you do, assuming a fresh checkout:

  1. Run win32\update_version.bat (unless you build from a source zip, then that's already done)
  2. Run win32\protobuf.bat
  3. Start Code::Blocks
  4. Open win32\code_blocks\ArmagetronAd.workspace
  5. Build
  6. Run win32\makedist.bat

Now you should be able to play the game. The build is in build\dist, a debug version in build\debug.

Gotchas:

  • update_version.bat and makedist.bat both need to know where python is installed. The easiest way to deal with this is to put python in your path. In Windows 2000, right-click My Computer, select Properties. Go to the Advanced tab, and in the middle you have Environment Variables. Open that. Find the Path variable and edit it, by putting ";C:\Python24" on the end (if you used the default installation location. If you didn't, put the right path to python.exe).
  • Not running the batch files will result in tTrueVersion.h not being found while building. If you see that error, it's because you didn't run update_version.bat.
  • Sometimes, you'll get errors from compiling .rc files with complaints about an illegal version format. In that case, open up src\tTrueVersion.h and edit the last line, it needs to read "MAJOR_VERSION a,b,c,d" where a to d are numbers (not starting with 0 unless they are 0) between 0 and 65535. Just get it to that form somehow.

Building a Self-Extracting Installer

  1. Download and install NSIS http://nsis.sourceforge.net/Download
  2. Right-click on the .nsis files in build/dist, select "Build NSIS Installer"
  3. There are two .nsis files in there, one for the client, one for the server

Troubleshooting

If you want to build older versions of armagetronad in current Code::Blocks (tested with 0.2.8.2 branch and 0.3_alpha8870, target dedicated) in Windows you may have this errors:

  • src/defs.h:105: error: new declaration `bool isblank(int)': in file armagetronad\src\defs.h change:
    • inline bool isblank(int x){ return ((x == ' ') || (x == '\t')); } to //inline bool isblank(int x){ return ((x == ' ') || (x == '\t')); }

In other words, comment the line. This function doesn't seem to exist in Windows or Solaris 2.8.

Further errors for those builds can be fixed by following various suggestions in this forum thread.

Video Tutorials

There are links to the video tutorials, specifically made for sty+ct, shown below:

Part 1: http://www.youtube.com/watch?v=20dU1vcxEsE

Part 2: http://www.youtube.com/watch?v=lCC6W6MLKPE

These video tutorials are provided by LOVER$BOY