Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
JFDuke3D on Linux with OpenGL & hires textures HOWTO
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gamers & Players
View previous topic :: View next topic  
Author Message
Stygius
n00b
n00b


Joined: 27 Apr 2002
Posts: 16

PostPosted: Wed Apr 06, 2005 7:05 pm    Post subject: JFDuke3D on Linux with OpenGL & hires textures HOWTO Reply with quote

Update 2005-07-05 This tutorial may be considered obsolete in light of the ebuild below

Introduction
----
I'm really a fan of Icculus, but due to the many projects on his plate (as he once put it), it seems to me he seldom adds features to his linux ports of games after he gets them working. The Duke3D port is one example - as far as I know, there is no support for Ken Silverman's Polymost OpenGL renderer, no in-game console or friendly resolution configuration menus, or similar features.

Jonathan Fowler's Windows Duke3D port however, has all these features, and support for high-resolution textures and 3D models as well. I recently discovered that this port can be made to work in Linux, missing none of the features of the Windows version. Here is my attempt at a HOWTO to get it running, including post-install configuration.

Note: the port runs natively on Linux. No Cedega/Wine involved.

Screenshot 1, Screenshot 2, Screenshot 3

What you need
-----
* libsdl and all other libraries that the duke3d ebuild depends on
* fmod, a sound library (emerge fmod)
* The data file 'duke3d.grp' (filename MUST be lower-case) from the original game (install the original game using dosbox or similar to get it)
* Build Port Source 20041013 (stable) from http://jonof.edgenetwork.org/index.php?p=downloads&cat=0 (buildport_src_20041013.zip)
* JFDuke3D Source 20041013 (stable) from http://jonof.edgenetwork.org/index.php?p=downloads&cat=1 (jfduke3d_src_20041013.zip)
* Unofficial patch to enable sound. It is found in the attachment to the first post of this forum thread: http://forums.3drealms.com/ubbthreads/showflat.php?Cat=&Board=dukesource&Number=744388 (the filename is <number>-jfduke3d_src_20041013-linux.zip)
* Duke3D High resolution pack from http://www.planetduke.com/hrp/download.htm (Dn3d_hrp-2005-04-04.exe)
* Wine, to unpack the aforementioned high-res pack
* Preferably, a high-end graphics card like GeForce4 Ti and above

