Re: Smalltalk weblog



Hi Jeff,

Nice post!

I hope you keep posting ... I am interested in your Smalltalk progress,
as well as your progress with DirectX and your game. I have played
around with DirectX in Dolphin and a game kit (Truevision I think it
was called), but never did much. Probably like many programmers, I
dream of one day being in a position to do a good game :)

I remember having a Smalltalk "moment" ... strangely enough it was
while reading a book based around Scheme (Structure and Interpretation
of Computer Programs). The first line of that book is "We are about to
study the idea of a computation process" ... and it certainly got me
thinking about processes.

At the time I was working in a Scheme environment, but I still spent
more time playing around with the examples in Smalltalk. My moment was
in the debugger when I realized I was looking at an object that was the
computation process, and I could see the objects making the computation
happen.

It was like suddenly seeing a level down ... a level that kind of
reached up to the objects I was familiar with (ie Person, Dog etc) ,
and changed their state and moved in and out of the code I had written
.... and the cool thing was, the objects one level down, were
effectively the "equals" to mine. It was like going from a 2D world to
3D world!

Attempting an example ... instead of evaluating 'ShellView
allSubclasses', select it (without the quotes) and press F11 (or
right-click/debug).

In the debugger that opens, "Step Into" a couple of times. Then click
the "Visual Object Finder" (magnifying glass icon), and click on one of
the lines in the stack list (top-left listView).

This should open an inspector on one of the stackFrame objects that is
part of your computation. (FWIW: The frame objects would be optimized
away if there was no debugger on the process ... but, in my mind, they
are still always there).

You can also see the process itself. Click on the "Tools" menu, then
click on "Process Monitor". Find the process in the list with the name
"Main" and state "debug". (FWIW: the Main/running process is the
process doing the debugging (it starts/stops the Main/debug process
when stepping) and is handling the user input/Windows messages at the
moment).

Right-click on the Main/debug process in the "Process Monitor" and
click on "Inspect". (Switch the Inspector to the "Instance Variable"
tab to see more).

This gives you another viewpoint on your process. Keep stepping in the
debugger and you can watch your computation evolve.

One last thing ... not only can you evaluate 'ShellView allSubclasses',
you are free to change its behavior. You could, if you want, change
Behavior>>allSubclasses to answer ^#() ... although this is definitely
not a good idea :)

By compiling in Behavior>>allSubclasses ^#(), it means that all
processes that create a frame object with the Behavior>>allSubclasses
compiledMethod, will get back an empty array ... that will cause
problems for your image (although it is always fun to try these
things!)

Much safer is to just modify your process so that your allSubclasses
(frame) returns #(). To do this, In the debugger, right-click on the
'ShellView class(Behavior)>>allSubclasses' frame, then click
"Return...", enter '#()' (without the quotes) and click OK. Bingo ...
'ShellView allSubclasses' just returned #()!

"Return..." and "Restart" are great for really manipulating and
exploring your process as it moves through your objects. You really get
to explore/modify not just the objects themselves, but their
interaction ... the process object(s). I would imagine that would be
helpful for game programming ... IMO it is always fun ... a game
itself!

I don't think words and examples can do "moments" justice ... I hope I
have not mangled things for you, but at the least ... keeping peeling
off the layers ... there are more objects waiting for you :)

Steve

.



Relevant Pages

  • Re: Detecting keys pressed/released in VisualWorks 7.6 (problem with events)
    ... I'm reimplementing a game I wrote over 20 years ago on ... MSX and Amstrad platforms, in Smalltalk. ... a problem with key pressed/released events, ... you want to probably use DirectInput. ...
    (comp.lang.smalltalk)
  • Re: In which application areas is the most interesting work?
    ... Don't know much about game programming (last I did, ... good software engineers than software to engineer. ... Wouldnt call Eiffel and Smalltalk "specialized" (but Im sure people has ... You dont know what to do when you dont know what you're doing. ...
    (comp.object)
  • Re: Mockingboard sound and Pitfall II
    ... The version I downloaded from Asimov doesn't have any MB support, ... Try in Apple][+ mode and set the debugger to break on invalid ... Exit debugger and the game loads. ... opcode $2F maps to an opcode that behaves like the 6502. ...
    (comp.emulators.apple2)
  • Re: "Active Debugger" warning
    ... It has Windows XP, ... | download a game that had worked fine on my Windows ME ... | debugger in memory. ... Your sound card or sound card drivers are outdated. ...
    (microsoft.public.windowsxp.games)
  • Re: Smalltalk weblog
    ... Smalltalk and Dolphin. ... I just took a look at your first blog entry. ... is to dynamically perform some Refactoring on your game code ...
    (comp.lang.smalltalk.dolphin)