[comp.sources.bugs] NetHack Woes

billw@killer.UUCP (12/07/87)

When, when, oh when will someone finally make nethack REALLY work on a System
V machine?

At 1.4, I hacked on nethack to try to get it running on killer, a 3B2 that
at the time was on system V release 2.0.5 (we've since upgraded to 3.1).
At the time, I beat up mercilessly on termcap.c for an hour or so and the
program pretty much worked.

termcap.c is still a mess. Whomever claimed that the program does, indeed
function if TERMINFO is defined has rocks in his head. I have to go through
the file and change half of the tgetwhatever calls because the wrong 2-letter
ID codes are used. The delay_output is a joke (1.4 just printed the string
$<50> instead of padding) which should not even be there for System V users:
terminfo has a delay_output built in.

Well, I have actually gotten it do compile. I have to manually set the value
of XD to a linefeed, since cursor down doesn't work (seems to do a return
instead) and xd isn't even known to terminfo. Let's give nethack a try.

Looks fine for about ten seconds. Then you start to REALLY abuse the program:
you try to move. Forget about a nicely-formatted screen. And I seem to know
what all of my objects are. Identify? Who needs it? I rather strongly doubt
that this is a new 'feature' in 2.2.

My next bitch, pardon my Francais, may be a perfectly legitimate bug. When
I walk into my dog, I see "You stop to avoid hitting ." Certainly not the
most meaningful output in such a situation.

Well, I'm done ranting at the various people who's put their two cents worth
into the game. I'm sure all the new mods are quite nice, but I'm damned if I
can use them.

A plea to Mike Stephenson: please, PLEASE! get a real, working compile-time
option for System V.

A plea to anyone who has compiled this monster on a 3B2: hello, friend.. let's
talk. Really. My address will be right beneath the dotted line --
-- 
Bill Wisner, HASA "A" Division		..{codas,ihnp4}!killer!billw
"I am not an economist. I am an honest man."

brothers@who.rutgers.edu (Laurence R. Brothers) (12/08/87)

I've noticed the dogname bug too, but I'm running Sun Unix 4.2, which
is pretty much BSD. Furthermore, whether or not TERMINFO is defined,
vt52 and visual 200 terminals cause a crash in termcap.c with a null
pointer (SO, to be exact). Fortunately the program otherwise works
well on vt100 and the sun consoles (!). 

By the way, have you noticed a bug in HACKOPTIONS? Segmentation error
if dogname is in the variable.... It seems the dogs code is kind of
screwed up in addition to termcap....
-- 
			 Laurence R. Brothers
		      brothers@paul.rutgers.edu
            {anywhere}!rutgers!paul.rutgers.edu!brothers
 "Whistling in the dark is not the method of true philosophy. - W. v. O. Quine"

roynh@ihlpg.ATT.COM (Harkness) (12/08/87)

In article <2361@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>When, when, oh when will someone finally make nethack REALLY work on a System
>V machine?
A good question. I am reletively new to the new and having just recently
picked up a 3b1 in the fire sale, I was happy when I say nethack with
a Makefile "for the AT&T Unix PC using shared libraries".  A good joke.
after making normal adjustments to the makefile so that it would fit
on my system, I tried a 'make all'. it got down to makedefs in the 
complile and then hung. for over an hour. I have 50k of ouput from
'make lint'. It will be a while before I decide to wade through it.


>A plea to Mike Stephenson: please, PLEASE! get a real, working compile-time
>option for System V.
This would be welcome by me too. I was curious as to what nethack was
like as a game - I've never played any version of it, not even rogue -
I guess I will be curious for a while.
>
>A plea to anyone who has compiled this monster on a 3B2: hello, friend.. let's
>talk. Really. My address will be right beneath the dotted line --
>-- 
>Bill Wisner, HASA "A" Division		..{codas,ihnp4}!killer!billw
>"I am not an economist. I am an honest man."
I am not familier with a 3b2, but maybe it is close enough to a 3b1 for us
to talk

Roy Harkness			ihnp4!ihlpg!roynh
AT&T Bell Labs			---------------------------------------
Naperville Il.			a version of unix called SYSTEM V

ericb@hplsla.HP.COM (Eric Backus) (12/09/87)