Getting started
------
Put all the source files listed above in some temporary directory, then execute the following commands:
Code:
mkdir jfduke
cd jfduke
unzip ../buildport_src_20041013.zip
unzip ../jfduke3d_src_20041013.zip
mv buildport_src_20041013 build
cd jfduke3d_src_20041013
unzip ../../*-jfduke3d_src_20041013-linux.zip
patch -p1 < jfduke3d_src_20041013-linux.diff

Press enter when prompted for any choice. After that, it's time to compile:
Code:
make

You should now have a 'duke3d' executable in your working directory - copy it somewhere:
Code:
cp duke3d ~/bin/duke3d.jonof


Put 'duke3d.grp' in a directory of your choosing (for me, it will be ~/gamefiles/duke3d/). Time to unpack the high-res stuff:
Code:
wine Dn3d_hrp-2005-04-04.exe

[select only the High-res pack, uncheck everything else when prompted]
Code:
cp ~/.wine/fake_windows/<selected install path>/duke3d_hrp.zip ~/gamefiles/duke3d/
cd ~/gamefiles/duke3d/


run the game:

Code:
~/bin/duke3d.jonof /gduke3d_hrp.zip


...and enjoy high-res Duke! You can run the game with the original textures and sprites by dropping the '/gduke3d_hrp.zip' command-line option.

Sound configuration

----
I have found the following configuration options provide adequate sound, but feel free to experiment on you own. Put these in DUKE3D.CFG in the directory where the data files are:
Code:
[Sound Setup]
FXVolume = 232
MusicVolume = 56
SoundToggle = 1
VoiceToggle = 1
AmbienceToggle = 1
MusicToggle = 1
ReverseStereo = 0
FXDevice = 1
MusicDevice = 1
MixRate = 44100


Running total conversions (TCs)
------
You can run pretty much any Duke3D total conversion using this port. I highly recommend Sunstorm's commercial add-ons (Duke it out in DC, Caribbean Life's a Beach and Nuclear Winter) as well as community-developed ones such as Platoon, Starship Troopers and Ages in Time. Installation can be a bit tricky, but in general involves putting all TC data files in a zip and loading them with the '/g<filename>' command-line option. Here's a site that provides some hints on getting the Sunstorm add-ons to work.

Shadow Warrior
----
As some of you might have noticed, 3D Realms has released the Shadow Warrior source code under the terms of the GPL. Since Jonathan helped 3DR package this release, he quickly released a modern port of this classic shooter with OpenGL support. It can also be made to work under Linux, but it has two major issues:
* no sound
* the mouse pointer is not grabbed by the game, making mouselook impossible

When these issues are taken care of, I might do a HOWTO on getting that to work as well (if there is any interest, that is)


Last edited by Stygius on Mon Jul 04, 2005 10:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
tom61
Tux's lil' helper
Tux's lil' helper


Joined: 07 Jan 2005
Posts: 111

PostPosted: Wed Apr 06, 2005 9:29 pm    Post subject: Reply with quote

Anyone going to make an ebuild for this?
Back to top
View user's profile Send private message
Stygius
n00b
n00b


Joined: 27 Apr 2002
Posts: 16

PostPosted: Wed Apr 06, 2005 9:44 pm    Post subject: Reply with quote

tom61 wrote:
Anyone going to make an ebuild for this?

Yeah, I might throw one together when the next stable release comes out. The author is currently working on a new version which will hopefully include new cross-platform sound code and netplay support.

So keep an eye on this thread - I'll probably post it here or link to the bugzilla entry or something :)
Back to top
View user's profile Send private message
Stygius
n00b
n00b


Joined: 27 Apr 2002
Posts: 16

PostPosted: Tue Jun 07, 2005 4:52 pm    Post subject: Reply with quote

Update 2005-08-16 Added timidity as a USE keyword.
Update 2005-07-04 Added some dependencies into RDEPEND which were mentioned in this thread.

Here's an ebuild for the latest version of JonoF's Duke3D port.

Name the ebuild exactly as specified, and put it $PORTDIR_OVERLAY/games-fps/jfduke3d/. To run, you need a copy of the Duke3D content file (duke3d.grp) in the current working directory.

This is submitted on an "it works for me"-basis. Feedback is appreciated, however...

jfduke3d-20050531.ebuild:
Code:
# $Header: $

inherit eutils games

DESCRIPTION="Jonathon Fowler's Duke3D port"
HOMEPAGE="http://jonof.edgenetwork.org/?p=${PN}"
SRC_URI="http://members.iinet.net.au.nyud.net:8090/~jonof/${PN}_src_${PV}.zip
http://members.iinet.net.au.nyud.net:8090/~jonof/jfbuild_src_${PV}.zip
http://www.mephisto.ma.cx/mephisto/patches/${PN}_src_${PV}-sound.patch"
RESTRICT="nomirror"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="timidity"

RDEPEND=">=media-libs/libsdl-1.2.7
   >=media-libs/sdl-mixer-1.2.5
   >=media-libs/smpeg-0.4
   >=media-libs/libogg-1.1
   >=x11-libs/gtk+-2.4
   >=sys-libs/slang-1.4.9
   timidity? (
                media-sound/timidity++
                media-sound/timidity-eawpatches
                )
   virtual/x11
   virtual/opengl"
DEPEND="${RDEPEND}
   >=dev-lang/nasm-0.98.38
   >=sys-devel/gcc-3.3.5"

S="${WORKDIR}"

src_unpack() {
   unpack ${A}
   cd ${S}
   epatch ${DISTDIR}/${PN}_src_${PV}-sound.patch
   mv jfbuild_src_${PV} build
}

src_compile() {
   cd ${S}/${PN}_src_${PV}
   emake
}

src_install() {
   newgamesbin ${S}/${PN}_src_${PV}/duke3d jfduke3d
   dodoc ${S}/${PN}_src_${PV}/readme.txt
   dohtml ${S}/${PN}_src_${PV}/releasenotes.html

   prepgamesdirs
}

pkg_postinst() {
        games_pkg_postinst
        einfo "Put duke3d.grp in current working directory"
        einfo "and type 'jfduke3d' to run"
}


It's fairly non-trivial to edit the configuration file (DUKE3D.CFG) to make mouselook and OpenGL work properly. Hence, I provide a few lines from my own configuration file to get you started:

DUKE3D.CFG:
Code:
[Screen Setup]
Shadows = 0
Password = ""
Detail = 1
Tilt = 1
Messages = 1
Out = 0
ScreenWidth = 1024
ScreenHeight = 768
ScreenMode = 1
ScreenBPP = 32
GLUseTextureCompr = 1
ScreenSize = 8
ScreenGamma = 0
GLAnisotropy = 1
GLTextureMode = 3

[Sound Setup]
FXVolume = 232
MusicVolume = 56
SoundToggle = 1
VoiceToggle = 1
AmbienceToggle = 1
MusicToggle = 1
ReverseStereo = 0
FXDevice = 1
MusicDevice = 1
MixRate = 44100

[Controls]
MouseAimingFlipped = 1
MouseAiming = 0
AimingFlag = 1
RunKeyBehaviour = 0
AutoAim = 0
MouseButton0 = "Fire"
MouseButtonClicked0 = ""
MouseButton1 = "Strafe"
MouseButtonClicked1 = ""
MouseButton2 = "Move_Forward"
MouseButtonClicked2 = ""
MouseButton3 = ""
MouseButtonClicked3 = ""
MouseButton4 = ""
MouseButton5 = ""
MouseAnalogAxes0 = "analog_turning"
MouseDigitalAxes0_0 = ""
MouseDigitalAxes0_1 = ""
MouseAnalogScale0 = 65536
MouseAnalogAxes1 = "analog_moving"
MouseDigitalAxes1_0 = ""
MouseDigitalAxes1_1 = ""
MouseAnalogScale1 = 65536
MouseSensitivity = 24576

[KeyDefinitions]
Move_Forward = "E" "Kpad8"
Move_Backward = "D" "Kpad2"
Turn_Left = "Left" "Kpad4"
Turn_Right = "Right" "Kpad6"
Strafe = "LAlt" "RAlt"
Fire = "LCtrl" "RCtrl"
Open = "Q" "Unknwn"
Run = "LShift" "RShift"
AutoRun = "CapLck" "Unknwn"
Jump = "Space" "/"
Crouch = "X" "Unknwn"
Look_Up = "PgUp" "Kpad9"
Look_Down = "PgDn" "Kpad3"
Look_Left = "Insert" "Kpad0"
Look_Right = "Delete" "Kpad."
Strafe_Left = "S" "Unknwn"
Strafe_Right = "F" "Unknwn"
Aim_Up = "Home" "Kpad7"
Aim_Down = "End" "Kpad1"
Weapon_1 = "1" "Unknwn"
Weapon_2 = "2" "Unknwn"
Weapon_3 = "3" "Unknwn"
Weapon_4 = "4" "Unknwn"
Weapon_5 = "5" "Unknwn"
Weapon_6 = "6" "Unknwn"
Weapon_7 = "7" "Unknwn"
Weapon_8 = "8" "Unknwn"
Weapon_9 = "9" "Unknwn"
Weapon_10 = "0" "Unknwn"
Inventory = "Enter" "KpdEnt"
Inventory_Left = "[" "Unknwn"
Inventory_Right = "]" "Unknwn"
Holo_Duke = "H" "Unknwn"
Jetpack = "J" "Unknwn"
NightVision = "N" "Unknwn"
MedKit = "M" "Unknwn"
TurnAround = "BakSpc" "Unknwn"
SendMessage = "T" "Unknwn"
Map = "Tab" "Unknwn"
Shrink_Screen = "-" "Kpad-"
Enlarge_Screen = "=" "Kpad+"
Center_View = "Unknwn" "Unknwn"
Holster_Weapon = "ScrLck" "Unknwn"
Show_Opponents_Weapon = "W" "Unknwn"
Map_Follow_Mode = "F" "Unknwn"
See_Coop_View = "K" "Unknwn"
Mouse_Aiming = "U" "Unknwn"
Toggle_Crosshair = "I" "Unknwn"
Steroids = "R" "Unknwn"
Quick_Kick = "`" "Unknwn"
Next_Weapon = "'" "Unknwn"
Previous_Weapon = ";" "Unknwn"
Show_Console = "NumLck" "Unknwn"


Last edited by Stygius on Tue Aug 16, 2005 9:49 am; edited 4 times in total
Back to top
View user's profile Send private message
dapsaille
Advocate
Advocate


Joined: 02 Aug 2004
Posts: 2366
Location: Paris

PostPosted: Mon Jun 20, 2005 6:24 pm    Post subject: Reply with quote

Many thanks to you guy ..

It is really cool to play duke in opengl :p and your ebuild work perfectly for me :p

EDIT=How can i have the 3d modesl like on the first screenshot please ?
EDIT 2= I haven't the musics is this normal ?
Back to top
View user's profile Send private message
Stygius
n00b
n00b


Joined: 27 Apr 2002
Posts: 16

PostPosted: Mon Jun 20, 2005 11:27 pm    Post subject: Reply with quote

First, regarding (lack of) music. Apparently, the sound patch that is applied at build time uses Timidity through sdl_mixer for playing midi. Hence, this should do the trick:
Code:
emerge timidity++ timidity-eawpatches

Note, however, that timidity uses a lot of CPU since it plays midi in software. From time to time, I have searched of a way to make it use the native midi capability in the soundcard, but I haven't found one yet.

Second, regarding having 3D models in the latest version of jfduke3d. For some reason, jfduke3d-20050531 does not work very well with the latest high resolution pack. Textures are misplaced and some 3D models are missing. If you want to try it anyway, download the pack and run
Code:
wine Dn3d_hrp-2005-04-04.exe

Choose to extract all files somewhere, then copy the two zip files named duke3d_hrp.zip and hacks.zip into the same directory as your duke3d.grp file. Then run
Code:
jfduke3d /gduke3d_hrp.zip /ghacks.zip


Update 2005-08-16 Beta versions of the HRP, which largely fix the problems outlined above, can be found at this site.

People reading this thread may also be interested in the Shadow Warrior ebuild I posted in this thread.


Last edited by Stygius on Tue Aug 16, 2005 9:41 am; edited 1 time in total
Back to top
View user's profile Send private message
dapsaille
Advocate
Advocate


Joined: 02 Aug 2004
Posts: 2366
Location: Paris

PostPosted: Tue Jun 21, 2005 4:15 pm    Post subject: Reply with quote

Thanks for you reply ... ok timidity ..

Maybee it 'cause of it that i have no sound in jdoom :p

Ok i bump to your Shadow warrio thread yeeepeeee :p Thanks again
Back to top
View user's profile Send private message
Stygius
n00b
n00b


Joined: 27 Apr 2002
Posts: 16

PostPosted: Tue Jun 21, 2005 7:22 pm    Post subject: Reply with quote

Actually, you can specify any midi player (hardware or software) for use in JDoom, by setting the environment variable DENG_MIDI_CMD properly (timidity is the default). This is the functionality I've been searching for in sdl_mixer.

Let's say you have a midi-capable sound card, and you have loaded a soundfont:
Code:
asfxload /usr/share/sounds/sf2/soundfont.sf2

Then you can run JDoom with native midi, which uses very little CPU:
Code:
DENG_MIDI_CMD="pmidi -p 65:0" jdoom

(emerge pmidi first if appropriate)

I'm hoping something similar will be supported in jfsw and jfduke3d soon. New sound code is on the way, in any case.
Back to top
View user's profile Send private message
rotux
n00b
n00b


Joined: 23 Dec 2003
Posts: 72

PostPosted: Thu Aug 11, 2005 11:53 am    Post subject: Reply with quote

any chance of getting this to compile on amd64?
source/game.c:1: error: CPU you selected does not support x86-64 instruction set
Back to top
View user's profile Send private message
Stygius
n00b
n00b


Joined: 27 Apr 2002
Posts: 16

PostPosted: Tue Aug 16, 2005 9:37 am    Post subject: Reply with quote

Apparently, neither this port of Duke3D, nor any other port, compiles/runs on "pure" AMD64 (or any other 64-bit platform for that matter). There are potential problems in the Build engine. JFDuke creator JonoF has this to say on the matter:
Quote:
[To work on AMD64] we'd need to verify that code that's expecting to operate on 4-byte data is using an 'int' type.

I take this to imply that AMD64 is feasible in the long term, but that some code needs to be rewritten.
Back to top
View user's profile Send private message
thepi
Guru
Guru


Joined: 06 Jan 2004
Posts: 352
Location: Tokyo, Japan

PostPosted: Thu Feb 16, 2006 1:47 pm    Post subject: Internationalization issue Reply with quote

If you're encountering the following error:
Code:
blah.def:121: expecting float, got ".575"

jfduke3d fails to correctly read the floats from any .def files. This is the case when you have LC_NUMERIC set to a language code where something other than "." is the delimiter for floating points (i.e. in german, it's ","). Adding
Code:

export LC_NUMERIC="C"
to the jfduke startup script helps out on that one. I added a slightly improved wrapper script to the Bug report, which also contains some rudimentary HRP detection.

Took me some time to figure that one out, so I added it here for others having a similar problem :)

Edit: I don't know whether this is a bug or what it's caused by, but if I don't place duke3d.grp in my $HOME/.jfduke3d directory, jfduke won't find it. I checked the permissions on /usr/share/games/duke3d/duke3d.grp, they should all be fine (owned by games group, r-x for group and world). This is also happens with
Code:
jfduke3d-bin /g/usr/share/games/duke3d/duke3d.grp
so it's not related to the wrapper script. Any Ideas?

Regards,
pi~
_________________
Violence is the last resort of the incompetent --Isaac Asimov
Gentoo on Acer TM800 | Help! | Vote! | Get FF!
Back to top
View user's profile Send private message
MadEgg
l33t
l33t


Joined: 06 Jun 2002
Posts: 678
Location: Netherlands

PostPosted: Fri May 18, 2007 5:01 am    Post subject: Reply with quote

I don't know if anyone is interested but the ebuild here no longer works as there a new version has been released a few months after that one(long ago now but anyway), 20051009. So I changed the ebuild, found the new patches and stuff.

Here it is:

jfduke3d-20051009.ebuild
Code:

# $Header: $

inherit eutils games

DESCRIPTION="Jonathon Fowler's Duke3D port"
HOMEPAGE="http://jonof.edgenetwork.org/?p=${PN}"
SRC_URI="http://jonof.edgenetwork.org/dl/buildport/${PN}_src_${PV}.zip
http://jonof.edgenetwork.org/dl/buildport/jfbuild_src_${PV}.zip
http://www.mephisto.ma.cx/mephisto/patches/jfbuild_src_${PV}.patch
http://www.mephisto.ma.cx/mephisto/patches/${PN}_src_${PV}.patch"
RESTRICT="nomirror"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE="timidity"

RDEPEND=">=media-libs/libsdl-1.2.7
   >=media-libs/sdl-mixer-1.2.5
   >=media-libs/smpeg-0.4
   >=media-libs/libogg-1.1
   >=x11-libs/gtk+-2.4
   >=sys-libs/slang-1.4.9
   timidity? (
                media-sound/timidity++
                media-sound/timidity-eawpatches
                )
   x11-base/xorg-x11
   virtual/opengl"
DEPEND="${RDEPEND}
   >=dev-lang/nasm-0.98.38
   >=sys-devel/gcc-3.3.5"

S="${WORKDIR}"

src_unpack() {
   unpack ${A}
   cd ${S}
   einfo "eerstepatch"
   epatch ${DISTDIR}/${PN}_src_${PV}.patch
   einfo "hernoemen"
   mv jfbuild_src_${PV} build
   einfo "gaannaar"
   cd build
   epatch ${DISTDIR}/jfbuild_src_${PV}.patch
}

src_compile() {
   cd ${S}/${PN}_src_${PV}
   emake
}

src_install() {
   newgamesbin ${S}/${PN}_src_${PV}/duke3d jfduke3d
   dodoc ${S}/${PN}_src_${PV}/readme.txt
   dohtml ${S}/${PN}_src_${PV}/releasenotes.html

   prepgamesdirs
}

pkg_postinst() {
        games_pkg_postinst
        einfo "Put duke3d.grp in current working directory"
        einfo "and type 'jfduke3d' to run"
}

_________________
Pentium 4 Prescott 3,2 GHz
Asus P4P800 SE, i865PE chipset
1024 MB PC3200 RAM
AOpen Aeolus GeForce 6800 Ultra 256 MB DDR2
Creative Audigy2 ZS
gentoo-sources-2.6.20-r7
nVidia-drivers version 9755
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gamers & Players All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum