|
View previous topic :: View next topic
|
| Author |
Message |
Socinian
Joined: 08 Sep 2005 Posts: 4
|
| |
Posted: Thu Sep 08, 2005 7:38 am Post subject: One Case where RMGUI works miracles - Back to Smalltalk |
 |
|
Sean mentioned Smalltalk a couple times in his article.
Squeak is a free & OS version of Smalltalk.
http://www.squeak.org
Alan Kay (who invented Smalltalk and thereby popularized OOP and created Squeak) has extended the 2D version of Squeak to a 3D multi-user, peer-2-peer environment called "Croquet".
http://www.croquetproject.org
(see the slide show)
The 3D environment has retained the old 2D Squeak applications as moveable interactive walls.
The 2D Squeak applications just work in 3D without any recoding. The 2D widgets don’t know they’re living in a 3D world. In fact, multiple avatars can manipulate the 2D applications without recoding the 2D widgets for this multi-user function. For example, two avatars can both type into a single text document widget without recoding the widget.
Smalltalk uses a VM and an “Image file” (single saved binary file of all code, data, fonts, graphics, memory, and execution stack) to ease the creation of widgets. In the "Morphic" GUI, widgets and graphics can be created, named, and aligned interactively in the application, saved with the Image by default, and just referenced in the code by instance variable name without lots of pointers or callbacks.
Because Squeak has its own graphic rendering engine, the code, interface behavior, & visual representation is identical on all common platforms that the VM has been ported to (Linux, Mac, Windows, Unix, and many, many others). Croquet has a high level wrapper over the OpenGL API.
Smalltalk technology allows Croquet to enable the user to write and execute Smalltalk code to modify the world while the world is running and the user's avatar active within it. No extra scripting language needed. The user has their own 3D object and behavior construction set. The user can be given all the application development power that comes with something like visual studio with object browsers, inspectors, etc., for free. No extra modding kits to be developed. Saving the 3D world in its exact-split-second state for persistence, and later resumption at that exact point, is a single function call.
Just to blow your mind, check out Croquet's "3D portal" it's a living 3D map of the world you are in that shows all the 3D objects as they are moving in the world you are in. Your avatar can carry the map around with it and watch the map's representation of your avatar carrying the representation of the map on the map. 3D recursion. The map is interactive to boot. Moving any represented 3D object on the map around on the map, moves the object it represents in the 3D world you are in.
It seems to be C++, Java, and static typing that makes a GUI hard.  |
|
| Back to top |
|
 |
Socinian
Joined: 08 Sep 2005 Posts: 4
|
| |
Posted: Thu Sep 08, 2005 7:52 am Post subject: Croquet has more Magic |
 |
|
I forgot to mention that Croquet has other special portals.
The "spherical portal" looks like a crystal ball that you can see another world through. Walking around the ball shows you the other world at all the same angles. Walking thrugh the portal at a chosen angle has you exiting it into the other world at that same angle.
You can also look through a "wireframe portal" like a magic window of the world you are in. Walking through it puts you in a wireframe world of the world you are in, including making your avatar a wireframe. Looking back through it shows you your textured world, at its proper angles. |
|
| Back to top |
|
 |
casey Site Admin
Joined: 18 Dec 2004 Posts: 1835 Location: Seattle
|
| |
Posted: Thu Sep 08, 2005 8:52 am Post subject: |
 |
|
Not to rain on the parade or anything, but none of the things you've talked about have anything to do with how clean the code is. I would like to see the Squeak equivalent of, say, the third code listing here, as an example.
Having a nice demo of your UI doesn't really mean anything. You can make a great demo or a great application with RMGUI or IMGUI, but that doesn't speak to how efficiently the UI is coded, which is all we're concerned with here.
- Casey |
|
| Back to top |
|
 |
sean
Joined: 01 Feb 2005 Posts: 1549 Location: Kirkland WA
|
| |
Posted: Thu Sep 08, 2005 9:51 am Post subject: |
 |
