Author Topic: q3map2 support for Tremulous  (Read 10132 times)

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« on: December 05, 2006, 08:21:05 pm »
EDIT: This now applies to all OS's, including Windows!  Keep reading later posts to find out more.
EDIT: This patch is now included in GtkRadiant svn124

A follow-up to this thread: http://tremulous.net/phpBB2/viewtopic.php?t=2737 but I think this post needs its own thread.

I hacked together a quick patch for q3map2 to support the stand-alone version of Tremulous.  It still needs some tweaking, but I hope to have it finished by the end of the week.  Feel free to test it and report any bugs or help finish it.  This is a REQUIRED patch for Linux, Unix and MacOSX mappers!

http://ftp://mikec.homelinux.org/tremulous/q3map2-trem.zip

BTW, does anyone know what the heck a "magic path word" is and what it should be set to for Tremulous?


README-TREM.txt (included in the zip):
Code: [Select]

Tremulous standalone patch for q3map2 (beta version)
Mike Cerveny
LinuxManMikeC@gmail.com
5 December 2006

This is a patch to support standalone Tremulous in q3map2.  It is of course licensed under the terms of the GPL.  The changes in this patch were coded and tested with the q3map2 source from the GTKRadiant project, svn revision 122.  Though it would probably work, use caution when applying this patch to different versions of the source.

This patch will fix a problem of q3map2 being unable to find game resources in a Linux or Unix user's personal .tremulous directory.  The key motivation behind this patch is that I was unable to get liquid shaders located in my /home/mike/.tremulous/base/ directory to work because liquid shaders contain compile-time instructions, but q3map2 was defaulting to /home/mike/.q3a/baseq3/ and thus unable to find the needed shaders.  This is probably the cause of at least some of the reported "walk on water" bugs in the Tremulous mapping forum.

Affected OS's:
Linux (all)
Unix (all)
I'm sure MacOSX too (it is Unix!)

Included files:
game_tremulous.h   --  Derived from game_quake3.h
                       adds option "-game tremulous"
                       tells where to find ".tremulous" dir
                       couple other misc params set
q3map2.h           --  altered to include game_tremulous.h
README-TREM.txt    --  This file :-P

Patching instructions:
1 - Unzip into your q3map2 source code (In GTKRadiant source it is located under "tools/quake3/q3map2/")
2 - When unzipping allow the overwrite of q3map2.h
3 - Compile and enjoy!

