Complete.Org: Mailing Lists: Archives: freeciv-dev: June 1999:
Re: [Freeciv-Dev] Unit Abilities (Upkeep, Flags)
Home

Re: [Freeciv-Dev] Unit Abilities (Upkeep, Flags)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Mark Nettle <mark@xxxxxxxxxxxxxxx>
Cc: "'freeciv-dev@xxxxxxxxxxx'" <freeciv-dev@xxxxxxxxxxx>
Subject: Re: [Freeciv-Dev] Unit Abilities (Upkeep, Flags)
From: Greg Wooledge <wooledge@xxxxxxxxxxx>
Date: Wed, 2 Jun 1999 19:11:22 -0400

Mark Nettle (mark@xxxxxxxxxxxxxxx) wrote:

> "Wouldn't it be cool if the undead didn't need upkeep in shields?
> I wonder if I can do it?" Checking through to see exactly what happens if
> I set F_NONMIL on a unit with attack strength > 0 ...

Very nice analysis....

> /******
>   unit can't attack if:
>  1) it don't have any attack power

>   if(!is_militarty_unit(punit))
>     return 0;
> 
> Either the comment should change, or the code should be something more
> like
> 
>   if(get_unit_type(punit->type)->attack_strength == 0)
>     return 0;

This would probably be best addressed by adding more unit flags.
Actually, as your message shows, there are a *lot* of cases where some
vast ugly bits of the code could be cleaned up by adding more flags
to units and other game features, and then encoding more of the game
functionality in the ruleset files.

For comparison purposes, the units.txt file in CTP has about 45 lines
of information for each unit (not counting blank lines, but counting
the lines which define which sounds and which graphics to use).

> Now we get to Dwarves. They're basically Engineers. They have F_TRANSFORM,
> and I'd like them to be able to irrigate, mine, road and railroad, but not
> build cities. No way to do this, as all of these are covered by F_SETTLERS.
> It'd be nice to separate them - but I'm trying to make a working ruleset
> first - changing the code comes later.

I'd vote to change the code first, myself.  But whoever submits the
first relevant working patch gets to decide, I guess. ;-)

> NONMIL. Now odd things happen if you have a
> unit with F_SETTLERS but not F_NONMIL. It costs not only shields, but food
> as well (depends on govt type of course).

This is already the case in Civ2 -- Settlers require both shields and
food for upkeep.  I don't see a real problem with this.

> It'd be nice to be able to specify which sorts of upkeep apply to which
> units.
> So a battleship might have an upkeep of 1 gold, in addition to it's 1
> shield,
> and a baby-eating demons might cause twice the normal happiness penalty.

Nice ideas.

> ; name            upk
> "Battleship"  "sgh"
> "Baby-Eaters"     "shh"
> "Settlers"        "f"
> "Dwarves"         "sh"

I'm not sure I like this syntax, though.

The CTP text files use a stanza format, like this:

# COMMENT
UNIT_FOO {
FIELD1 value1
FIELD2 value2

FLAG1
FLAG2
}

whereas Freeciv uses a different style which I don't like very much
(but it's far, far better than hard-coding everything in the program).

If modpacks are to be taken seriously -- and I believe they should --
then IMHO we need to improve the ruleset file format (and of course
write the code to read it).

We could use the CTP format, which has the advantage that CTP "hackers"
will already be familiar with it.  It's fairly simple, especially
since most of the FIELD/FLAG names are intuitive (e.g., "ATTACK 0",
"CANT_CAPTURE_CITY" or "HAS_NO_ZOC").  If it were indented, instead of
being completely left-justified, it might even be pretty. ;-)

And finally, before we rewrite the ruleset files, we need to move all
(or as many as possible) of the existing special cases out of the
code and turn them into appropriate flags.  You've mentioned two good
examples of this already -- if we could get together a full list of all
the behaviors that should be turned into separate flags, that would be
a great first step.

After all of that, perhaps it might be time to revisit the scripting
language thread (but put on your fireproof clothing first...).

-- 
Greg Wooledge                    | Distributed.NET http://www.distributed.net/
wooledge@xxxxxxxxxxx             | because a CPU is a terrible thing to waste.
http://www.kellnet.com/wooledge/ |

[Prev in Thread] Current Thread [Next in Thread]