Adding Generators To My Falling Sand Simulator

I’m thrilled to have you back for our latest update. In our previous session, I introduced Oil into our simulation, marking a significant step forward. I wrapped up by hinting at an exciting development phase on the horizon: the creation of a brand-new painter tool. Discover more about the recent Oil addition here.

Navigating the Challenge of Scope Creep

This phase extended beyond its expected timeline, and the culprit was none other than the notorious scope creep. It serves as a cautionary tale, urging you to be vigilant in your own projects. Scope creep occurs when you find yourself adding more to your project than initially planned.

Originally, our goal was straightforward: create a simple way to paint elements using your mouse, with the added functionality of switching between elements using the number keys. However, as I delved deeper, I felt that this concept was too basic for a comprehensive post.

To enhance the project, I introduced the concept of brush size. Now, not only can you paint elements on the screen, but you can also play around with different brush sizes, adding a whole new layer of fun to the interaction with the elements.

Crafting a Seamless User Interface Experience

The journey into developing a user interface (UI) for the simulation was quite the adventure. Initially, I dove headfirst into the process, but upon realizing the substantial workload involved, I decided to explore third-party solutions. Enter Myra – a game-changer in the UI realm, designed specifically for Monogame, FNA, and Stride.

Myra streamlined the startup process for Monogame, simplifying it into a few key steps:

  1. Instantiate a Myra Object: Create a Myra object named ‘desktop,’ essentially functioning as a screen.
  2. Connect Myra to Our Game Instance: Establish a connection between the Myra “Engine” and our Game Instance.
  3. Build GUI Elements: Construct the desired GUI elements using the desktop object.
  4. Render Graphics: Execute the render function within the desktop object to display the graphics.

For an in-depth understanding, check out the Quick Start Tutorial on Myra’s GitHub.

Armed with this newfound knowledge, I went a step further and developed a wrapper class, aptly named GUIManager. This class serves as a central hub for setup, allowing different components of the simulation to seamlessly integrate their unique GUIs.

In my maiden attempt, I applied this concept to the Simulator Painter Class, known as SimulationController.

This innovative approach not only eases the UI development process but also fosters adaptability for future enhancements.

Innovating Debugging: Game Stats and Console Logs

Amidst the development journey, a detour caught my attention. While relying on the conventional terminal for game stats and console logs initially sufficed, performance hiccups prompted me to seek a more integrated solution. In an attempt to tackle this issue, I ventured into uncharted territory, envisioning these essential elements seamlessly embedded within the simulation itself.

With an unexpected leap into scope creep, I navigated this new challenge and deepened my familiarity with Myra. The result? A refined debugging interface that not only resolves performance concerns but also enhances the overall user experience.

Now, with a simple keystroke, you can dynamically toggle between game stats and the console. Press “R” to reveal insightful game statistics, shedding light on crucial performance metrics. Alternatively, hit “C” to unveil the console, providing a direct window into the inner workings of the simulation.

This endeavor not only addressed performance issues but also afforded me invaluable experience with Myra’s capabilities. The demo illustrates the newfound efficiency and user-friendly accessibility brought about by this innovative debugging UI.

Elevating the Painter’s Interface with MyraPad

A game-changer in enhancing the Painter’s interface was the incorporation of MyraPad. With a touch of additional programming finesse, I seamlessly integrated a final GUI, taking the simulation controller’s user interface to new heights.

The brilliance of MyraPad lies in its ability to effortlessly transform a desired GUI into an XML representation. Importing this XML version into the project became a breeze. However, it’s worth noting that the XML itself remained devoid of any code logic; that part was my own contribution.

As with any development, challenges arose. One notable issue involved a bug when attempting to paint while interacting with the GUI. Fear not, though—I identified and resolved this concern, ensuring a smoother and more enjoyable user experience.

The demo showcases the result of this integration: a painter’s interface that seamlessly combines MyraPad’s capabilities with my programming expertise. It not only elevates the aesthetics but also enhances the functionality of the simulation controller UI.