I just can't let this complaint go by.

My machine  runs HP-UX,  which is System V with some added  features.  I
was  thoroughly  impressed  by how easy it was to get  NetHack  running.
There is over a  megabyte  of source  code  here,  designed  on  various
different  computers,  and the  designers  probably have never even seen
HP-UX!  Mike and the rest have done an outstanding job.

I, too, ran into the '$<50>'  problem.  I don't know what the  'correct'
solution  should be, but I have a nap routine which is like sleep except
it does millisecond delays.  I put this instead of the old stuff:
	fflush(stdout);
	nap(50);
and now it works fine.  If anyone out there want this nap  routine,  let
me know.  Other than the  '$<50>'  problem,  my screen  looks just fine.
Note that even if you leave the code as-is, you can define  'nonull'  in
your HACKOPTIONS to avoid the messy output.

I had to comment out the 'extern' part of the declaration of 'ospeed' in
termcap.c.  I don't  know  why, but it  works.  This is the  ONLY  other
change I had to make to termcap.c.

I ran into the 'You stop to avoid hitting .'  problem, too.  I solved it
by removing  the block of code that stops you from  hitting your dog.  I
believe that this code should be removed anyway, since immediately after
it there is some code that will ASK you if you  really  want to do that.
I don't like being  absolutely  prevented  from  hitting my dog, even if
it's unlucky to do it.  Here's a context diff if anyone's interested:

*** fight.c.orig	Mon Dec  7 02:11:10 1987
--- fight.c	Mon Dec  7 02:12:07 1987
***************
*** 460,465
  	 * There is protection only if you're not blind, confused or
  	 * invisible.
  	 */
  	/*  changes by wwp 5/16/85 */
  	if (!Blind && !Confusion && !Hallucination
  	    && mdat->mlet == 'd' && mtmp->mtame) {

--- 460,466 -----
  	 * There is protection only if you're not blind, confused or
  	 * invisible.
  	 */
+ #ifdef	unused
  	/*  changes by wwp 5/16/85 */
  	if (!Blind && !Confusion && !Hallucination
  	    && mdat->mlet == 'd' && mtmp->mtame) {
***************
*** 472,477
  		    pline("You stop to avoid hitting your dog.");
  		return(TRUE);
  	}
  	if (flags.confirm && (mtmp->mpeaceful || mtmp->mtame) && ! Confusion
  	    && !Hallucination && !Invisible)
  

--- 473,479 -----
  		    pline("You stop to avoid hitting your dog.");
  		return(TRUE);
  	}
+ #endif	unused
  	if (flags.confirm && (mtmp->mpeaceful || mtmp->mtame) && ! Confusion
  	    && !Hallucination && !Invisible)



I also had a problem with rnd.c.  It uses 'random()' rather than 'rand()',
which I believe is a bug.  The file config.h sets up a definition of 'rand()'
appropriate for whatever version of UNIX you have.  Here's a context diff
if anyone's interested:

*** rnd.c.orig	Mon Dec  7 01:06:33 1987
--- rnd.c	Mon Dec  7 01:06:48 1987
***************
*** 2,8
   */
  #include	"config.h"
  #ifdef UNIX
! #define RND(x)	(random() % (x))
  #else
  /* Good luck: the bottom order bits are cyclic. */
  #define RND(x)	((rand()>>3) % (x))

--- 2,8 -----
   */
  #include	"config.h"
  #ifdef UNIX
! #define RND(x)	(rand() % (x))
  #else
  /* Good luck: the bottom order bits are cyclic. */
  #define RND(x)	((rand()>>3) % (x))



Finally, I have a couple minor bug reports/enhancement requests:

1)  Currently, the Makefile sets up the nethack directory as readable by
    anyone.  This seems like it encourages people to copy save files, to
    read the rumors  file, and to do a 'strings  nethack'  to figure out
    what's  going on.  On my machine, I make the nethack  directory  and
    all files in it unreadable.  The file  /usr/games/nethack,  which is
    the shell  script  that  starts  the game, must then be given  04755
    mode, and /usr/games/lib/nethack/nethack needs only 0750 mode.