TODO:
- Figure out what the heck a "magic path word" is.  Currently
set to "tremulous" for now.  Before this patch the compiler
used the Q3 setting of "quake" and this didn't seem to cause
a problem with Tremulous.  Changing it to "tremulous" didn't
seem to affect anything, but I still need to research this.
- Add additional tremulous-specific surfaceparams?  Doesn't
seem to bother q3map2.  Just throws a warning and sets the
surface params in the BSP?  Be nice to get rid of the warnings
by configuring it right.
- Any additional tweaks for Tremulous?
- Figure out how to make a proper patch file :-(
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

vcxzet

  • Guest
q3map2 support for Tremulous
« Reply #1 on: December 05, 2006, 09:13:11 pm »
what is it good for?

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #2 on: December 05, 2006, 11:12:31 pm »
:eek: ok.....

-delete- First of all, those of you who use Windows, pay no attention to this, this patch does not apply to you. -end delete-

EDIT: This now applies to all OS's, including Windows!  Keep reading later posts to find out more.

In Unix/Linux/MacOSX each user has their own directory to do with what they want.  Usually called a home directory (at least in Linux).  This is where a user's configuration files and data files are put.  So, on these platforms, Tremulous creates a directory for each user called ".tremulous" to store their configs and to put auto-downloaded PK3s into.  Now, following proper filesystem standards, you would probably have Tremulous installed in /usr/games/ or /usr/share/games/ or whatever.  These installation directories should not be modifiable by regular users, only root!  When you first start Tremulous it will create a directory something like this /home/usernamehere/.tremulous/  which will hold your personal configuration settings for Tremulous as well as any PK3s you auto-download.  This is also the directory you should be using when developing mods and maps for Tremulous.  Now, if you were making your own shader files (which any decent mapper would, even if you are using premade code) then you would have them in /home/usernamehere/.tremulous/base/scripts/mymap.shader.  Now, some of the shader commands are evaluated when you compile the BSP, so q3map2 needs to be able to find mymap.shader.  Without my patch, it will default to the Quake3 settings (which are compiled into q3map2 in the same way).  Q3map2 allows you to override where it looks for the game's install directory, but not the Unix user directory.  So, when compiling tremulous maps on *nix systems, it will default to /home/usernamehere/.q3a/ and be unable to find your shaders in /home/usernamehere/.tremulous/.  So any compile-time shader parameters, such as water, will be of no effect.  You would end up with what looks like water (all the render-time effects), but is a solid brush (compile-time effects).

Now most of the popular games that use the Q3 engine have similar code included in q3map2 so it can support them.  You use the -game switch to select which game you are mapping for when running the program from the command line.  Now it would be nice to add a switch that will override the user's game directory to help future projects, but seeing as how Tremulous has been around a bit it would be nice to have it compiled in.  Now I haven't asked if GTKRadiant would include this patch in their code.  If not, the Tremulous project could keep their own fork of q3map2 which includes this patch.

Again, if you use Windows, don't worry about it.  If you use any Unix-like OS (including MacOSX) you need this patch to save yourself some headaches.  Some noob mappers have been complaining about being able to "walk on water" when they try and put water in their maps.  This is most likely the cause of those problems if they were using a Unix-like OS.  In fact, this is how I discovered this problem.  I was following the instructions to the letter and still couldn't get water or lava to work.  Finally figured out it was a compile error and realized what was going on.

This does not affect the old Tremulous Q3 mod!  This does not affect you if you are working directly in your Tremulous install directory (usually Windows users).  If you are in Linux, Unix, or MacOSX you shouldn't be altering anything in your install directory (unless you were lazy and installed Tremulous to your home directory :roll:).
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

Odin

  • Spam Killer
  • *
  • Posts: 1767
  • Turrets: +113/-204
    • My Website
q3map2 support for Tremulous
« Reply #3 on: December 06, 2006, 12:38:48 am »
How exactly do we apply this patch to the latest GtkRadiant SVN?

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #4 on: December 06, 2006, 04:01:34 am »
By the way you stated the question I'm guessing you haven't used a patch file before.  It should have been a simple command of patch -u q3map2-trem.patch, but I went back and looked at it and it seems I (or svn) munged the patch file.  Can't seem to make a working patch file myself now.  Sorry, anyway, uploaded a new zip file to my server.  Just put my altered version of q3map2.h in there and clarified the instructions in the readme.

http://ftp://mikec.homelinux.org/tremulous/q3map2-trem.zip

Patching instructions:
1 - Unzip into your q3map2 source code (In GTKRadiant source it is located under "tools/quake3/q3map2/")
2 - When unzipping allow the overwrite of q3map2.h
3 - Compile and enjoy!


P.S.  Argh!!!  I was using a cheap editor!  Sorry if my line in q3map2.h offends your formatting style. :roll:  I'll fix it when I finalize some other stuff in my patch.
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

Odin

  • Spam Killer
  • *
  • Posts: 1767
  • Turrets: +113/-204
    • My Website
q3map2 support for Tremulous
« Reply #5 on: December 06, 2006, 05:41:20 am »
Actually I have used a patch file before, but not like that. However, I checked out the patch file and made the change to q3map2.h myself(as well as added the tremulous .h file). It compiled OK afterward.

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
Beta version #2!
« Reply #6 on: December 08, 2006, 05:16:58 am »
I have the second version of this patch ready.  In addition to solving the *nix user dir problem, this patch also gives q3map2 the ability to understand the "nobuild" shader parameters without the custinfoparams fix.  This patch is now usefull to all OS's.  You can download from the same place as always:
http://ftp://mikec.homelinux.org/tremulous/q3map2-trem.zip

I would appreciate if a few people would help in testing this patch.  *nix users, compile a map using a shader stored in /home/username/.tremulous/base/ that has compile-time parameters (like water or lava).  All OS's, please try using the nobuild shaders in common-trem and don't use the "-custinfoparams" switch when compiling.  Also, please try making your own shaders that test the nobuildsurface parameters.  And try rebuilding your own really cool maps with this patch to make sure nothing broke.

List of nobuild params:
noalienbuild
nohumanbuild
nobuild
noalienbuildsurface
nohumanbuildsurface
nobuildsurface


README-TREM.txt:
Code: [Select]

Tremulous standalone patch for q3map2 (2nd beta version)
Mike Cerveny
LinuxManMikeC@gmail.com


5 December 2006
---------------
This is a patch to support standalone Tremulous in q3map2.  It is of
course licensed under the terms of the GPL.  The changes in this patch
were coded and tested with the q3map2 source from the GTKRadiant project,
svn revision 122.  It should work fine with GTKRadiant revisions 119 (the
last change to q3map2) through 122.  Though it would probably work, use
caution when applying this patch to other versions of the source.

This patch will fix a problem of q3map2 being unable to find game
resources in a Linux or Unix user's personal .tremulous directory.  The
key motivation behind this patch is that I was unable to get liquid
shaders located in my /home/mike/.tremulous/base/ directory to work
because liquid shaders contain compile-time instructions, but q3map2 was
defaulting to /home/mike/.q3a/baseq3/ and thus unable to find the needed
shaders.  This is probably the cause of at least some of the reported
"walk on water" bugs in the Tremulous mapping forum.

7 December 2006
---------------
I was digging around for info about the nobuild shader params and found
out about the "-custinfoparams" workaround.  I found
scripts/custinfoparams.txt and added those parameters to the parameter
list in game_tremulous.h.  Now all you need to do is set "tremulous" as
the game when compiling to immediately have access to assets in your
/home/username/.tremulous/ directory (on *nix systems) and be able to use
the nobuild params in shaders.  This should make building maps cleaner and
easier for everyone.  After a little more testing and research this patch
should be ready to submit to the GTKRadiant project (if they want it).


Affected OS's:
Linux
Unix
MacOSX
And now Window$ too !!!


Included files:
game_tremulous.h   --  Derrived from game_quake3.h
                       adds option "-game tremulous"
                       unix home subdir set to ".tremulous"
                       added the "nobuild" params to the list
                         don't need "-custinfoparms" switch anymore :-)
                       couple other misc changes
q3map2.h           --  altered to include game_tremulous.h
README-TREM.txt    --  This file :-P


Patching instructions:
1 - Unzip into your q3map2 source code (In GTKRadiant source it is located
    under "tools/quake3/q3map2/")
2 - When unzipping allow the overwrite of q3map2.h
3 - Compile and enjoy!


Usage:
1 - Compile your maps using the "-game tremulous" switch (easy, ain't it?)
q3map2.x86 -game tremulous -fs_basepath "/usr/share/tremulous/" mymap.map
2 - Add whatever other options you feel are necessary for your map


TODO:
- Any more tweaks for Tremulous???
- Figure out how to make a proper patch file :-/  (I feel like such a
stooge, worked for me before)
- Finish testing and then submit to GTKRadiant (after I figure out the
patch file :-P )
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

gareth

  • Posts: 710
  • Turrets: +38/-89
q3map2 support for Tremulous
« Reply #7 on: December 08, 2006, 10:06:09 am »
stupidly named topic.

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
q3map2 support for Tremulous
« Reply #8 on: December 08, 2006, 10:20:37 am »
Quote from: "LinuxManMikeC"
By the way you stated the question I'm guessing you haven't used a patch file before.  It should have been a simple command of patch -u q3map2-trem.patch, but I went back and looked at it and it seems I (or svn) munged the patch file.  Can't seem to make a working patch file myself now.  Sorry, anyway, uploaded a new zip file to my server.  Just put my altered version of q3map2.h in there and clarified the instructions in the readme.
checkout the copy of svn, edit it to include your changes, then
Code: [Select]
svn add game_tremulous.h #do this for every file you added
svn diff > q3map2-trem.patch
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #9 on: December 08, 2006, 03:43:02 pm »
Quote from: "gareth"
stupidly named topic.

And what would you name it oh great and wise one? :P  If you're going to criticise at least suggest how to change it!
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #10 on: December 08, 2006, 04:38:14 pm »
Quote from: "kevlarman"
checkout the copy of svn, edit it to include your changes, then
Code: [Select]
svn add game_tremulous.h #do this for every file you added
svn diff > q3map2-trem.patch

Thanks for that.  I had been using svn diff to make the patch file, but I wasn't putting all my files under svn.  I only know enough about svn to be dangerous.  The real problem with my patch file turned out to be how I was running patch.  It should be:
Code: [Select]
patch -u < q3map2-trem.patchThat should teach me NOT to do this late at night.  :oops:
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #11 on: December 08, 2006, 05:50:14 pm »
OK, I have a proper patch file now and I updated the instructions in the readme.  Going to compile a few more test maps, but everything looks good here.  Still would like to get some more people to try the patch and report back.  If I don't get any bug reports or suggestions by Monday 8pm eastern time I will send it in to GtkRadiant.

http://ftp://mikec.homelinux.org/tremulous/q3map2-trem.zip



P.S.  Sorry if this counts as spam (3 in a row).  Moderators, let me know if it does and it won't happen again.
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

Odin

  • Spam Killer
  • *
  • Posts: 1767
  • Turrets: +113/-204
    • My Website
q3map2 support for Tremulous
« Reply #12 on: December 08, 2006, 07:20:17 pm »
Very nice LinuxManMikeC.

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #13 on: December 08, 2006, 09:20:11 pm »
Just got an announcement that GtkRadiant is now at revision 123.  No changes were made that affect q3map2.  This patch will work with revision 123.
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #14 on: December 13, 2006, 08:13:40 pm »
Submitted to GtkRadiant project.  Patch is included in svn 124.  Just download latest GtkRadiant from svn, compile, and enjoy.  Can also look for latest binary for your platform, but it isn't hard (at least on Linux) to build GtkRadiant.  Please report bugs, if found.
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

Ingar

  • Tremulous Developers
  • *
  • Posts: 554
  • Turrets: +302/-7
    • Ingar's projects on the Web
q3map2 support for Tremulous
« Reply #15 on: December 14, 2006, 06:36:51 pm »
This might be somewhat off-topic but I guess that the people who read this thread are the most likely to compile radiant themselves:
q3map2 dies with pthread_join failed if I use a x86_64 binary, a x86 build runs fine. Before I issue a bug report I'd like to know if others have this problem too.

LinuxManMikeC,
I installed revision 123 just a few days ago  :wink: , I hope to upgrade soon. I wasted a lot of time solving silly problems until I noticed the directory issues  8)

Baxter

  • Posts: 182
  • Turrets: +1/-2
    • http://z10.invisionfree.com/The_Evil_Empire/index.php?act=idx
q3map2 support for Tremulous
« Reply #16 on: February 09, 2007, 11:32:57 am »
it would be nice if someone told us
 how to compile q3map2
I use win32 and the command needs to be run in the command prompt right? because it doesnt work
Sometimes soon,maybe.]

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #17 on: February 10, 2007, 05:48:31 pm »
Well my changes are in the q3map2 source included with GtkRadiant.  You need Subversion to check out the source.  And you need to make sure you have all the required libraries and compile tools, which it sounds like you don't (at least not Scons).  There is a readme included with the source that lists the tools and libraries you need.  Start there and if you have futher questions just ask.
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

LinuxManMikeC

  • Posts: 125
  • Turrets: +0/-0
q3map2 support for Tremulous
« Reply #18 on: February 10, 2007, 05:52:41 pm »
Silly me... there is a more recent GtkRadiant binary for win32.  It should have my changes included.  Get it here: http://zerowing.idsoftware.com/files/radiant/nightly/1.5/GtkRadiant-1.5.0-RC1.msi
b]Embrace your inner penguin 8)
GtkRadiant Wiki (under construction)[/b]

GrooveMachine

  • Posts: 66
  • Turrets: +1/-0
    • Mac Freeware site
q3map2 support for Tremulous
« Reply #19 on: February 26, 2007, 03:09:19 am »
Is there one for Mac?
Computers are like air conditioners...they work until you open Windows!

Warrior

  • Posts: 230
  • Turrets: +2/-0
    • Warrior's Stuff
q3map2 support for Tremulous
« Reply #20 on: February 26, 2007, 04:01:38 am »
Quote from: "GrooveMachine"
Is there one for Mac?

http://tremulous.net/phpBB2/viewtopic.php?t=2179