Scope Creep Chronicles: The Arrival of Element Generators

As you might have spotted, the “Place Generator” button stands as evidence of Scope Creep’s encore appearance. This time around, my ambition led me to introduce element generators into the mix. These generators work their magic by creating elements upon placement, and intriguingly, they have a limited lifespan—fading away after a set duration. To add a touch of anticipation, they start blinking after 5 seconds, signaling their imminent departure.

And so, the simulation took on an unexpected yet exciting twist, showcasing the dynamic evolution spurred by the ever-elusive Scope Creep.

But that’s not all. The GUI received a delightful upgrade, featuring a subtle but engaging pop—a finishing touch to enhance the overall aesthetic appeal.

This video encapsulates the culmination of my journey, highlighting the persistent dance with Scope Creep and the remarkable transformations it brought to the simulation.

Unveiling Myra and MyraPad: A Candid Review

Let’s kick off with the positives. Myra and MyraPad – a dynamic duo that rescued me from an avalanche of work. The library, in its current iteration (1.5.3 at the time of this post), is a powerhouse, and I’m genuinely excited about its future potential. To anyone eyeing this library, my earnest recommendation is to leverage MyraPad for crafting your UI in XML. Pair it up with an IDE like VScode for seamlessly adding and organizing elements. Think of MyraPad as the stylist of your UI, offering a level of control akin to inline CSS in web development.

Now, onto my humble wishlist for the Myra developers:

1. Documentation Upgrade: While the existing documentation provided a solid starting point, there’s room for improvement. Navigating it proved challenging when seeking specific information or exploring Myra’s full repertoire. A comprehensive dictionary of widgets – encompassing all elements like panels, buttons, and text inputs – would be a game-changer. The simplicity of the “Simple Widgets” page is a good foundation, but we need an exhaustive catalog.

2. MyraPad Enhancement: MyraPad, the XML editor, could use a touch-up. As it stands, the current XML editor functions as a basic text editor, reminiscent of Notepad. It would immensely benefit from the user-friendly experience that VScode provides for XML editing. Alternatively, a visual IDE within MyraPad for building XML files could be a boon. This would be particularly advantageous for designers with a knack for aesthetics but limited markup language proficiency.

In summary, while Myra and MyraPad have been indispensable allies in my project, a few tweaks could elevate the user experience and accessibility for developers and designers alike.

Experience the Simulation: Dive In and Play!

I’m thrilled to announce that the Falling Sand Simulation is now available for you to explore and enjoy on itch.io!

Here’s the link: Falling Sand Simulation on itch.io

I encourage you to dive in, experiment with the elements, and witness the evolution of the simulation that we’ve crafted together. Your feedback and exploration will add another layer to this project, making it a collaborative experience.

Thank you for being a part of this exciting endeavor. I can’t wait to hear your thoughts and see the creativity you bring to the Falling Sand Simulation.

Taking a Breather and Looking to the Horizon

As I conclude this chapter of my project journey, I find myself at a juncture where a brief hiatus beckons. Stepping back allows for reflection, rejuvenation, and a fresh perspective when I return to the canvas of code. The dynamic evolution of this simulation has been both challenging and rewarding, and the break serves as a pause for introspection and newfound inspiration.

During this interim period, my curiosity is drawn toward a fascinating realm – SCORM, a technology synonymous with interactive learning objects in Learning Management Systems (LMS). Exploring SCORM promises to unveil new dimensions in interactive education, and I’m eager to delve into its intricacies.

On another horizon, there’s a lingering desire to share insights into the captivating world of game pathfinding techniques. Crafting a comprehensive guide would not only solidify my understanding but also contribute to the community of game developers seeking navigation solutions.

As I embark on this hiatus, I express my gratitude to all who have followed this journey. Your support fuels the passion for exploration and innovation. Stay tuned for the next chapter, where I’ll unravel the mysteries of SCORM or navigate the intricate paths of game pathfinding techniques.

Until then, happy coding, and may your projects flourish with creativity and success.

Michael Mena