Can I use Revolution for this?

Rodney Somerstein rodneys at io.com
Sat Aug 3 23:04:01 EDT 2002


Dave Cragg wrote:

>It would be useful if you could give a concrete example of what a
>user may need to "script". If it's a case of modifying (as opposed to
>creating) object behaviors (speed, power, etc.), perhaps custom
>properties could used to set values that a pre-written script uses
>when it runs. You can clone objects that have any size of script (in
>a standalone or in development), so creating pieces from an external
>stack of pre-existing objects would seem to be possible.

As a simple example of a typical game, lets take a look at Mahjong. 
In the simplified scoring system for Mahjong that I use, there are 42 
possible scoring patterns (combinations of tiles). In some of the 
more complex variations there are many more than this.

So, at the end of a hand, to score for each person, I have to score 
each person's hand individually, checking the entire hand against 
each scoring pattern. Each hand may contain several of these 
patterns. After detecting each pattern, I have to add them to the 
cumulative score. This needs to be done for each player's hand. After 
all scores are calculated, each person pays the winner of the hand a 
certain number of points based on the completion state of their hands.

To calculate these scores, it would seem that I need to set up a loop 
for each person's hand to check for each possible pattern which can 
iterate through the hand to see how many times it occurs and then 
increments the score for the hand appropriately. As an example, one 
possible pattern is that the person has 13 tiles in their hand at the 
end of the game that consist of the values 1 1 1 2 3 4 5 6 7 8 9 9 9 
of the same suit. Just checking for this one pattern could be tough 
to do within the script length limit. And again, this is just one 
possible pattern out of 42, some of which are short enough to occur 
multiple times within a single hand. For example, each three tiles in 
the hand which contain certain values (all the same kind of dragon or 
all the same wind) score a certain number of points. And, some of 
these patterns can occur cumulative with other patterns.

Now, remember that one of my goals is to create a generic system that 
is flexible enough to allow the game developer to implement whatever 
kind of game they want. The above example is just one of thousands of 
games, and not one of the most complex by far. There is no way that I 
can implement all of the rules myself and just let the users pick 
from among the available ones.

I will be implementing this in stages. The first things the users 
will be able to do is simply define some very simple rules, such as 
what a deck of cards is (can they draw from the deck, or are all 
cards dealt to users - how many draw and discard piles are there, 
which cards are visible, etc.) , how dice work (how many sides to 
they have, what are the values, etc.), etc. As time goes on, I want 
players to be able to automate this instead of simply simulating the 
board game experience online. There is no reason that the players, 
for example, should have to figure out the score manually in the 
Mahjong game mentioned above, so I want the more ambitious developers 
to be able to build on what I have done to add additional 
functionality.

It may be that this is simply too open a set of limits for something 
like Revolution to allow. As I am developing a free product and 
ideally open source, I can't really expect the average user to pay 
for a license for Revolution. Only those who want to add new basic 
behaviors to the environment should need to do that. I'm not asking 
to give the users access to the development environment itself, just 
to let them create their scripts in text files that my application 
(based on Revolution, of course) can then execute.

After a quick look at the MetaCard website, it appears that some of 
these limitations might be imposed by MetaCard itself. So, RunRev 
might have license restrictions that they have to stick to as well 
and are required to enforce. Given what I have heard over the years 
about MetaCard, it is actually kind of surprising that they are 
allowed to expose everything that they do. (Of course it was hard to 
even figure this out from their website as they don't make all of the 
free info available for MetaCard that we can get for Revolution. They 
do discsuss a bit about script limits, but make it sound as if the do 
script limit in MetaCard is less restrictive than the one in 
Revolution.)

What exactly is the relationship between the two companies, anyway? 
Are they really the same or did RunRev just come up with a neat idea 
for extending MetaCard and pay enough money to make it happen?

It is looking more and more like I may end up needing to go to some 
sort of freely available environment such as Java, Python, etc. These 
languages all have issues of their own, particularly native look and 
feel. I guess I just got spoiled by HyperCard and thought that 
Revolution would allow me to do the same things I could do there. In 
some ways I can do much more with Rev, in others it is turning out to 
be less.

I may end up creating an initial version of the program in Rev to get 
all of the basic functionality done. When that is stable and users 
are relatively happy, I could then rewrite the program in another 
language. I'm likely to have learned all kinds of things about how I 
limited myself by that point so a rewrite is likely anyway. Just 
continually extending the program can get pretty messy over time.

-Rodney



More information about the Use-livecode mailing list