2)  When a shell escape is done, or when an external  pager is called to
    look at the help files, SIGQUIT is left ignored.  This is minor, but
    it's  incorrect.  When the  mailer  is called  for a scroll of mail,
    SIGHUP and SIGINT are left ignored.  This, too, is incorrect.

3)  When I ask  nethack  what an 'r' is, it says it's a  rockmole.  It's
    also a rat sometimes.  The same may be true for kobolds also.

4)  The code that  absolutely  prevents you from hitting your dog should
    be removed,  leaving the code that asks for  confirmation  (and uses
    the HACKOPTION confirm).

			      - Eric Backus
				ihnp4!{hplabs|harpo}!hp-pcd!hplsla!ericb
				(206) 335-2495

alex@umbc3.UMD.EDU (Alex S. Crain) (12/09/87)

In article <4435@ihlpg.ATT.COM> roynh@ihlpg.UUCP (55315-Harkness,R.N.) writes:
>In article <2361@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>>When, when, oh when will someone finally make nethack REALLY work on a System
>>V machine?
>A good question. I am reletively new to the new and having just recently
>picked up a 3b1 in the fire sale, I was happy when I say nethack with
>a Makefile "for the AT&T Unix PC using shared libraries".  A good joke.

Umm...Forgive me for my lack of sympathy but...I configured the config.h file,
used the Makefile.unix, ran make, took the optimizer off of three files that
had long-branch assembly errors, added extern to a variable to termcap.c
(ospeed, it was ifndefed TERMINFO, and I declared TERMINFO in config.h, and
it made without a hitch. all on a 3b1 running sys5.31. If you like I can send 
or post the config.h and Makefile.

						:alex.
alex@umbc3.umd.edu

billw@killer.UUCP (Bill Wisner) (12/10/87)

Let me clarify. When I said System V machines, I meant non-3B1s. Those are
obviously supported; but has anybody goten it running on a 3B2? 3B5? 3B20?
-- 
Bill Wisner, HASA "A" Division		..{codas,ihnp4}!killer!billw
"This novel is not to be tossed lightly aside, but to be hurled with great
force." -- Dorothy Parker

billw@killer.UUCP (Bill Wisner) (12/10/87)

System V's curses package ahs its own delay_character routine, making the one
in termcap.c redundant. I just hid the entire routine and it seems to work.
I still have big problems with cursor movement, though..
-- 
Bill Wisner, HASA "A" Division		..{codas,ihnp4}!killer!billw
"This novel is not to be tossed lightly aside, but to be hurled with great
force." -- Dorothy Parker

grubin@tramp.Colorado.EDU (Rick Grubin) (12/11/87)

In article <2394@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>Let me clarify. When I said System V machines, I meant non-3B1s. Those are
>obviously supported; but has anybody goten it running on a 3B2? 3B5? 3B20?
>-- 
>Bill Wisner, HASA "A" Division		..{codas,ihnp4}!killer!billw

Yes, we have it running on a 3B2 with SysV r3.1.  As an earlier post by
my friend said, it took us 3 people and two nights to fix some bugs and
to make a Berkeley-esque termcap work (contrary to the Makefile, curses
will NOT work) with this thing.  But it is working.  Just a few more
bugs to fix (like why zapping wands leave trails of `L' on the screen)
and all will be OK.

I (we) would suggest that you look at the config.h file very closely, as
clues in there will help you fix most problems.

And if you name your dog, you will see the message "You stop to avoid
hitting dog-name" instead of the ".", even without the fix to fight.c.


Rick Grubin, Academic Computing Services, University of Colorado, Boulder
                        grubin@tramp.Colorado.EDU
           ...{nbires,hao,seismo,ihnp4}!boulder!tramp!grubin
                                       

rdj@ttrdf.UUCP (Robert D. Jackson) (12/11/87)

In article <2394@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>Let me clarify. When I said System V machines, I meant non-3B1s. Those are
>obviously supported; but has anybody goten it running on a 3B2? 3B5? 3B20?

How about an Amdahl running System V Release 2?  I got it to
compile, but it core dumps right after you select your character!

-- 
Bob Jackson  (rdj@ttrdf)  312-982-3578
AT&T Information Systems
Computer Systems Division, 5555 Touhy Ave., Skokie, IL  60077
PATH:  ...!ihnp4!ttrdf!rdj

rapin@bnrmtv.UUCP (Eric Rapin) (12/15/87)

In article <313@ttrdf.UUCP>, rdj@ttrdf.UUCP (Robert D. Jackson) writes:
> How about an Amdahl running System V Release 2?  I got it to
> compile, but it core dumps right after you select your character!
> 
> Bob Jackson  (rdj@ttrdf)  312-982-3578
> AT&T Information Systems
> Computer Systems Division, 5555 Touhy Ave., Skokie, IL  60077
> PATH:  ...!ihnp4!ttrdf!rdj

I had the same thing happen to me after I made the simple change
of deleting the "external" part of the "ospeed" declaration,
it core dumps after selecting the character. Still haven't played hack
since March...oh woe is me :')


-- 
Eric B. Rapin		     UUCP: {3comvax,amdahl,ames,csi,hplabs}!bnrmtv!rapin
Bell-Northern Research, Inc. ARPA: bnrmtv!rapin@ames.arpa
Mountain View, California    Work: 415-940-2826 - can leave messages at both
			     Home: 408-737-2171 - numbers

allbery@ncoast.UUCP (Brandon Allbery) (12/15/87)

As quoted from <4435@ihlpg.ATT.COM> by roynh@ihlpg.ATT.COM (Harkness):
+---------------
| In article <2361@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
| >When, when, oh when will someone finally make nethack REALLY work on a System
| >V machine?
| A good question. I am reletively new to the new and having just recently
| picked up a 3b1 in the fire sale, I was happy when I say nethack with
| a Makefile "for the AT&T Unix PC using shared libraries".  A good joke.
+---------------

I would suspect you botched the changes; the Makefile ran perfectly on my
system.  The only problems were apply.c and shknam.c, both of which were
bitten by an apparent bug in the 3B1 C compiler; I had to cc -S both these
files and change a "br.b" instruction to a "br.w" for them to assemble.
The executable works fine.  (I may send out diffs for GRAPHICS under Unix,
via the alternate character set support in terminfo; of course, the diffs
will include diffs to get it working under System V....)

+---------------
| >A plea to anyone who has compiled this monster on a 3B2: hello, friend.. let's
| >talk. Really. My address will be right beneath the dotted line --
| 
| I am not familier with a 3b2, but maybe it is close enough to a 3b1 for us
| to talk
+---------------

They aren't; believe me, they aren't.  I just helped a friend get a 3B2/310
going and 3B1 experience helped not one bit.
-- 
Brandon S. Allbery		      necntc!ncoast!allbery@harvard.harvard.edu
 {hoptoad,harvard!necntc,cbosgd,sun!mandrill!hal,uunet!hnsurg3}!ncoast!allbery
			Moderator of comp.sources.misc

still@usceast.UUCP (Bert Still) (12/16/87)

In article <2394@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>Let me clarify. When I said System V machines, I meant non-3B1s. Those are
>obviously supported; but has anybody goten it running on a 3B2? 3B5? 3B20?
>-- 
>Bill Wisner, HASA "A" Division		..{codas,ihnp4}!killer!billw

	I didn't have much of a problem. It took me about 20 minutes to take
care of a problem in the case when TERMINFO is defined. At least under System
V release 2, the termcap routines are in the curses library. So, I modified
the config.h files to define TERMINFO, removed the #ifndef TERMINFO clause
around the definition of ospeed in termcap.c, and changed the "bs" attribute
to read "kb" which is the attribute in the System V terminfo database. The
thing compiled and runs without a hitch on my 3B2/300.
	Incidentally, the "You stop to avoid hitting ." problem occurs
because the dog has not been given a name (somebody forgot to initialize a
field); if you 'C' the little dog something (Spot, for example :-) then the
message will read "You stop to avaoid hitting Spot." As soon as I figure out
what I need to initialize, I'll post the answer.

					Bert

UUCP: ...seismo!ncr-sd!ncrcae!usceast!still
CSNET:   still@cs.scarolina.edu
BITNET:  T410119@UNIVSCVM (truncates things at column 80)
Bert Still, Dept of Math, University of South Carolina, Columbia, SC 29208

ronald@csuchico.EDU (Ronald Cole) (12/17/87)

In article <2394@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>Let me clarify. When I said System V machines, I meant non-3B1s. Those are
>obviously supported; but has anybody goten it running on a 3B2? 3B5? 3B20?

I have gotten it to compile on an AT&T 3B5 and it runs fine!!  Wish I could
say the same for NetQuest...
Send me Email if you want context diffs, if I get enough requests, I'll post
to the net.

-- 
Ronald Cole				| uucp:     ihnp4!csun!csuchico!ronald
AT&T 3B5 System Manager			| PhoneNet: ronald@csuchico.edu
California State University, Chico	| voice     (916) 895-4635
	"... and if you don't like it, you must lump it." -Joseph Smith

brian@bucc2.UUCP (12/17/87)

> Let me clarify. When I said System V machines, I meant non-3B1s. Those are
> obviously supported; but has anybody goten it running on a 3B2? 3B5? 3B20?

  I got it running at both the 3B15 and the 3B5 here at Bradley University
with almost no problems at all... of course on the 3B5 the linker dies if
I try to compile with the -g option...


...............................................................................

  When the going gets weird, the weird turn pro.
						       { bucs1!brian
  Brian Michael Wendt	 {uiucdcs,cepu,ihnp4}!bradley! {       brian
 						       { bucc2!brian

idall@augean.OZ (Ian Dall) (12/22/87)

In article <3394@sigi.Colorado.EDU> grubin@tramp.Colorado.EDU (Rick Grubin) writes:
>Just a few more
>bugs to fix (like why zapping wands leave trails of `L' on the screen)
>and all will be OK.
>
I had a similar problem porting Hack (NOT NetHack) to SysV. The problem was
that even using the termcap compatibility functions, padding characters are
specified differently with terminfo. Consequently characters which would
specify padding characters just get sent to the screen when using terminfo.

The padding characters are used to cause flights of arrows, blazes of fire,
bolts of cold etc to take a definite time (50ms per space I think).

I don't have the sources or the documentation to hand but I seem to recall
it involved putting angle brackets round some digits in a character string
argument to "tputs".



-- 
 Ian Dall           "In any argument there will be people on your
                     side who you wish were on the other side."
idall@augean.oz

apc@cblpe.ATT.COM (Alan Curtis) (12/22/87)

In article <630@umbc3.UMD.EDU> alex@umbc3.UMD.EDU (Alex S. Crain) writes:
>In article <4435@ihlpg.ATT.COM> roynh@ihlpg.UUCP (55315-Harkness,R.N.) writes:
>>In article <2361@killer.UUCP> billw@killer.UUCP (Bill Wisner) writes:
>>>When, when, oh when will someone finally make nethack REALLY work on a System
>>>V machine?
>>A good question. I am reletively new to the new and having just recently
>>picked up a 3b1 in the fire sale, I was happy when I say nethack with
>>a Makefile "for the AT&T Unix PC using shared libraries".  A good joke.
>
>Umm...Forgive me for my lack of sympathy but...I configured the config.h file,
>used the Makefile.unix, ran make, took the optimizer off of three files that
>had long-branch assembly errors, added extern to a variable to termcap.c
>(ospeed, it was ifndefed TERMINFO, and I declared TERMINFO in config.h, and
>it made without a hitch. all on a 3b1 running sys5.31. If you like I can send 
>or post the config.h and Makefile.
>
>						:alex.
>alex@umbc3.umd.edu

The in the next article which I don't know how to read in to THIS followup
someone states that "of course you could do that on a 3b1, but what
about ....."

I have done exactly the mentioned above things and nethack works for me
(and my distracted group) on a 3b20 and an amdahl-big_thing.
Save I din't have to remove the optimization of any file.
I was quite impressed by how well it did compile on these machines.

I even have a new-make makefile if anyone out there wants that...

--
        This space intentionally left          | Alan P. Curtis 
                  blank                        | AT&T,BTL,CB
                                               | +1 614 860 4749
-----------------------------------------------| apc@cblpe.ATT.COM
Kudos to stargate for redistribution rights    | !cbosgd!cblpe!apc