Category: Smalltalk

  • Ray Casting With Squeak

    Ray Casting With Squeak

    Ray Casting With Squeak

    On the Squeak developers mailing list, Lauren Pullen shared her experience (found here) using Squeak while working on a rendering engine for a first-person maze game, similar to the technique used to render the original Wolfenstein 3D game. Wolfenstein 3D used a rendering technique known as ray casting. Her project captured our attention prompting us to seek additional information from her about it.

    What is Ray Casting?

    Ray casting is an early rendering technique used in computer graphics and video games, particularly in 2.5D and 3D environments. It is a simplified form of ray tracing, where a ray is cast from the player’s or camera’s perspective into the environment, and the distance to the nearest object along that ray is calculated. This process is repeated for each column on the screen, creating a 3D representation of the 2D world. Ray casting was widely used in the early days of 3D gaming, particularly in games like Wolfenstein 3D (1992).

    From Lisp to Squeak

    Lauren, with her extensive experience in Common Lisp, initially chose it to create a GUI application. However, she faced significant challenges. The graphics library was unreliable, often failing to start, and the outdated documentation made it difficult to work with. She studied MVC while designing her application but struggled with basic functionality, such as displaying a simple window.

    She decided to switch to Smalltalk, specifically Squeak, which had an immediate impact. The graphical elements worked seamlessly from the start, and although she missed some features from Common Lisp, like restarts and method combinations, Squeak provided a development environment that allowed her to focus on development without drastically changing her mental approach to problems.

    Comparing Development Tools

    For game development, she initially relied on a much earlier version of Game Maker Pro. When she explored Godot, she found its complexity overwhelming compared to Smalltalk. The disorganization in Godot’s tutorials made her question how to create a basic viable product efficiently. In contrast, though seemingly minimal, Squeak’s classes Form and UserInputEvent provided all that was needed.

    Advantages of Squeak

    In Squeak, she found it easy to work with graphical elements. Drawing interface components and importing graphics were straightforward, thanks to the source code access for built-in drawing functions. This simplicity was crucial for her development process. While working on the game, she realized that making changes and seeing immediate results was invaluable for debugging. Her experience with Forth taught her the value of functions that do one thing well, and Smalltalk’s debugging tools like Inspect-It and Debug-It further streamlined the process.

    Challenges and Solutions

    However, she encountered challenges. While most errors in Smalltalk were easy to handle—usually, closing the Debugger was all that was needed—some issues could freeze the image, making recovery a bit more manual than desired. She found herself needing to use the Recover Changes window to restore unsaved changes more often than she would have liked.

    In terms of rendering, she faced performance limits with BitBlt when texturing the floor and ceiling. To overcome this, she turned to the AbstractGPU library, leveraging the graphics card for drawing. She continued to use the ray caster to determine what the player could see to speed up the game, but introduced edge pop-in, where objects on the screen edges would suddenly appear while turning the camera, because of differences between the ray caster’s projection and the GPU’s projection. Increasing the field of view used by the ray caster resolved this issue.

    Testing Using Morphic Dungeon

    Morphic Dungeon is what Lauren developed and uses to test the movement and texturing code. She wants to work with textures that are not symmetrical, which requires mapping the top-left corner of the texture to different positions on each face of the 3D objects. This approach also allowed her to test back-face culling—a technique that improves performance by not drawing faces of a 3D object that are not visible to the camera—in the GPU mode. In this mode, the “back faces” are flipped horizontally and appear further away, as if looking at the inside of a transparent painted box instead of the outside. Back-face culling will be essential for rendering the “walls” of tiles that the player can enter or see through, such as grass or support beams along the grid edges.

    Lauren implemented three movement modes:

    • Free Movement and Free Turning
    • Grid-Locked Movement and Free Turning
    • Grid-Locked Movement and Grid-Locked Turning

    Full Free Movement is similar to Wolfenstein 3D, allowing sub-pixel steps and small increment camera rotations.

    Grid-Locked Movement is useful for first-person dungeon crawlers. Grid-Locked Turning forces camera rotation to 90-degree increments, similar to classic non-raycaster games like Wizardry or modern titles like Etrian Odyssey. Free camera rotation, with Grid-Locked Movement, is also supported which is similar to the modern title Operencia.

    While using Morphic Dungeon to test the different movement modes, Lauren encountered an amusing floating point error whereby the player would step repeatedly through walls and out of the play area. This provided a humorous insight into the potential bugs she might encounter.

    Additionally, Lauren tested the game with a family member, revealing that the 40×40 maze, though not difficult from an overhead view, proved challenging from a first-person perspective without an overhead view or compass. This feedback helped her adjust the difficulty of the first area to better suit new players.

    Future Plans

    Looking ahead, she plans to explore non-flat levels and dynamically stitching multiple maps together. This might result in overlaps while rendering, so the ray caster will be in charge of telling the graphics card what to draw. Meanwhile, she will focus on improving floor and ceiling loading performance, although this is currently less critical due to the few vertices involved.

    Lauren believes that developing a game is a great way to introduce people to programming. While tools are useful, having something that you can play with is fun. Old tile-based games and raycasters are particularly appealing to her because they are simple to work with, even for beginners.

    Overall, Lauren believes that Squeak has proven to be an excellent choice for her project, offering the simplicity and functionality needed for a successful game development experience.

    Why Not Give It a Try?

    If you would like to experiment with ray casting in Squeak, you can find out more about her project from SqueakSource here. To use the 3D accelerated package, you will also need AbstractGPU by Ronie Salgado, available (here). Ronie is the author of a number of terrific 3D development tools, including Woden (here) and Sysmel (here). Be sure to explore these excellent resources as well!

    Have a great time with Smalltalk and keep on Squeaking!

  • Discover BYTE Magazine Archives at World Radio History: A Valuable Resource for Tech Enthusiasts and Smalltalk Historians

    Discover BYTE Magazine Archives at World Radio History: A Valuable Resource for Tech Enthusiasts and Smalltalk Historians

    Tim Rowledge, a dedicated community member and long-time contributor, has uncovered a fantastic resource for tech enthusiasts: a comprehensive archive of BYTE magazine issues hosted on World Radio History. This well-organized collection spans from 1975 to 1994 and offers a detailed look at the technological advancements of the time, including the early development of Smalltalk. You can explore the archive here.

    Among the highlights is the August 1981 edition, famous for featuring the iconic Smalltalk balloon on its cover. This issue is notable for introducing Smalltalk’s unofficial logo. Curious about the significance of the hot air balloon and what it represents? Delve into this intriguing piece of history on the Squeak wiki. You can access the 1981 edition here.

    Also of interest is the August 1991 issue, which includes the article “Smalltalk: 10 Years of Objects.” This piece provides a retrospective and a forward-looking view on Smalltalk, reflecting on its progress since the 1981 feature. You can view this edition here.

    World Radio History’s BYTE magazine archive is a valuable tool for anyone interested in the history of computing and programming languages, offering both a broad overview and specific insights into the technology of the past.

    Additionally, Tim also found some other nice historical videos presented by Capt. Grace Hooper at NSA in 1982 on “Future Possibilities: Data, Hardware, Software, and People.” You may find some fascinating bits of history from her lectures. You can view part 1 here and part 2 here.

    The BYTE archive, along with these historical videos, offers a unique perspective on how early technologies and visionary ideas have shaped modern computing. Together, they provide an invaluable window into the technological advancements and influential figures that have defined the computing landscape.

  • Announcing GraphQL for Squeak: A Structured Query Language for Flexible API Development

    Announcing GraphQL for Squeak: A Structured Query Language for Flexible API Development

    A few days ago, Chris Muller announced the immediate availability of GraphQL for Squeak, a package that allows efficient data query and manipulation within the Squeak environment using the powerful GraphQL language. This release introduces a comprehensive implementation of the GraphQL specification, opening another door for Smalltalk developers to create flexible, performant applications with real-time capabilities.

    What Is GraphQL?

    GraphQL is an API query language that allows clients to request precisely the data they need, and nothing more. Unlike traditional REST APIs, where multiple endpoints return fixed data structures, GraphQL provides a single endpoint and a flexible query system. This system empowers clients to define the structure of the response, making it highly efficient and tailored to their needs.

    GraphQL is particularly well-suited for applications that require real-time data updates and complex queries. It supports features such as strong typing, relationships between data types, and aggregating multiple resources into a single query. These characteristics make GraphQL a great fit for building robust servers and clients in Squeak, particularly when dealing with complex domain models and the need for real-time data synchronization.

    Introducing GraphQL for Squeak

    The GraphQL implementation for Squeak, developed by Chris Muller, strictly adheres to the current GraphQL specification (October 2021) and is made available under MIT license. This is a complete implementation. Every grammar, validation, and execution rule defined in the specification is covered by at least one test case. The framework integrates seamlessly with Squeak.

    Key Features:

    • Complete GraphQL Specification Compliance: The implementation covers every aspect of the GraphQL specification, ensuring that your applications can utilize all features, including asynchronous subscriptions.
    • Documentation and Examples: Included help pages illustrate working examples, making it easy to get started and explore the capabilities of the framework.
    • Modular and Extensible: Type systems (and their associated resolvers) can be defined and assembled into complete applications.
    • Custom Scalar Types and Directives: Several additional custom scalar types and powerful directives are included to enhance your development experience and streamline common tasks.

    Interoperability Is King

    One benefit of GraphQL is how conformance to a standard fosters greater interoperability between not only systems but the groups surrounding them: whether between users and developers, organizations and their customers, or front-end and back-end technologies – GraphQL optimizes the right separations of concerns.

    For example, having a standard way to inspect the schema of a live GraphQL-based system opens possibilities for automated cooperation that are impossible without a standard. As organizations publish their GraphQL schemas, implementers can help optimize their customer-facing experience with tools that capitalize on the features of GraphQL. GraphQL allows certain elements like type and field definitions to have integrated markup “documentation” which could be rendered in user interfaces, or as a page in a generated “help” compendium. The possibilities are limitless.

    Being able to easily parse and interact with other organizations’ GraphQL schemas directly in the image could open new potentials for integration. Exploring the following expression lets one browse the type definitions and directives of the GitHub GraphQL API:

    GqlParser parse:
    	(WebClient httpGet:
    		'https://docs.github.com/public/fpt/schema.docs.graphql') content

    Try It Out!

    Install the GraphQL package into Squeak Trunk by selecting the (head) version of the project from the SqueakMap window (available via the Apps menu of the world main docking bar).

    Alternatively, simply execute this in a workspace:

    Installer new merge: #graphQlTestsEngine

    To verify the installation, tests can be found under the GraphQL-* packages in the TestRunner (available under the Tools menu).

    To get started, you can run the following snippet, which creates a small but complete GraphQL engine for searching all classes in the system for certain names.

    | system engine |
    
    "Define a small type system and its resolver."
    system := GqlSystemDefinition
    	typeSystem: '
    		type Class {
    			name : String!
    			superclass : Class
    		}
    		type Query {
    			findClasses(pattern : String) : [Class!]!
    		}'
    	resolver: 
    		(GqlCraftedSchemaResolver new map: {
    			{ 'Query'. 'findClasses'. SystemNavigation. #allClassesAndTraitsMatching:. #('pattern') }.
    			{ 'Class'. 'name'. Class. #name }.
    			{ 'Class'. 'superclass'. Class. #superclass }
    		}).
    
    "Instantiate the engine, supply a domain provider."
    engine := GqlEngine
    	systemDefinition: system 
    	providers: {self systemNavigation. nil. nil}.
    
    "Execute the only possible query, request the name and the superclasses' name for each result."
    (engine execute: '{
    	findClasses(pattern: "*Collection") {
    		name
    		superclass { name }
    	}
    }') response data

    This query will return the following JsonObject:

    Help Is Available

    After loading the package, a “GraphQL” section will also become available in Squeak’s Help Browser (available via the help menu in the docking bar), where you can find detailed guidance and more complex examples to experiment with.

    Roadmap

    The next step is a networking package to accept GraphQL requests sent from a client to a server and return the JSON responses. This is well underway and planned to be released soon.

    Happy Squeaking!

    Authors: Chris Muller and Christoph Thiede

  • Squeak Turns 20!

    Please Donate to Squeak!

    Craig Latta writes:

    Hi all–

    Happy 20th birthday to us! It was twenty years ago that Dan Ingalls and the rest of Alan Kay’s team announced Squeak to the world. You really changed things with this run at the fence. 🙂  Thanks again!

     

     


    Back to the Future

    The Story of Squeak, A Practical Smalltalk Written in Itself

    by

    Dan Ingalls Ted Kaehler John Maloney Scott Wallace Alan Kay

     

     

  • Squeak 4.5 Released!

    squeak4.5

    From Chris Muller:

    So!  Let it be known!  Squeak 4.5 is released!

    Home page is here:  http://www.squeak.org

    4.5 release notes are here:  http://wiki.squeak.org/squeak/6193

    Excellent Job Everyone!!  Can you tell we are excited!

  • Cog Development Welcomes Clément Béra

    Bert VM Icon(icon by Bert)

    Word has it that Clément Béra is working With Eliot Miranda on Cog.  Göran pointed out Clements excellent blog: here, to me a few weeks ago after meeting him at ESUG.

    From Eliot: Clément Béra is, amongst other things, working on Cog performance, looking at adaptive optimization/speculative inlining (Sista in Cog, for Speculative Inlining Smalltalk Architecture).

    I just wanted to welcome Clément Béra and to say thank you to everyone working on the VM for both communities, you know who you are (and we do to) and especially Eliot for working on Cog and keeping the advancements coming!  Hip Hip … and all that.

  • Etoys at Maker Faire in Hannover

    BertShowsEtoys

    Etoys, children, a funny hat and a handmade Smalltalk balloon.  What more could you ask for!  Looks like a great day for everyone.

    Read more about it here: http://squeaklandnews.blogspot.de/

  • Doug Engelbart, American inventor and computing legend, Dies at 88.

    Sad news.  Most of the Smalltalk community knows all about Doug through stories shared by Alan.  Some of you have been lucky enough to have met him.  Much of what we know about computers was invented by some really terrific minds.  Today we lost one of the best.  It is amazing how far technology has progressed in such a short time.  We are lucky to live in a time that still has so many of the great inventors still alive.  It’s an amazing time to be standing the the shoulders of giants.  Alan Kay reminds us that all of the present is not made up of all of the past.  Only part of what was done back then survived and is in use today.  Some of our history is better than our present.  We should all take a moment and remember that past.

    I couldn’t help but notice that Doug has three controls.  The Mouse the keyboard and what?  A function menu?  A view selector? Just what is that left hand doing?  I know I’ve tried to explain ctrl-c to people and even today many people have no idea that keyboard shortcuts exist.  Just a thought.

    http://www.nytimes.com/2013/07/04/technology/douglas-c-engelbart-inventor-of-the-computer-mouse-dies-at-88.html?pagewanted=all&_r=3&

    http://gigaom.com/2013/07/03/doug-engelbart-american-inventor-computing-legend-passes-away/