public inbox for xconq7@sourceware.org
 help / color / mirror / Atom feed
* Wrecking as a result of starvation
@ 2004-05-27  1:15 mskala
  2004-05-27  2:39 ` Eric McDonald
  2004-05-27  5:29 ` Jim Kingdon
  0 siblings, 2 replies; 7+ messages in thread
From: mskala @ 2004-05-27  1:15 UTC (permalink / raw)
  To: xconq7

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1836 bytes --]

At present, units that starve to death simply vanish.  I would prefer that
they wreck (when wrecking is possible) instead.  That behaviour would be
more consistent with my reading of the docs, and it would also allow a
variety of clever tricks using unit starvation to create time-delayed type
changes.  Attached are a patch and a sample game file demonstrating the
behaviour - just move the human around until s/he starves; in present CVS
the unit doesn't leave a corpse, but with my patch, it does.  I don't know
if there are any games that presently depend on the unit vanishing instead
of wrecking on starvation; I imagine not, because someone who wanted units
to vanish would generally not define a wrecked-type for them.  But it
might maybe have consequences for clever tricks like the "zombie" one that
was described on this list a few days ago.  I don't think that particular
trick would break, but maybe some other might.

Note that at present, several other modes of unit death also lead to
vanishing instead of wrecking; the documentation leads me to believe that
if the unit's HP go to 0 then the unit will wreck, always, but in fact the
current behaviour is that wrecking only happens with terrain accidents,
(*not* attrition!), automatic wrecking terrain, and combat.  This patch
also cleans up the code a little by dealing with the occupant escape issue
and "use generic damage routine?" noted in the original.  The "should do
other hp loss consequences" comment suggests that something like this
patch may have been intended anyway by whoever wrote that comment.  One
FIXME remains, since I don't know what to do about player notification,
but the patched code is no different from the original in that respect.
-- 
Matthew Skala
mskala@ansuz.sooke.bc.ca                    Embrace and defend.
http://ansuz.sooke.bc.ca/

[-- Attachment #2: Type: TEXT/PLAIN, Size: 586 bytes --]

(game-module "simple"
  (blurb "trivial game")
  )

;;; This game definition is about as simple as you
;;; can get and still have a working game.

(terrain-type plains (char "+"))

(material-type food)

(unit-type human (image-name "person") (char "@")
  (start-with 1)
  (acp-per-turn 1)
)

(unit-type corpse (image-name "carcass") (char "!")
  (acp-per-turn 1)
)

(add human wrecked-type corpse)

(table unit-initial-supply (human food 3))
(table unit-storage-x (human food 3))
(table base-consumption (human food 1))
(table hp-per-starve (human food 1.00))

[-- Attachment #3: Type: TEXT/PLAIN, Size: 2267 bytes --]

Index: kernel/history.h
===================================================================
RCS file: /cvs/xconq/xconq/kernel/history.h,v
retrieving revision 1.7
diff -c -r1.7 history.h
*** kernel/history.h	18 Jan 2003 16:41:15 -0000	1.7
--- kernel/history.h	27 May 2004 01:04:28 -0000
***************
*** 88,94 ****
  enum damage_reasons {
      combat_dmg,         	/*!< combat */
      accident_dmg,       	/*!< accident */
!     attrition_dmg       	/*!< attrition */
  };
  
  /*! \brief Historical Event Definition array. */
--- 88,95 ----
  enum damage_reasons {
      combat_dmg,         	/*!< combat */
      accident_dmg,       	/*!< accident */
!     attrition_dmg,       	/*!< attrition */
!     starvation_dmg		/*!< starvation */
  };
  
  /*! \brief Historical Event Definition array. */
Index: kernel/run2.c
===================================================================
RCS file: /cvs/xconq/xconq/kernel/run2.c,v
retrieving revision 1.59
diff -c -r1.59 run2.c
*** kernel/run2.c	24 Apr 2004 06:40:53 -0000	1.59
--- kernel/run2.c	27 May 2004 01:04:41 -0000
***************
*** 3464,3481 ****
  	}
      }
      if (hploss > 0) {
! 	if (hploss >= unit->hp) {
! 	    /* (should let occupants try to escape first) */
  	    /* FIXME: Should notify the player somehow what happened.
! 	       Since the unit doesn't exist after this, they can't even
! 	       see which material it was low on.  */
! 	    kill_unit(unit, H_UNIT_STARVED);
! 	} else if (partial) {
! 	    unit->hp -= hploss;
  	    unit->hp2 -= hploss;
! 	    /* (should do other hp loss consequences) */
! 	    /* (use generic damage routine?) */
! 	    update_unit_display(unit->side, unit, TRUE);
  	}
      }
  }
--- 3464,3477 ----
  	}
      }
      if (hploss > 0) {
! 	if ((hploss >= unit->hp) || partial) {
  	    /* FIXME: Should notify the player somehow what happened.
!               Since the unit doesn't exist after this, they can't even
!               see which material it was low on.  */
!             /* Is the above comment still applicable now that the general-
! 	       purpose damage code is used?  */
  	    unit->hp2 -= hploss;
! 	    damage_unit(unit, starvation_dmg, NULL);
  	}
      }
  }

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: (Mac?) Interface q's
@ 2004-05-29 21:17 Eric McDonald
  2004-05-29 21:23 ` Wrecking as a result of starvation Elijah Meeks
  0 siblings, 1 reply; 7+ messages in thread
From: Eric McDonald @ 2004-05-29 21:17 UTC (permalink / raw)
  To: Tom Schaub; +Cc: xconq7

On Sat, 2004-05-29 at 14:46, Tom Schaub wrote:

> First, how common is use of the Sequential option? I prefer this form 
> of play, since I am usually playing solitaire. Is the structure of the 
> Xconq code such that separate testing of a game module is needed to 
> assure proper behavior in simultaneous, multi-player mode?

The separate testing of the simultaneous play doesn't hurt.

I think quite a few of the games in the library are sequential by
default, and I think it is probably the preference of many people to
play in sequential mode.

As far as your Mac questions are concerned, Hans is probably the best
one to answer those, since I don't even own a Mac that is capable of
running Xconq right now. Unfortunately, Hans is going to be busy with
the real world for at least the next week. I am assuming that Stan might
be able help you with the questions though.

As far as your fourth question is concerned: the next unit is scheduled
at the level of the Xconq kernel. If an interface wanted to provide an
alternate unit scheduling, it would have to run a scheduler at the
interface level. I doubt that the Mac interface has a separate
scheduler, but I haven't looked at its code too much.

Eric

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-29 21:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-27  1:15 Wrecking as a result of starvation mskala
2004-05-27  2:39 ` Eric McDonald
2004-05-27  5:29 ` Jim Kingdon
2004-05-28 23:57   ` Lincoln Peters
2004-05-29  1:03     ` mskala
2004-05-29 15:10       ` Eric McDonald
2004-05-29 21:17 (Mac?) Interface q's Eric McDonald
2004-05-29 21:23 ` Wrecking as a result of starvation Elijah Meeks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).