Looking for suggestions/advice
Alex Tweedly
alex at tweedly.net
Thu Aug 11 08:30:08 EDT 2005
Some big question here Rodney. I could do with another day or two to
mull it all over before replying - but I know this weekend is going to
be very busy, so I'll reply now - and maybe correct myself a bit on
Monday or Tuesday.
btw - I don't know what you mean by European-style modern games. I've
previously thought about some of these issues specifically for card
games (see RevOnline under user alextweedly for TriPeaks - this includes
a PlayingCard library which you are welcome to use or take bits from as
you wish). I've also done, but not yet posted, a Cribbage game - and
it's definitely in the future plans to extend the number of games
handled, and to make them networked so multiple people can play against
each other and/or user-written stacks and/or the built-in rather basic
game play). [ but I haven't resolved the questions I raise below about
allocation of intelligence and game knowledge between the server and
client - so that's on hold for now ]
Rodney Somerstein wrote:
> Now, on to what I want to ask for help with. I want to develop an
> application which is a design/play environment for board/card games -
> particularly European-style modern games. This program should allow
> for people to create an add-on module to implement a particular game.
> Initially, it will just allow people to import graphics for playing
> pieces, cards, etc. and set up some very simple rules, such as how
> many cards to draw at one time, whether cards are public or private
> information, etc. Eventually I would like to allow the program to
> completely handle the rules of the game including score keeping,
> enforcement of all game rules, etc. I will start out very simple and
> add complexity as time goes on. The first iterations will require the
> user to do everything manually just to make sure I can handle dragging
> pieces around, dealing cards, etc. Then I will start to automate each
> of these things.
>
> I know that Revolution can easily handle the multi-player aspects via
> communication with a central server that broadcasts the information to
> everyone involved in the game. I'm not sure if this server should be
> written in Rev or something else such as PHP.
I'd do it in Rev - and probably use socket communication rather than
http. That will make it easier to handle the asynchronous nature of some
games.
A large design decision is whether to make the server generic, or make
it be scriptable for each game. Indeed, you could go to the other
extreme and make *only* the server be scripted, and use a general
purpose client. In that design, the client has no knowledge of the game
being played - it simply receives commands from the server
- here a list of named positions, and co-ords
- put these pieces at these co-ords (visible or not)
- enable these positions for user input
- etc.
I think this is how I will eventually do the networked card games (but
I'm not yet sure).
I also decided that I would have no reliance on information hiding in
the client - if a card is "face down" for a client, the server does not say
- 3 of spades, face down on the heap
it simply says
- a card face down on the heap
This prevents anyone from writing (or modifying) their client to give
them an advantage.
Note this means the server does not broadcast info on what is happening
- it must either customize the info for each client
- deal 3 spades to player A [to player A]
- deal a card to player A [ to players B, C, D]
or use an encoding scheme to limit information visibility. (I'm going to
do the latter, to simplify the server).
>
> I know that Revolution can make the graphical aspects of the program
> much easier than more traditional languages. I'm still not sure about
> being able to easily zoom in and out (scaling) the view of the game
> board, but I suspect it can be handled dynamically in Rev as well.
>
No reason why it shouldn't be.
> For my real dilemma, though. I brought up some ideas about this a
> couple of years ago looking for advice. People seemed to indicate that
> this should be a workable project in Rev. Now I'm looking for ideas as
> to how to go about implementing things.
>
> Here are my questions/concerns:
>
> This application is going to require a scripting language. My
> understanding is that Transcript isn't a viable scripting language for
> this purpose (correct me if I'm wrong, please) because there are
> limits as to how much can be done on the fly from an imported script
> rather than one built into the stack. For example, I don't think that
> I can have a user write a script that could be imported as a module
> into a Revolution stack and executed without limiting that script to
> 10 lines. Since a game could have several hundred pieces including
> cards, game boards, scoring tracks, decks of cards, etc. that need to
> have rules set for them, how can I go about this? Do I create XML tags
> to allow this? Do I write my own interpreter that Rev then uses to
> execute the scripts? I've never actually written a programming
> language, but I know there are better methods than one big if-then
> structure to parse through a line of code to figure out what it needs
> to do. Any suggestions on how to easily learn what I need to do here
> would be appreciated.
>
Again, I'm not sure about the kinds of games you want to allow. But for
card games, it is not at all trivial to codify the rules and actions
needed for a game. If you have a narrow range of games (analogous to
"only whist family" or "only rummy games") then I think it would be
feasible (and easier for your users to add a plug-in) with a
task-specific language. But if you want to handle a wider range (e.g.
points scoring in Cribbage) then I think you'd want a general purpose
language such as Transcript.
And given that anyone writing such a game is going to put in tens or
hundreds of hours doing so, I'd suggest that they should accept the cost
of a DC license. This will also give them an IDE and debugging
environment, which is likely to be valuable, if not necessary, for any
real game. For you to provide an IDE/debug environment for a
task-specific language would be difficult.
> I would like to allow the games to have computer players as well as
> human. That ratchets up the requirements for a scripting language even
> more. Is this something that Revolution is well suited to? Or should I
> really be looking at other languages such as Java? I could let users
> script things via Python or Ruby if I used Java. I know the downsides
> of developing in a language such as Java rather than Revolution. I
> just have this nagging feeling that it may actually make for a better
> cross-platform development system than Rev for what I want to do. I'd
> be happy to be disabused of this notion.
>
I'd design the client-server protocol carefully to be language-neutral.
And the people can code up "players" in any language they like - and
indeed you'll be free to make this decision for yourself independent of
what you decided for the server and/or GUI client.
Personally, I'd only consider dynamic languages - Transcript, Python
maybe Ruby. I don't see advantages for this purpose for Java or C# or
others.
If the idea of requiring a DC license would be a big problem, then I'd
consider doing the server (including the rules-interpreter) in Python,
and the client / GUI in Rev. But I think some people who could readily
learn enough Transcript to write a plug-in will find it harder or
impossible to use Python - so that might cut down on your plug-in
developer base.
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.2/65 - Release Date: 07/08/2005
More information about the use-livecode
mailing list