[plt-scheme] another game: pacman

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Aug 18 10:26:23 EDT 2006

On Aug 18, 2006, at 7:43 AM, Nikolay Artamonov wrote:

> I am relative newbie in the world of Scheme and MzScheme  
> implementation. And now I am very interesting in ascertaining how  
> is Scheme (in common sense) and MzScheme (in particular) matching  
> to usage in production applications (not research, not  
> experimental, and so on).
>
> I tested pacman game and can't understand "a few random pauses",  
> that was mentioned by Noel. My PC has PIV-1,6 Ghz with 512 Mb RAM +  
> Win 2k3. And every 3-4 seconds game becomes "frozen" for nearly 1  
> second and game process continues. Then after 3-4 seconds game  
> again suspends and then again continues. Ans so on.
>
> Noel said that this is caused by GC. But is it normal? Pacman is  
> very simple game. And I think that another similar game in Java, or  
> even Python, will not interrupted by GC in such _explicit_ way (of  
> cource, GC will work anyway, but more quickly). Even more:  
> programmers write 3D-games with Java! How it is possible to write  
> applications with Scheme (and with MzScheme in particular) with  
> predictable and smooth runtime process?
>
> May be it is not very good GC implementation in MzScheme? In that  
> case can you advise me alternative scheme implementation with more  
> friendly GC and more quickly runtime process?
>
> May be any scheme implementations today are not so mature for  
> production usage?
>
> Thank you and excuse me if my questions are very naive.

The questions are good, indeed they are excellent; the presumed  
answers are naive. Before you can come to any conclusions, you need  
to study the whole problem. Here are some examples of assumptions  
that are implicit in your write-up:

1. Jon's game is representative of a professional effort, i.e.,  
comparable to the effort of a gaming company that writes 3D games in  
Java. [Sample point against: Nothing against Jon who is one of the  
best NU students, but he can't compete with those companies.]

2. The Java games are written "naively" w/o concern for when GC can  
kick in.

3. Jon's game uses the best possible GC technology in PLT Scheme. It  
turns out that there are several.

4. Jon made an attempt to tune the game for memory usage.

5. That Noel was correct about guessing we had GC problems.

Of those 5 sample assumptions in your message, the fifth could easily  
be true. But there is a chance that it is false. If it is false, 1-4  
are irrelevant. If it is true, you need to consider those points  
carefully before jumping to conclusions.

Here are some more conclusions that you jump to:

6. Speed and GC are the same. PLT Scheme is the second fastest free  
Scheme implementation, by any benchmarks standards and by far the one  
with the best libraries. If you're willing to spend money, buy Chez.  
It's only $5,000 for a seat, but it has a lot of good things going  
for it.

7. All Scheme's are like PLT Scheme. [Sample point against: Disney  
used Scheme to animate several of its rides in Florida, and that's  
all real-time computation. They actually used a mix of Smalltalk and  
Chez Scheme.]

And so on.

;; ---

Let me recommend that you learn how to design and program in Scheme  
and that you then climb one "cultural mountain" in the Scheme world  
(i.e., get to know one system inside out). Then judge.

Hth -- Matthias





Posted on the users mailing list.