Building EDuke32 on Linux: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
 
(62 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{Distribution intro}}
= Compiling From Source =
= Compiling From Source =


== Installation Notes ==
== Installation Notes ==
* You need an actual copy of Duke Nukem 3D. The shareware version can be found [http://www.3drealms.com/duke3d/ here]
* You need an actual copy of Duke Nukem 3D. See [[Installation and configuration]].
* Proper 3D acceleration drivers. NVIDIA has classically had the best Linux drivers.
* 3D acceleration drivers (recommended). NVIDIA has classically had the best Linux drivers.
* Proper MIDI install. The EDuke32 will appear to "randomly" crash without one. Use ''timidity'' for an easy software midi solution.
* A MIDI device or player for the soundtrack (optional). By default, the game uses TinySoundFont for loading sound fonts, and Nuked OPL3 for OPL emulation. It's possible to use an external MIDI device or player for Duke Nukem 3D via an ALSA MIDI port.


== Getting source files ==
== Getting source files ==
* Current version (You need to install the ''subversion'' program) :
 
<pre>svn co https://eduke32.svn.sourceforge.net/svnroot/eduke32/polymer/eduke32</pre>
:''See [[Acquiring the EDuke32 Source Code]].''
* [http://dukeworld.duke4.net/eduke32/synthesis Source tarballs] (Lite subversion, it does not include metadata, Apple compiled libraries, third-party jaudiolib and Photoshop files).
* [http://dukeworld.duke4.net/eduke32/old_versions/source_code/ Older versions].


== Prerequisites for the build ==
== Prerequisites for the build ==
EDuke32 requires some development files installed before you can properly build.
EDuke32 requires some development files installed before you can properly build.
* Basic dev environment (GCC >= 4.3.3, make, etc)
* Nasm (optional)
* Lib SDL >= 1.2.10 '''or''' 1.3
* Lib SDL Mixer > 1.2.6
* Lib stdc++
* Lib Vorbis >= 1.1.2
* Lib PNG >= 1.2.13 (optional)
* Lib GTK+ >= 2.8.0 (optional)
<u>On Debian / Ubuntu</u>
<pre>sudo apt-get install build-essential libsdl1.2-dev libsdl-mixer1.2-dev nasm libstdc++6-4.4-dev libpng12-dev libgtk2.0-dev</pre>


<u>On Fedora 14</u>
===Packages===
<pre>sudo yum install SDL-devel SDL_mixer SDL_mixer-devel SDL_image-devel nasm libstdc++-devel libstdc++-static libpng-devel</pre>


== Build the EDuke32 ==
* Basic dev environment (GCC >= 6.1, GNU make, etc)
In a terminal window move to the EDuke32 sources folder and type <code>make</code>.
* SDL2 >= 2.0 (SDL >= 1.2.10 also supported with SDL_TARGET=1)


NOTE: with eduke32_src_20080924 and older GCC versions (< 4.3) remove; <code>-finline-small-functions -fpredictive-commoning</code> options from <code>debug=</code> options in <code>eduke32/Makefile</code> and <code>build/Makefile</code>.  Newer source releases do not have this problem.
====Optional Packages====


NOTE2:
* NASM (recommended for i686/32-bit compilation to speed up the 8-bit classic software renderer in some cases)
* libGL (required for OpenGL renderers)
* libgtk2.0 >= 2.8.0 (required for the startup window)
* libFLAC >= 1.2.1 (required for lossless music packs)
* libvpx >= 0.9.0 (required for intro videos and cutscenes in some user-created modifications)


If building fails with GCC version 4.4.X, try: <code>make OPTLEVEL=0</code>
===Distro-Specific Installation===


If it fails again, you can try with another version of GCC, for example: <code>make CC=gcc-4.3</code>
====On Debian / Ubuntu====
{| class="wikitable"
|<code>sudo apt-get install build-essential nasm libgl1-mesa-dev libsdl2-dev flac libflac-dev libvpx-dev libgtk2.0-dev freepats</code>
|}


== Build options ==
====On Fedora 22-25====
It is possible to define some options when building. Just add them before or after the 'make' command.
{| class="wikitable"
|<code>sudo dnf groupinstall "Development Tools"</code>
|}
{| class="wikitable"
|<code>sudo dnf install g++ nasm mesa-libGL-devel SDL2-devel alsa-lib-devel libvpx-devel gtk2-devel flac flac-devel</code>
|}
Freepats is not packaged in Fedora, you must download and install it by yourself if desired. See also the "timidity-patch-freepats" package on others RPM based distros.


Example: <code>make USE_LIBPNG=1</code>
== Build EDuke32 ==
 
In a terminal window move to the EDuke32 sources folder and type <code>make</code>.
<u>Various options</u>
 
<table class=wikitable width=45%>
<tr>
<th>Options</th>
<th>Description</th>
<th>Default value</th>
</tr>
 
<tr>
<td>PRETTY_OUTPUT</td>
<td>use colored output</td>
<td>1</td>
</tr>
</table>
 
<u>Engine options</u>
 
<table class=wikitable width=45%>
<tr>
<th>Options</th>
<th>Description</th>
<th>Default value</th>
</tr>
 
<tr>
<td>USE_OPENGL</td>
<td>enables basic OpenGL Polymost renderer</td>
<td>1</td>
</tr>
 
<tr>
<td>POLYMER</td>
<td>enables fancy Polymer renderer</td>
<td>1</td>
</tr>
 
<tr>
<td>NOASM</td>
<td>disables the use of inline assembly pragmas</td>
<td>0</td>
</tr>
 
<tr>
<td>LINKED_GTK</td>
<td>enables compile-time linkage to GTK</td>
<td>0</td>
</tr>
 
<tr>
<td>BUILD32_ON_64</td>
<td></td>
<td>0</td>
</tr>


<tr>
=== Build options ===
<td>NEDMALLOC</td>
It is possible to define some options during the build. Just add them before or after the 'make' command.
<td></td>
<td>0</td>
</tr>


<tr>
Example: <code>make RELEASE=0</code>
<td>USE_LIBPNG</td>
<td>compile with libpng (used to make screenshots in the PNG format)</td>
<td>0</td>
</tr>
</table>


<u>Debugging/Build options</u>
{|class="wikitable" width="65%"
|+ <span style="text-decoration: underline">Various options</span>
|-
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
|-
|PRETTY_OUTPUT||Use colored output.||1
|}


<table class=wikitable width=45%>
{|class="wikitable" width="65%"
<tr>
|+ <span style="text-decoration: underline">Engine options</span>
<th>Options</th>
|-
<th>Description</th>
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
<th>Default value</th>
|-
</tr>
|USE_OPENGL||Enable basic OpenGL Polymost renderer.||1
|-
|POLYMER||Enable modern Polymer renderer for great justice.||1
|-
|NOASM||Disable the use of the ASM code for the classic renderer. Should be enabled on 32-bit [http://en.wikipedia.org/wiki/Pentium_compatible_processor Pentium compatible processors] only.||0 (ASM is disabled for x86_64 automatically because the ASM is 32-bit.)
|-
|HAVE_GTK2||Enable run-time linkage to GTK+.||1
|-
|STARTUP_WINDOW||Enable the startup window.||1
|-
|USE_LIBVPX||VP8 video codec used as an alternative to the ANM file format (only works if compiled with the OpenGL support).||1
|}


<tr>
{|class="wikitable" width="65%"
<td>RELEASE</td>
|+ <span style="text-decoration: underline">Debugging and Build options</span>
<td>no debugging</td>
|-
<td>1</td>
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
</tr>
|-
|CLANG||Use the Clang compiler instead of the default GCC.||0
|-
|RELEASE||No debugging.||1
|-
|FORCEDEBUG||Include debug symbols even when generating release code.<br/>Additionally, with RELEASE=0, the following arrays are allocated statically: spriteext, spritesmooth, sector, wall, sprite, tsprite, while necessarily disabling the clipshape feature (because it relies on setting sector/wall to different malloc'd block temporarily). Really only useful with CC=clang.||0
|-
|KRANDDEBUG||Include logging of krand() calls for debugging the demo system.||0
|-
|MICROPROFILE||Include a profiler that is connected to the CON VM. Provides statistics on how much processing time different CON events took in a specific time interval. To use it, launch the game and open a browser to the address "localhost:1338". This will display a snapshot of the last N milliseconds of measurements that were taken just before the page was requested. See also: https://github.com/zeux/microprofile ||0
|}


<tr>
{|class="wikitable" width="65%"
<td>DEBUGANYWAY</td>
|+ <span style="text-decoration: underline">Optimization options</span>
<td>include debug symbols even when generating release code</td>
|-
<td>0</td>
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
</tr>
|-
 
|OPTLEVEL||GCC optimization strategy. Values above 2 can cause crashes.||2
<tr>
|-
<td>KRANDDEBUG</td>
|LTO||Enable link-time optimization, for GCC 4.5 and up.||1
<td>include logging of krand() calls for debugging the demo system</td>
|-
<td>0</td>
|OPTOPT||Define options specific to the CPU architecture.||empty (except for i686)
</tr>
|-
 
|CUSTOMOPT||Custom options or optimizations, parameters defined here, are sent to both compiler and linker.||empty
<tr>
|-
<td>EFENCE</td>
|}
<td>compile with Electric Fence for malloc() debugging</td>
<td>0</td>
</tr>
 
<tr>
<td>OPTLEVEL</td>
<td>GCC optimization strategy</td>
<td>2</td>
</tr>
 
<tr>
<td>PROFILER</td>
<td></td>
<td>0</td>
</tr>
 
<tr>
<td>MUDFLAP</td>
<td></td>
<td>0</td>
</tr>
 
<tr>
<td>LTO</td>
<td>enable link-time optimization, for GCC 4.5 and up</td>
<td>0</td>
</tr>
</table>


== Confirm successful compile ==
== Confirm successful compile ==
These files should now be present in the EDuke32 directory.
These files should now be present in the EDuke32 directory:
* mapster32.sym (this file doesn't seem to be created in newer versions)
* eduke32, the binary to launch the game.
* mapster32 (executable)
* mapster32, the binary to launch the maps editor.
* eduke32.sym (this file doesn't seem to be created in newer versions)
* eduke32 (exectuable)


== Use the game files ==
= Run the game! =
You need to have the original Duke Nukem files and the newly created EDuke32 executables in the same place. So, you could create a new folder (example eduke32_linux) and copy the original game files and the newly created EDuke32 executables there.
You need to have the original Duke Nukem 3D files and the newly created EDuke32 executables in the same place. So, you could create a new folder (example eduke32_linux) and copy the original game files and the newly created EDuke32 executables there.


== Run the game! ==
To run the game open up a terminal window, move to the proper directory and type :
To run the game open up a terminal window, move to the proper directory and type :


<pre>./eduke32</pre>
<pre>./eduke32</pre>
* To use the [http://hrp.duke4.net High Resolution Pack] you need to pass the -g parameter :
* To use the [http://hrp.duke4.net Polymost High Resolution Pack] you can pass the -grp parameter :
<pre>./eduke32 -g duke3d_hrp.zip hrp_update.zip maphacks.zip eduke32_mus.zip</pre>
<pre>./eduke32 -grp duke3d_hrp.zip polymost_hrp_update-*.zip</pre>


* To use the [http://hrp.duke4.net Polymer HRP] you need to pass the -g parameter :
* To use the [http://hrp.duke4.net Polymer HRP] you can pass the -grp parameter :
<pre>./eduke32 -g polymer_hrp.zip polymer_upd.zip polymer_mhk.zip eduke32_mus.zip</pre>
<pre>./eduke32 -grp polymer_hrp.zip polymer_upd.zip</pre>
Note that ''polymer_upd.zip'' may not be available. It is also possbile to add additional packs such as remade music and Z-Pack.


* Using the autoload folder :
* Using the autoload folder :
Line 199: Line 135:
Installing EDuke32 as an application that you could run anywhere brings some useful advantages and is surprisingly easy to do.
Installing EDuke32 as an application that you could run anywhere brings some useful advantages and is surprisingly easy to do.


EDuke32 will use the directory you are currently in as the directory to work in, as well as ~/.eduke32 (/home/yourname/.eduke32). This means that you could have a directory, copy a Duke Nukem TC (or mod) in there, cd to that directory and run the global EDuke32 binary without having to make even more copies of the same EDuke32 binaries. EDuke32 will adapt to use the GAME/USER.CON files it finds in the CURRENT directory.
EDuke32 will use the directory you are currently in as the directory to work in, as well as ~/.config/eduke32 (/home/<username>/.config/eduke32). This means that you could have a directory, copy a Duke Nukem TC (or mod) in there, cd to that directory and run the global EDuke32 binary without having to make even more copies of the same EDuke32 binaries. EDuke32 will adapt to use the GAME/USER.CON files it finds in the CURRENT directory.


== How ==
== How ==
All you'll have to do to get EDuke32 to run from anywhere is copy the eduke32 and mapster32 binaries to /usr/local/bin. After doing this, copy the ''duke3d.grp'' file to /usr/local/share/games/eduke32 or ~/.eduke32 (it's hidden, so try to cd to it or show hidden files). After this you'll be able to run EDuke32 from any directory on your hard disk!
All you'll have to do to get EDuke32 to run from anywhere is copy the eduke32 and mapster32 binaries to /usr/local/bin. After doing this, copy the ''duke3d.grp'' file to /usr/local/share/games/eduke32 or ~/.config/eduke32 (it's hidden, so try to cd to it or show hidden files). After this you'll be able to run EDuke32 from any directory on your hard disk!


= Notes =
= Notes =
Line 217: Line 153:
== Running with HRP Notes ==
== Running with HRP Notes ==
If you want to run Polymer with the HRP you will need to provide the path to polymer_hrp.zip (even if its installed globally):
If you want to run Polymer with the HRP you will need to provide the path to polymer_hrp.zip (even if its installed globally):
<code>eduke32 -g /path/to/polymer_hrp.zip</code>.
<code>eduke32 -g/path/to/polymer_hrp.zip</code>.


Running EDuke32 with an ATI card is slow for some users.
Running EDuke32 with an ATI card is slow for some users.
One user has had success with a Radeon 4850 and Fedora 12 with the open source default driver plus the latest Mesa experimental - the game runs smooth and pretty fast.
One user has had success with a Radeon 4850 and Fedora 12 with the open source default driver plus the latest Mesa experimental - the game runs smooth and pretty fast.
[[Category:Distribution documentation]]

Latest revision as of 18:45, 2 June 2022

EDuke32 Distribution

Download · Source Code · APT repository · Packages
Building from source on: Linux · Windows · macOS


Compiling From Source

Installation Notes

  • You need an actual copy of Duke Nukem 3D. See Installation and configuration.
  • 3D acceleration drivers (recommended). NVIDIA has classically had the best Linux drivers.
  • A MIDI device or player for the soundtrack (optional). By default, the game uses TinySoundFont for loading sound fonts, and Nuked OPL3 for OPL emulation. It's possible to use an external MIDI device or player for Duke Nukem 3D via an ALSA MIDI port.

Getting source files

See Acquiring the EDuke32 Source Code.

Prerequisites for the build

EDuke32 requires some development files installed before you can properly build.

Packages

  • Basic dev environment (GCC >= 6.1, GNU make, etc)
  • SDL2 >= 2.0 (SDL >= 1.2.10 also supported with SDL_TARGET=1)

Optional Packages

  • NASM (recommended for i686/32-bit compilation to speed up the 8-bit classic software renderer in some cases)
  • libGL (required for OpenGL renderers)
  • libgtk2.0 >= 2.8.0 (required for the startup window)
  • libFLAC >= 1.2.1 (required for lossless music packs)
  • libvpx >= 0.9.0 (required for intro videos and cutscenes in some user-created modifications)

Distro-Specific Installation

On Debian / Ubuntu

sudo apt-get install build-essential nasm libgl1-mesa-dev libsdl2-dev flac libflac-dev libvpx-dev libgtk2.0-dev freepats

On Fedora 22-25

sudo dnf groupinstall "Development Tools"
sudo dnf install g++ nasm mesa-libGL-devel SDL2-devel alsa-lib-devel libvpx-devel gtk2-devel flac flac-devel

Freepats is not packaged in Fedora, you must download and install it by yourself if desired. See also the "timidity-patch-freepats" package on others RPM based distros.

Build EDuke32

In a terminal window move to the EDuke32 sources folder and type make.

Build options

It is possible to define some options during the build. Just add them before or after the 'make' command.

Example: make RELEASE=0

Various options
Options Description Default value
PRETTY_OUTPUT Use colored output. 1
Engine options
Options Description Default value
USE_OPENGL Enable basic OpenGL Polymost renderer. 1
POLYMER Enable modern Polymer renderer for great justice. 1
NOASM Disable the use of the ASM code for the classic renderer. Should be enabled on 32-bit Pentium compatible processors only. 0 (ASM is disabled for x86_64 automatically because the ASM is 32-bit.)
HAVE_GTK2 Enable run-time linkage to GTK+. 1
STARTUP_WINDOW Enable the startup window. 1
USE_LIBVPX VP8 video codec used as an alternative to the ANM file format (only works if compiled with the OpenGL support). 1
Debugging and Build options
Options Description Default value
CLANG Use the Clang compiler instead of the default GCC. 0
RELEASE No debugging. 1
FORCEDEBUG Include debug symbols even when generating release code.
Additionally, with RELEASE=0, the following arrays are allocated statically: spriteext, spritesmooth, sector, wall, sprite, tsprite, while necessarily disabling the clipshape feature (because it relies on setting sector/wall to different malloc'd block temporarily). Really only useful with CC=clang.
0
KRANDDEBUG Include logging of krand() calls for debugging the demo system. 0
MICROPROFILE Include a profiler that is connected to the CON VM. Provides statistics on how much processing time different CON events took in a specific time interval. To use it, launch the game and open a browser to the address "localhost:1338". This will display a snapshot of the last N milliseconds of measurements that were taken just before the page was requested. See also: https://github.com/zeux/microprofile 0
Optimization options
Options Description Default value
OPTLEVEL GCC optimization strategy. Values above 2 can cause crashes. 2
LTO Enable link-time optimization, for GCC 4.5 and up. 1
OPTOPT Define options specific to the CPU architecture. empty (except for i686)
CUSTOMOPT Custom options or optimizations, parameters defined here, are sent to both compiler and linker. empty

Confirm successful compile

These files should now be present in the EDuke32 directory:

  • eduke32, the binary to launch the game.
  • mapster32, the binary to launch the maps editor.

Run the game!

You need to have the original Duke Nukem 3D files and the newly created EDuke32 executables in the same place. So, you could create a new folder (example eduke32_linux) and copy the original game files and the newly created EDuke32 executables there.

To run the game open up a terminal window, move to the proper directory and type :

./eduke32
./eduke32 -grp duke3d_hrp.zip polymost_hrp_update-*.zip
  • To use the Polymer HRP you can pass the -grp parameter :
./eduke32 -grp polymer_hrp.zip polymer_upd.zip

Note that polymer_upd.zip may not be available. It is also possbile to add additional packs such as remade music and Z-Pack.

  • Using the autoload folder :

Copy mods or HRP files in the $HOME/.eduke32/autoload folder and it will be automaticaly loaded without additional parameters.

Installing EDuke32 globally

Why

Installing EDuke32 as an application that you could run anywhere brings some useful advantages and is surprisingly easy to do.

EDuke32 will use the directory you are currently in as the directory to work in, as well as ~/.config/eduke32 (/home/<username>/.config/eduke32). This means that you could have a directory, copy a Duke Nukem TC (or mod) in there, cd to that directory and run the global EDuke32 binary without having to make even more copies of the same EDuke32 binaries. EDuke32 will adapt to use the GAME/USER.CON files it finds in the CURRENT directory.

How

All you'll have to do to get EDuke32 to run from anywhere is copy the eduke32 and mapster32 binaries to /usr/local/bin. After doing this, copy the duke3d.grp file to /usr/local/share/games/eduke32 or ~/.config/eduke32 (it's hidden, so try to cd to it or show hidden files). After this you'll be able to run EDuke32 from any directory on your hard disk!

Notes

Lowercase/Uppercase problems

Maps with extra resources Some maps that include extra resources might have trouble finding these new files (for example, an older version of Duke Plus won't be able to find Step#.wav and Grate#.wav sounds). The EDuke32 log will output a "file not found" error every time this happens. To fix this, change the names of these files to match the exact case given in EDuke32's log (for example, GRATE#.wav instead of Grate#.wav).

ART file inconsistency While most standard resources are referred to as UPPERCASE by EDuke32 (for example, GAME.CON), ART files are not as consistent and should be renamed to lowercase if you want to use custom art (tiles014.art instead of TILES014.ART).

Running with HRP Notes

If you want to run Polymer with the HRP you will need to provide the path to polymer_hrp.zip (even if its installed globally): eduke32 -g/path/to/polymer_hrp.zip.

Running EDuke32 with an ATI card is slow for some users. One user has had success with a Radeon 4850 and Fedora 12 with the open source default driver plus the latest Mesa experimental - the game runs smooth and pretty fast.