|
One noteworthy thing about Morphic is that it puts a lot of the gui widget state at the users fingertips, thus making that state "meaningful" (normally I complain that most state inside GUI widgets is irrelevant, because it's not actually malleable state). However, I'm not sure how practical that really is for getting stuff done, rather than just gee-whizzy, and it doesn't matter since state-reduction isn't central to IMGUI.
Here's what I want to know: how many languages, besides C, C++, and assembly, let you take the address of (or a reference to) an instance variable / structure field / slot of an object, and then hash based on that address? (Ok, hashing isn't strictly necessary, but you need more than just plain equality comparison; < and > will do to let you make a binary tree.)
One of the basics of IMGUI style is "handle-free" coding using these pointers (although technically any unique ID will do, and technically RMGUIs could use these too). But it strikes me that all the "advanced" languages, from Smalltalk to Ruby to Java, are totally incapable of implementing IMGUI in all its glory, because they can't do this wonderful "hack".
Basically, in some weird sense, structure fields in C/C++ are more "first-class" than they are in other languages (although not quite the normal sense of linguistic "first-class", it's along the same lines). |
|
| Back to top |
|
 |
Socinian
Joined: 08 Sep 2005 Posts: 4
|
| |
Posted: Thu Sep 08, 2005 4:07 pm Post subject: "Where's the code?" |
 |
|
"Talk is cheep. Show me the code."
Good point.
I didn't think to mention the code structure because it's already all there for you to evaluate yourself:
http://www.croquetproject.org/Croquet_Technologies/downloads.html
Download.
Unpack.
Drag the Croquet.xx.image file onto the Croquet.exe file to launch.
Drag the Teapot icon to the Croquet Desktop to start a demo world.
Wait a minute.
Hover near the bottom edge of the window to pull up the iconic menu.
Select Tools.
Select the icon that looks like overlapping tool windows.
Select the Object browser.
View and/or change all the source code there.
At any time click on the desktop to bring up the world menu.
Select "save as..." to save your entire moving world at that moment in time.
You can now restore it to that moment by dragging the new .image file on to the Chrquet.exe file.
Tutorial at:
http://www.dmu.com/croquet/
My point is that:
1. Not letting the end user roll their own GUI
2. Assuming only one input point (as the world goes multi-user)
3. Assuming the widget won't need to map to a 3D model
all seem like early optimization to me.
Yes. The Morphic layer stack is complex to evaluate.
Yes. There is some incomprehensible Morphic code (which is encapsulated away from you).
In Morphic, you can graphically pull the widgets apart from the form and they still "just work". |
|
| Back to top |
|
 |
Socinian
Joined: 08 Sep 2005 Posts: 4
|
| |
Posted: Thu Sep 08, 2005 4:17 pm Post subject: "Advanced" languages |
 |
|
There is an add-on that lets you generate a Universal Identifier for any object in Squeak, and manipulate the objects at that level, if that's what you mean.
Do we need IMGUI in all its glory if we can make RMGUI programming easier.
Using Continuations to save stack, Seaside in Smalltalk can even make web UI programming behave just like native app programming.
http://www.seaside.st
This allows you to back up in time and not lose state. |
|
| Back to top |
|
 |
casey Site Admin
Joined: 18 Dec 2004 Posts: 1835 Location: Seattle
|
| |
Posted: Fri Sep 09, 2005 5:27 am Post subject: Re: "Where's the code?" |
 |
|
| Socinian wrote: |
My point is that:
1. Not letting the end user roll their own GUI
2. Assuming only one input point (as the world goes multi-user)
3. Assuming the widget won't need to map to a 3D model
all seem like early optimization to me.
|
I'm not sure I understand how these points apply to the discussion.
#1 is unclear - could you be more specific?
#2 and #3 both don't seem to correspond to IMGUI vs. RMGUI.
Regarding #2, input can come from anywhere in IMGUI, just like it can in RMGUI. The library is often responsible for coallescing input into a single signal to the app so that the app code is cleaner and easier to write, but the library itself can be collecting that input from many sources if it so desires. But again, there's nothing inherent about IMGUI or RMGUI in this.
Regarding #3, obviously IMGUI systems support mapping to a 3D model - I do that all the time. One of the huge advantages of IMGUI is that you can freely mix user-level 3D rendering with library-level processing of input with no loss of efficiency (and I take advantage of this all the time). IMGUI library code is obviously also free to render in any way it chooses, so you can trivially turn an app that was 2D into one that was 3D by changing the library, with no app code changes necessary.
- Casey |
|
| Back to top |
|
 |
casey Site Admin
Joined: 18 Dec 2004 Posts: 1835 Location: Seattle
|
| |
Posted: Fri Sep 09, 2005 5:37 am Post subject: Re: "Where's the code?" |
 |
|
| Socinian wrote: | | I didn't think to mention the code structure because it's already all there for you to evaluate yourself |
I'm being much more specific. In my original reply I referenced this piece of code in another thread:
| Casey wrote: |
| Code: |
void DoDialog(bool HasEditBox, ...)
{
int SliderSum = 0;
bool IsChecked = DoCheckbox(CheckboxID, ...);
if(IsChecked)
{
if(HasEditBox)
{
DoEditbox(EditboxID, ...);
}
else
{
DoLabel("Sorry, you don't get an edit box on this particular dialog box, even if you check the box!");
DoLabel("But you do get fifteen sliders. Just don't make them add to more than 20!");
{for(int SliderIndex = 0;
SliderIndex < 15;
++SliderIndex)
{
SliderSum += DoSlider(SliderArrayID, SliderIndex, ...);
}}
}
}
if(SliderSum > 20)
{
DoSlider(SliderID, ...);
}
}
|
You have now gone from a static dialog box to a dialog box which responds to the checkbox by showing a new edit box if allowed, otherwise you're going to be snotty and also provide fifteen sliders, the total of whose values must be less than or equal to 20 otherwise the original slider will go away.
|
If it's that easy to construct GUIs in this package, then you should be able to post an equivalently short piece of code that accomplishes the same thing using Squeak/Croquet, right? So if you could go ahead and do that, then we can look at it and compare.
- Casey |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|