Simon McGregor on Thu, 5 Aug 2010 06:40:51 -0700 (MST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[game-lang] Sequential flow description


Looking at GALA's example code made me realise the importance of
sequential description in game rules. I'm still in favour of a
declarative rather than imperative language, but many games heavily
feature imperative-style turn structure (regular sequential changes of
state which totally switch the sets of choices available to players).
We should consider this.

The English rules "Turns have three different stages. First, stage A,
where each player chooses a card and they are simultaneously
revealed... Then, stage B, where the player with the highest card...
Finally, stage C, in where each player in turn moves their pawn..."
read far more clearly when written

sequence(
   // stage A
   sequence(
      [ each player chooses a card ],
      [ they are simultaneously revealed... ]
   ),
   // stage B
   [ the player with the highest card... ],
   // stage C
   [ each player moves their pawn... ]
)

than when written in some way which abstracts the flow into a big
state-switching logic a la fluent calculus, roughly:

(Player can A_choose(Card)) requires
  [ in stage A ]

do(Player, A_choose(Card), unchanged-state plus [ in stage A ]) =
unchanged-state plus [ in stage B ] plus [ "Player chose Card"
revealed ]

...with the logical flow of the sequence broken up and coded all over
the place, and requiring relevant states to be turned into named
facts. Which looks to me a lot like imperative programming implemented
(inefficiently and unreadably) in a non-imperative language.


Simon
_______________________________________________
game-lang mailing list
game-lang@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/game-lang