[OT] game engine (as in rules not graphics)

Discussion in 'Python' started by Martin, Dec 27, 2008.

  1. Martin

    Martin Guest

    Hello,

    I'd like to get in touch with game development a bit. I'm not talking
    about graphics but rather the game rules itself. Something like
    http://en.wikipedia.org/wiki/Monopoly_(game)#Rules, is there even a
    general approach to that or should I just go sketch up my rules and
    try to implement them. Being totally new to this topic I don't quite
    now what to search for to get some decent results that let me make a
    mental link between game rules and what the best practices are to
    implement them in python (or any other programming language)

    thanks,
    martin

    --
    http://soup.alt.delete.co.at
    http://www.xing.com/profile/Martin_Marcher
    http://www.linkedin.com/in/martinmarcher

    You are not free to read this message,
    by doing so, you have violated my licence
    and are required to urinate publicly. Thank you.

    Please avoid sending me Word or PowerPoint attachments.
    See http://www.gnu.org/philosophy/no-word-attachments.html
    Martin, Dec 27, 2008
    #1
    1. Advertising

  2. Martin

    Aaron Brady Guest

    Re: game engine (as in rules not graphics)

    On Dec 27, 3:02 pm, Martin <> wrote:
    > Hello,
    >
    > I'd like to get in touch with game development a bit. I'm not talking
    > about graphics but rather the game rules itself. Something likehttp://en.wikipedia.org/wiki/Monopoly_(game)#Rules, is there even a
    > general approach to that or should I just go sketch up my rules and
    > try to implement them. Being totally new to this topic I don't quite
    > now what to search for to get some decent results that let me make a
    > mental link between game rules and what the best practices are to
    > implement them in python (or any other programming language)
    >
    > thanks,
    > martin


    Not my expertise but here are my $0.02. You are looking for ways to
    represent rules: buying a house is legal in such and such situation,
    and the formula for calculating its price is something. You want
    "predicates" such as InJail, OwnedBy, Costs.

    Costs( New York Ave, 200 )
    InJail( player2 )
    OwnedBy( St. Charles Ave, player4 )
    LegalMove( rolldie )
    LegalMove( sellhouse )

    There are rule-based languages out there, such as Prolog. They are
    equally expressive as Python (you can write a Turing machine in them),
    but they are more convenient for representing rules in a prog.
    language.

    Predicates are more or less equivalent to positive assertions about
    something.

    NewYorkAve.cost= 200
    player2.injail= True...
    rolldie.islegal= True

    Some predicates have to be calculated, rather than stored, but Python
    descriptors go easy on you for that. Someone else will have to tell
    you how rule-based programming measures up against object-oriented
    programming. <passes mic.>
    Aaron Brady, Dec 28, 2008
    #2
    1. Advertising

  3. Martin

    Martin Guest

    Re: game engine (as in rules not graphics)

    Hi,


    2008/12/29 Phil Runciman <>:
    > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic Programming (ISBN 0201565072)
    >
    > This book is a pretty handy intro to an OO version Prolog produced by Logic Programming Associates.


    > From: Aaron Brady [mailto:]
    > Sent: Sunday, 28 December 2008 1:22 p.m.
    > Not my expertise but here are my $0.02. You are looking for ways to represent rules: buying a house is legal in such and such situation, and the formula for calculating its price is something. You want "predicates" such as InJail, OwnedBy, Costs.
    >
    > Costs( New York Ave, 200 )
    > InJail( player2 )
    > OwnedBy( St. Charles Ave, player4 )
    > LegalMove( rolldie )
    > LegalMove( sellhouse )


    I'm not sure I'm looking for prolog, i had an introductory course back
    at the university but it didn't exactly like it. I'm after some info
    how such rules would defined in python (specifically python althou
    logic programming is probably the more appropriate way).

    I guess I'm missing quite some basics in the design of such concepts,
    I'll head back to google to find some introductory stuff now :).

    regards,
    Martin


    --
    http://soup.alt.delete.co.at
    http://www.xing.com/profile/Martin_Marcher
    http://www.linkedin.com/in/martinmarcher

    You are not free to read this message,
    by doing so, you have violated my licence
    and are required to urinate publicly. Thank you.

    Please avoid sending me Word or PowerPoint attachments.
    See http://www.gnu.org/philosophy/no-word-attachments.html
    Martin, Dec 29, 2008
    #3
  4. Martin

    Aaron Brady Guest

    Re: game engine (as in rules not graphics)

    On Dec 29, 4:14 am, Martin <> wrote:
    > Hi,
    >
    > 2008/12/29 Phil Runciman <>:
    >
    > > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic Programming (ISBN 0201565072)

    >
    > > This book is a pretty handy intro to an OO version Prolog produced by Logic Programming Associates.
    > > From: Aaron Brady [mailto:]
    > > Sent: Sunday, 28 December 2008 1:22 p.m.
    > > Not my expertise but here are my $0.02.  You are looking for ways to represent rules: buying a house is legal in such and such situation, and the formula for calculating its price is something.  You want "predicates" such as InJail, OwnedBy, Costs.

    >
    > > Costs( New York Ave, 200 )
    > > InJail( player2 )
    > > OwnedBy( St. Charles Ave, player4 )
    > > LegalMove( rolldie )
    > > LegalMove( sellhouse )

    >
    > I'm not sure I'm looking for prolog, i had an introductory course back
    > at the university but it didn't exactly like it. I'm after some info
    > how such rules would defined in python (specifically python althou
    > logic programming is probably the more appropriate way).
    >
    > I guess I'm missing quite some basics in the design of such concepts,
    > I'll head back to google to find some introductory stuff now :).

    snip

    It depends on what you want to do with it. Do you want to answer a
    question about whether something is legal? Do you want a catalog of
    legal moves? Do you want to forward-chain moves to a state? Do you
    want just a representation for its own sake?

    For instance, the game just started. Player 1 landed on Oriental,
    bought it, and Player 2 landed in the same place. Here are the legal
    possibilities.

    Player 1 offers to sell Oriental to Player X.
    Player X offers to buy Oriental from Player 1.
    Player 1 mortgages Oriental.
    Player 1 collects rent from Player 2.
    Player 3 rolls dice.

    Thinking aloud, I think the closest thing to predicates you'll have in
    Python is to build a Relation class or use a relational database.
    Some tables you might use are: Property( id, name, price, rent0houses,
    rent1house, ..., numhouses, mortgaged, owner ). Player( id, location,
    money ). LastMove( player.id ).

    P.S. There is 'pyprolog' on sourceforge; I did not check it out.
    Aaron Brady, Dec 29, 2008
    #4
  5. Martin

    Aaron Brady Guest

    Re: game engine (as in rules not graphics)

    On Dec 29 2008, 8:52 am, Aaron Brady <> wrote:
    > On Dec 29, 4:14 am, Martin <> wrote:
    >
    > > Hi,

    >
    > > 2008/12/29 Phil Runciman <>:

    >
    > > > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic Programming (ISBN 0201565072)

    >
    > > > This book is a pretty handy intro to an OO version Prolog produced by Logic Programming Associates.
    > > > From: Aaron Brady [mailto:]
    > > > Sent: Sunday, 28 December 2008 1:22 p.m.
    > > > Not my expertise but here are my $0.02.  You are looking for ways to represent rules: buying a house is legal in such and such situation, and the formula for calculating its price is something.  You want "predicates" such as InJail, OwnedBy, Costs.

    >
    > > > Costs( New York Ave, 200 )
    > > > InJail( player2 )
    > > > OwnedBy( St. Charles Ave, player4 )
    > > > LegalMove( rolldie )
    > > > LegalMove( sellhouse )

    >
    > > I'm not sure I'm looking for prolog, i had an introductory course back
    > > at the university but it didn't exactly like it. I'm after some info
    > > how such rules would defined in python (specifically python althou
    > > logic programming is probably the more appropriate way).

    >
    > > I guess I'm missing quite some basics in the design of such concepts,
    > > I'll head back to google to find some introductory stuff now :).

    >
    > snip
    >
    > It depends on what you want to do with it.  Do you want to answer a
    > question about whether something is legal?  Do you want a catalog of
    > legal moves?  Do you want to forward-chain moves to a state?  Do you
    > want just a representation for its own sake?
    >
    > For instance, the game just started.  Player 1 landed on Oriental,
    > bought it, and Player 2 landed in the same place.  Here are the legal
    > possibilities.
    >
    > Player 1 offers to sell Oriental to Player X.
    > Player X offers to buy Oriental from Player 1.
    > Player 1 mortgages Oriental.
    > Player 1 collects rent from Player 2.
    > Player 3 rolls dice.
    >
    > Thinking aloud, I think the closest thing to predicates you'll have in
    > Python is to build a Relation class or use a relational database.
    > Some tables you might use are: Property( id, name, price, rent0houses,
    > rent1house, ..., numhouses, mortgaged, owner ).  Player( id, location,
    > money ).  LastMove( player.id ).
    >
    > P.S.  There is 'pyprolog' on sourceforge; I did not check it out.


    You know what I am thinking for this-- not that the OP is still
    around-- is a regular expression / BNF grammar that transitions on
    moves from one legal set of moves to the next. It will need some sort
    of concatenation structure, since late in the game, selling each
    property a player has is a legal move. Sorry for the replies to
    myself.
    Aaron Brady, Jan 1, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BlackHawke
    Replies:
    12
    Views:
    1,544
    Andrew Thompson
    Jan 26, 2004
  2. toni
    Replies:
    3
    Views:
    1,224
    Francisco Blay
    Sep 14, 2004
  3. NOBODY
    Replies:
    4
    Views:
    441
    NOBODY
    Apr 19, 2006
  4. Nathan

    Business rules engine

    Nathan, Dec 4, 2006, in forum: Java
    Replies:
    0
    Views:
    331
    Nathan
    Dec 4, 2006
  5. Nate
    Replies:
    0
    Views:
    685
Loading...

Share This Page