Compiling the source code

From Platinum Arts Sandbox Free 3D Game Maker
Revision as of 09:10, 13 June 2011 by Bhill (Talk | contribs) (MAC OSX)

Jump to: navigation, search

This page discusses on how to modify and compile the source code.

Windows

For windows compilation, we recommend Codeblocks + mingw
There are also MSVC project files, but unfortunately they are often out of date and unmaintained and we do not actively support them.


Codeblocks can be downloaded from here
Mingw can be downloaded from here (stable) and here (somewhat experimental). If prompted for DWARF2 or SILJ bindings, pick SILJ.

To compile go into src\windows and open the file named sandbox.cbp. This should start codeblocks.
if this is your first time, codeblocks will prompt you over which compiler to use, it should auto detect the presence of mingw under 'GNU compiler collection'. If not please make sure mingw is installed correctly.
To build the binaries, simply click the build button and codeblocks will take care of building everything.

Linux

Makefile

First of all, make sure you have the the SDL and SDL_Image and SDL_Mixer development libraries installed on your system. Next up, go into src folder. and type 'make install', you can replace 'install' any of the following

  • all - compiles client and server targets (see below)
  • libenet - compiles the enet library
  • clean - cleans up temporary files
  • client - builds enet and all clients
  • server - builds enet and all servers
  • install - builds the client and server targets (see the two above) and copies the produced binaries into ../bin/
  • distinstall - creates a directory named /usr/local/sandbox/, and copies everything into there. It then sets permissions and some symlinks, so you can play the game by typing 'sandbox' into a terminal.
  • distclean - deletes /usr/local/sandbox/

Debug

A debug file is already set up. Debug versions can be compiled by invoking...

  make -f Makefile.debug install

After this, simply run sandbox as normal with --debug at the end, for example...

    # this will load up gdb with the rpg's debug binary in windowed mode
   ./sandbox_unix -grpg --debug -t0
 
    # to stop the program at any time, use ctrl - C
    # to run the program, type this once gdb has started
    run
 
    # to get a backtrace once sandbox has crashed
    bt full
 
    # print a variable - also note you can type cast
    print variablename

We would strongly recommend that you get familiar with gdb and its commands if you intend to do debugging.

trouble shooting

sandbox cannot find 'SDL/*.h' files
Make sure that the SDL, SDL_mixer and SDL_image libraries are installed

enet fails to compile
If you see "./configure: /bin/sh^M: bad interpreter" use dos2unix to convert enet/configure
Otherwise invoke make -C enet distclean

if sandbox fails to compile for any other reason, do let us know

MAC OSX

To start, you should have Xcode installed on your computer. Either install the Developer tools from the OS X install disks that came with your computer, or download Xcode from the apple website: http://developer.apple.com/technology/xcode.html

Building the app for PPC and Intel macs differs from that point. Once you get Xcode running, stop there.

For PPC users only: Download SDL: http://www.libsdl.org/release/SDL-1.2.9.dmg Copy the SDL.framework folder to /Library/Frameworks

Download SDL_Image: http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.9.dmg Copy the SDL_image.framework folder to /Library/Frameworks

Download SDL_Mixer: http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.8.dmg Copy the SDL_mixer.framework folder to /Library/Frameworks

For Intel users only:

Download SDL from: http://www.libsdl.org/download-1.2.php

Download SDL_Image from: http://www.libsdl.org/projects/SDL_image/

Download SDL_Mixer from: http://www.libsdl.org/projects/SDL_mixer/

Put the .framework file for each into /Library/Frameworks

Download the latest Multiplatform.zip of Sandbox. Unzip and double click on PASX.X.Xmultiplatform/src/xcode/sandbox.xcodeproj

Xcode will open the project.

1. First remove the folder "Other Sources". When asked, only delete references and not the files themselves.

2. Right click(ctrl+click) and select "Add" then "New Group". This will make a new folder. Rename it to "Other Sources".

3. Now, right click(ctrl+click) on the new "Other Sources" and select "Add" then "Existing Files...", when asked add the folder "fpsgame".

4. Repeat that process for the folders "shared","enet",and "engine". Then go into "engine" and remove the reference to "master.cpp".

5. Now that we have our source updated, lets change the configuration to something better suited for us. Change 'Architectures' from "ppc i386" to your architecture (ppc for power pc and i386 for intel).

6. Go to the "Project" menu and click "Edit Project Settings". Find "Framework Search Paths" and add '/System/Library/Frameworks' (no slash on the end) and remove '$(USER_LIBRARY_DIR)/Frameworks/' as frameworks are not normally installed there. Put '/System/Library/Frameworks' first.

7. Exit the settings editor. Change the Active Build Configuration from Debug to Release. Click on build - the Binary should compile without.

By default the executables, launcher and sandbox, are created in the folder PASX.X.Xmultiplatform/src/xcode/build/Release/

Rename the PASX.X.Xmultiplatform folder to sandbox and move the compiled sandbox.app into the top level of that folder. The launcher.app should be on the same level, but outside, the renamed sandbox folder.

If you still have problems compiling, remove the folder includes inside enet.

--Popinman32 22:28, 6 August 2010 (UTC)

Maintained by Popinman32 and other MacOSX users.

FreeBSD

Unwritten