Final Project: Many Worlds

Concept

At the heart of my final project lies an ambitious vision: to visually explore and simulate the fascinating theories of multiverses and timelines in physics. This journey, powered by p5.js, delves into the realm where science meets art, imagining our universe as merely one among an infinite array of possibilities. The project captures the essence of the multiverse theory, the many-worlds interpretation, timeline theory, and the intriguing butterfly effect, presenting a dynamic canvas where every minor decision leads to significant, visible changes.

Images

User Testing

Implementation

Description of Interaction Design

Initial User Engagement: Upon launching the simulator, users are greeted with an informative popup window. This window sets the stage for their cosmic journey, outlining their role in crafting universes and navigating timelines. It provides clear instructions on how to interact with the simulation, ensuring users feel comfortable and engaged from the outset.

Canvas Interaction:

  • Creating Timelines: The primary interaction on the canvas is through mouse clicks. Each click places a gravitational point, the inception of a new timeline. This action leads to the emergence of diverging lines, symbolizing the branching of timelines in the multiverse.
  • Timeline Dynamics: The lines stemming from each point spread across the canvas, intertwining to form a complex network of timelines. This visualization represents the ever-evolving nature of the universe, with each line’s path shaped by random divergence, creating a unique multiverse experience.
  • Dimensional Shifts: The use of arrow keys allows users to shift dimensions. Pressing the ‘Up’ arrow key transforms the lines into particle-like forms with a whiter hue, representing the dual nature of light as both particle and wave. This shift is a metaphor for viewing the cosmos from a different dimensional perspective. Conversely, the ‘Down’ arrow key reverts these particles into their original line state, symbolizing a return to the initial dimension.

Customization and Control:

  • Radius and Decay Parameters: Users can adjust the radius of the gravitational points and the decay rate of the timelines. These parameters influence the behavior of the timeline strings, allowing for a more personalized and interactive experience.
  • Interactive Buttons:
    • Clear Button: Resets the canvas, clearing all timelines and providing a fresh start.
    • Random Button: Randomizes the radius and decay parameters, introducing an element of unpredictability.
    • Update Button: Applies changes made to the radius and decay settings, updating the canvas accordingly.
  • Precise Editing: By holding the shift key and clicking, users can erase specific parts of the timelines, allowing for detailed adjustments and creative control.

This design not only immerses users in the concept of multiverses but also offers an intuitive and engaging way to visualize complex physics theories. Through simple yet powerful interactions, the Multiverse Simulator becomes a canvas where science, art, and imagination converge.

Technical implementation side

Key Steps in Particle Simulation:

  1. Sense: Each particle senses its environment in a unique way, employing three sensors to detect the surroundings based on its heading direction.
  2. Rotate: The particle’s rotation is determined by the sensor readings, allowing it to navigate through the canvas in a realistic manner.
  3. Move: After determining its direction, the particle moves forward, creating a path on the canvas.
  4. Deposit: As particles move, they leave a trace in the form of yellow pixels, marking their journey.
  5. Diffuse: The trail left by each particle expands to the neighboring cells, creating a more extensive network of lines.
  6. Decay: The brightness of each pixel gradually fades, simulating the decay effect over time.

Code Snippets

The core functionality of the project is encapsulated in several key functions:

  • Particle Sensing and Movement:
function sense() {
  // The sense function is responsible for the decision-making process of each particle.
  // - It uses three sensors (left, center, right) to detect the environment ahead of the particle.
  // - Based on the sensor readings, the particle decides whether to continue straight, turn left, or turn right.
  // - This decision influences the particle's path, creating intricate patterns on the canvas as particles avoid their own trails.
  for (let i = 0; i < particles.length; i++) {
    let options = [0, 0, 0];
    options[1] =
      attracters[
        modifiedRound(particles[i][0] + SO * cos(particles[i][2]), "x")
      ][modifiedRound(particles[i][1] + SO * sin(particles[i][2]), "y")];
    options[0] =
      attracters[
        modifiedRound(particles[i][0] + SO * cos(particles[i][2] + SA), "x")
      ][modifiedRound(particles[i][1] + SO * sin(particles[i][2] + SA), "y")];
    options[2] =
      attracters[
        modifiedRound(particles[i][0] + SO * cos(particles[i][2] - SA), "x")
      ][modifiedRound(particles[i][1] + SO * sin(particles[i][2] - SA), "y")];
    if (options[1] >= options[2] && options[1] >= options[0]) {
      continue;
    } else if (options[0] > options[2]) {
      particles[i][2] = (particles[i][2] + RA) % TWO_PI;
    } else if (options[0] < options[2]) {
      particles[i][2] = (particles[i][2] - RA) % TWO_PI;
    } else {
      let rand = Math.random();
      if (rand < 0.5) {
        particles[i][2] = (particles[i][2] + RA) % TWO_PI;
      } else {
        particles[i][2] = (particles[i][2] - RA) % TWO_PI;
      }
    }
  }
}
  • Canvas Interaction:

    function canvasClick() {
      // This function handles user interactions with the canvas.
      // - If the SHIFT key is held down while clicking, it removes particles within the click radius.
      // - If the ENTER key is held, it adds a new emitter at the mouse location.
      // - Otherwise, it spawns new particles around the click location within the specified radius.
      // Each particle is initialized with a random direction.
      if (keyIsDown(SHIFT)) {
        const notRemoved = [];
        for (let xs of particles) {
          if (
            Math.sqrt((mouseX - xs[0]) ** 2 + (mouseY - xs[1]) ** 2) > clickRadius
          ) {
            notRemoved.push(xs);
          }
        }
        particles = notRemoved;
      } else if (keyIsDown(ENTER)) {
        emitters.push([mouseX, mouseY]);
      } else {
        for (
          let i = 0;
          i < particlesPerClick && particles.length < maxParticles;
          i++
        ) {
          let dis = clickRadius * Math.random();
          let ang = TWO_PI * Math.random();
          let x = mouseX + dis * cos(ang);
          let y = mouseY + dis * sin(ang);
    
          particles.push([x, y, TWO_PI * Math.random()]);
        }
      }
    }
  • Decay:

    function decay() {
      // This function manages the decay and diffusion of particle trails.
      // It updates the visual representation of each particle's trail on the canvas.
      // - First, it iterates over the canvas, applying the decay factor to reduce the brightness of trails.
      // - Then, it applies a blur filter (simulating diffusion) to create a smoother visual effect.
      // - Finally, the attracters array is updated based on the decayed and diffused pixel values.
      for (let i = 0; i < imageWidth; i++) {
        for (let j = 0; j < imageHeight; j++) {
          writePixel(at, i, j, attracters[i][j]);
        }
      }
      at.filter(BLUR, diffK);
      for (let i = 0; i < imageWidth; i++) {
        for (let j = 0; j < imageHeight; j++) {
          attracters[i][j] = at.pixels[(i + j * imageWidth) * 4] * decayT;
        }
      }
      at.updatePixels();
    }

    Aspects of the Project I’m Particularly Proud Of

    Reflecting on the development of the Multiverse Simulator, there are several aspects of this project that fill me with a sense of pride and accomplishment:

    1. Complex Algorithm Implementation: The heart of this project lies in its complex algorithms which simulate the behavior of particles in a multiverse environment. Successfully implementing and fine-tuning these algorithms — particularly the sensing, rotating, moving, depositing, diffusing, and decaying behaviors of particles — was both challenging and rewarding. The intricacy of these algorithms and how they bring to life the concept of timelines and multiverses is something I am exceptionally proud of.
    2. Interactive User Experience: Designing an interactive canvas where users can directly influence the creation and evolution of timelines was a significant achievement. The fact that users can engage with the simulation, spawning and altering timelines through intuitive mouse interactions, adds a dynamic layer to the project. This level of interactivity, where each user’s actions uniquely shape the cosmos they’re exploring, is particularly gratifying.
    3. Visual Aesthetics and Representation: The visual output of the simulation is another aspect I take great pride in. The way the particles move, interact, and leave trails on the canvas has resulted in a visually captivating experience. The transition between states — from lines to particles and back, depending on user interaction — not only serves as an artistic representation of the multiverse concept but also adds a profound depth to the visual experience.
    4. Optimizing Performance: Tackling the computational challenges and optimizing the simulation to run smoothly was a significant hurdle. Achieving a balance between the visual complexity and maintaining performance, especially when dealing with thousands of particles and their interactions, was a rewarding challenge. The fact that the simulator runs efficiently without compromising on the intricacies of its visual representations is a testament to the effectiveness of the optimization strategies employed.
    5. Educational Value: The project is not just an artistic endeavor; it’s also an educational tool that visually demonstrates complex physics theories in an accessible and engaging way. Bridging the gap between complex scientific concepts and interactive visual art to create a learning experience is an achievement that adds a lot of value to this project.

Links to Resources Used

In the journey of creating the Multiverse Simulator, various resources played a crucial role in guiding the development process, providing technical knowledge, and inspiring creativity. Here’s a list of some key resources that were instrumental in the project:

  1. Particle System Tutorials:
    • The Nature of Code by Daniel Shiffman: This book and its accompanying videos offer an in-depth look at simulating natural systems using computational models, with a focus on particle systems that was particularly relevant to this project.
  2. Physics and Multiverse Theory:
    • Multiverse Theory Overview: An academic article providing a detailed explanation of the multiverse theory, which helped in ensuring the scientific accuracy of the simulation.
    • Introduction to Quantum Mechanics: Articles and resources that offer a beginner-friendly introduction to quantum mechanics, aiding in conceptualizing the project’s scientific foundation.
  3. Coding Forums and Communities:
    • Stack Overflow: A vital resource for troubleshooting coding issues and learning from the experiences and solutions shared by the coding community.
    • Reddit – r/p5js: A subreddit dedicated to p5.js where developers and enthusiasts share their projects, tips, and ask questions.
  4. Performance Optimization:
    • Web Performance Optimization: Guidelines and best practices from Google Developers on optimizing web applications, which were crucial in enhancing the simulator’s performance.
  5. Software Development Best Practices:
    • Clean Code by Robert C. Martin: A book that offers principles and best practices in software development, guiding the structuring and commenting of the code for this project.

Demo

Full source code

Challenges Faced and How They Were Overcome

The development of the Multiverse Simulator presented several challenges, each demanding creative solutions and persistent effort. Here’s a look at some of the key hurdles encountered and the strategies employed to overcome them:

  1. Complex Algorithm Integration:
    • Challenge: Implementing the complex algorithms that simulate particle behaviors and interactions was a daunting task. Ensuring these algorithms worked in harmony to produce the desired visual effect required a deep understanding of both programming and physics.
    • Solution: To address this, I spent considerable time researching particle systems and physics theories. Resources like “The Nature of Code” were instrumental in gaining the necessary knowledge. Additionally, iterative testing and debugging helped refine these algorithms, ensuring they functioned as intended.
  2. Performance Optimization:
    • Challenge: The simulator’s initial iterations struggled with performance issues, particularly when handling a large number of particles. This was a significant concern, as it impacted the user experience.
    • Solution: Performance optimization was tackled through several approaches. Code was profiled and refactored for efficiency, unnecessary computations were minimized, and the rendering process was optimized. Learning from online resources about efficient canvas rendering and adopting best practices in JavaScript helped immensely in enhancing performance.
  3. User Interface and Experience:
    • Challenge: Creating an intuitive and user-friendly interface that could accommodate the complex functionalities of the simulator was challenging. It was essential that users could easily interact with the simulation without feeling overwhelmed.
    • Solution: The design of the user interface was iteratively improved based on user feedback and best practices in UI/UX design. Simplicity was key; the interface was designed to be minimal yet functional, ensuring that users could easily understand and use the various features of the simulator.
  4. Balancing Artistic Vision with Technical Feasibility:
    • Challenge: One of the biggest challenges was aligning the artistic vision of the project with technical constraints. Translating complex multiverse theories into a visually appealing and scientifically accurate simulation required a delicate balance.
    • Solution: This was achieved by continuously experimenting with different visual representations and consulting resources on generative art. Collaboration with peers and seeking feedback from artistic communities also provided fresh perspectives that helped in making the simulation both aesthetically pleasing and conceptually sound.
  5. Debugging and Quality Assurance:
    • Challenge: Given the complexity of the simulation, debugging was a time-consuming process. Ensuring the quality and reliability of the simulation across different platforms and devices was critical.
    • Solution: Rigorous testing was conducted, including unit testing for individual components and integrated testing for the overall system. Community forums like Stack Overflow were invaluable for resolving specific issues. Cross-platform testing ensured the simulator’s consistent performance across various devices.

Future Improvement Opportunities

Reflecting on the Multiverse Simulator’s journey, there are several areas where the project can be further developed and enhanced. Future improvements will focus on expanding its capabilities, refining user experience, and exploring new technological frontiers:

  1. Advanced User Interactions:
    • Enhancement: Introducing more sophisticated interaction methods, such as gesture recognition or touch-based inputs, could provide a more immersive experience. Integrating virtual or augmented reality elements could also take user engagement to a whole new level.
    • Implementation: Researching emerging technologies in AR/VR and experimenting with libraries that support these features could be the next steps in this direction.
  2. Richer Visual Effects:
    • Enhancement: Enhancing the visual aspects of the simulator with more detailed and diverse effects could make the experience even more captivating. Implementing additional visual representations of quantum phenomena could deepen the scientific authenticity of the project.
    • Implementation: Experimenting with advanced graphics techniques and shaders could provide a wider range of visual outputs, adding depth and variety to the simulation.
  3. Scalability and Performance:
    • Enhancement: Further optimizing the simulation for scalability to handle an even larger number of particles without performance loss would be beneficial. This could allow for more complex simulations and a richer visual experience.
    • Implementation: Leveraging web workers and exploring parallel processing techniques could improve performance. Profiling and optimizing current code to reduce computational overhead can also be continued.
  4. Educational Integration:
    • Enhancement: Developing an educational module that explains the underlying scientific concepts in an interactive manner could transform the simulator into a powerful learning tool.
    • Implementation: Collaborating with educators and scientists to create informative content and interactive lessons could help in integrating this feature.
  5. Community and Collaboration:
    • Enhancement: Building a community platform where users can share their creations, exchange ideas, and collaborate on simulations could foster a more engaged user base.
    • Implementation: Implementing social sharing features and community forums, along with user accounts for saving and sharing simulations, could help build this community.
  6. Accessibility and Inclusivity:
    • Enhancement: Ensuring the simulator is accessible to a diverse audience, including those with disabilities, can make the experience more inclusive.
    • Implementation: Adhering to web accessibility standards, incorporating features like screen reader compatibility, and providing different interaction modes for users with different needs are crucial steps.
  7. Feedback and Iterative Improvement:
    • Enhancement: Regularly collecting user feedback and iteratively improving the simulator based on this feedback can ensure that it continues to meet and exceed user expectations.
    • Implementation: Setting up feedback mechanisms, conducting user testing sessions, and regularly updating the simulator with improvements and new features.

IM Show

Final Project Update: many worlds

Progress Overview

Since my initial blog post outlining the ambitious concept of simulating multiverses and timelines, I have delved deep into the realms of coding and artistic expression using p5.js. My journey has been both challenging and exhilarating, as I work to bring the intricate theories of multiverses, timeline divergence, and the butterfly effect to life.

Implementing Gravitational Points and Line Formation

A significant milestone in my project has been the implementation of gravitational points on the canvas. These points act as origins for particles that radiate outward, forming random line figures reminiscent of strings. The concept is to simulate the idea of timelines diverging from a central point, influenced by random attractors placed throughout the canvas. This design choice aligns beautifully with the core theories driving my project, particularly the notion of intertwined timelines.

Attraction Between Lines

To enhance the visual appeal and to resonate more deeply with the underlying theories, I introduced an attraction mechanism between lines. This feature ensures that the lines not only diverge but also converge, creating a dynamic and visually stunning representation of timelines that are constantly interacting with one another.

Challenges and Solutions

Computational Intensity and Optimization

One of the major challenges faced during development has been the computational intensity required by the project. Initially, this limitation restricted me to working with a smaller canvas size. However, recognizing the need to expand and enhance the user experience, I am currently focused on optimizing the processes. The goal is to enable a larger canvas size without compromising the performance or the intricate details of the simulation.

Looking Ahead

Enhancing User Interaction

The next phase of the project will involve refining the user interaction methodology. While the current design allows for user influence through clicking and dragging, I plan to explore more intuitive and engaging ways for users to interact with the timeline network.

User Experience and Visual Aesthetics

In parallel with the technical optimizations, a key focus will remain on ensuring that the canvas is not only visually captivating but also intuitive for users. This includes fine-tuning the parameters like the thickness and color of the timelines and their interaction dynamics.

Demo

Conclusion

This project is a journey through the complexities of physics and the beauty of visual arts. As I continue to tackle the technical challenges and enhance the user experience, I am ever more excited about the potential of this simulation to provide a unique and thought-provoking exploration of multiverses and timelines. Stay tuned for more updates as the project evolves!

Week 11 Assignment: Social Cellular Automata

Overview

Purpose: To simulate the Conway’s Game of Life with a focus on visualizing the connections between neighboring living cells, symbolizing social interactions in society.

Concept

  • Inspiration: Based on the concept of Conway’s Game of Life, the project extends the idea to visually represent social interactions by clustering neighboring cells.
  • Symbolism: The clusters and connections between cells symbolize how individuals in society interact predominantly with those in close proximity.

Technical Description

Key Features:

  1. Cell Representation: Each cell is initially represented as a circle.
  2. Connection Mechanics: Alive neighboring cells are connected by lines, forming clusters.
  3. Interactivity:
    • Speed Control Slider: Allows users to adjust the speed of interactions and animations.
    • Freeze/Unfreeze Button: Users can pause and resume the animation at any time.

Implementation Details

  • Cellular Automata Logic: Describe the logic you used for the cell birth, survival, and death rules.
  • Cluster Visualization: Explain how you determined which cells are neighbors and the logic for connecting them with lines.
  • User Interface Components:
    • Speed Control Slider: Detail its implementation and how it affects the animation speed.
    • Freeze/Unfreeze Button: Explain the functionality and its impact on the animation state.

Challenges and Solutions

  1. Challenge: Visualizing connections between neighboring cells while keeping the visualization coherent and not overly cluttered was challenging, especially with many active cells.
    Solution: Introduced a threshold for connection visualization; only cells within a certain proximity are connected. Also, used varying line thickness and opacity to represent the strength or proximity of the connection, making the visualization more intuitive.
  2. Challenge: Ensuring that the UI elements like the speed control slider and freeze/unfreeze button responded swiftly to user interactions was challenging, particularly when the simulation was complex and resource-intensive.
    Solution: Decoupled the UI thread from the simulation thread. Implemented asynchronous updates to ensure UI responsiveness, allowing users to interact with controls without lag, irrespective of the simulation’s complexity.
  3. Challenge: Creating a visually appealing interface that also clearly conveys the underlying simulation principles was challenging, as too much emphasis on aesthetics could overshadow the functional aspect.
    Solution: Engaged in iterative design, incorporating user feedback to find the right balance. Simplified the UI to focus on essential controls and used color schemes and design elements that enhanced both the visual appeal and clarity of the simulation.

DEMO

  • Link to source code

Future Enhancements

1. Advanced Visualization Options

  • Description: Incorporate more sophisticated visualization techniques to represent the connections between cells. This could include 3D rendering or using advanced graphics effects like glow or dynamic color transitions to represent different states of cell clusters.
  • Purpose: To enhance the visual appeal and make the simulation more engaging, providing deeper insight into the patterns formed.

2. Customizable Rules for Cell Interactions

  • Description: Allow users to modify the rules governing cell birth, survival, and death. This could be done through a user-friendly interface where parameters can be adjusted to see how different rules affect the evolution of the pattern.
  • Purpose: To increase the educational value and interactivity of the simulation, giving users a hands-on experience in understanding the dynamics of cellular automata.

Conclusion

  • The “Social Cellular Automata” project in P5.js successfully achieved its primary goal of simulating Conway’s Game of Life with a unique twist. By visualizing the connections between neighboring living cells, the project not only presented a novel approach to cellular automata but also elegantly symbolized social interactions within communities.

Technical Accomplishments

  • The project demonstrated innovative use of P5.js, showcasing how programming and creative design can intertwine to produce a visually appealing and conceptually rich simulation. The implementation of interactive elements like the speed control slider and the freeze/unfreeze button added a layer of engagement, allowing users to interact with the simulation dynamically.

Conceptual Significance

  • The metaphorical representation of social interactions through the clustering and connecting of cells provided a thoughtful perspective on how individuals in society are interconnected. This aspect of the project goes beyond mere visual appeal, offering insights into the nature of social structures and interactions.

Final project draft: Many-worlds

Design Concept

Inspiration

Storyline and Artistic Intention

The core concept of this project is to visually explore the theories of multiverses and timelines in physics. Inspired by the idea that our universe is just one of many possible worlds, the project seeks to simulate the creation, divergence, and interaction of multiple timelines. Incorporating the butterfly effect, it demonstrates how minor decisions can lead to significant changes, emphasizing the interconnectedness and complexity of our universe.

Direction

The project will visually represent time as a network of lines, symbolizing different timelines that twist, intersect, and evolve. This ‘net of timelines’ will be dynamic, continuously changing and growing in response to user interactions.

Theories to be used

  1. Multiverse Theory:
    • Description: This theory suggests that there are multiple, perhaps infinite, universes coexisting alongside our own. Each universe within the multiverse can have different physical laws and fundamental constants.
    • Relation to Project: Representing each timeline as a part of a broader multiverse, where every decision branches out into a new universe or timeline.
  2. Many-Worlds Interpretation (MWI):
    • Description: An interpretation of quantum mechanics, MWI proposes that all possible alternative histories and futures are real and exist in a vast array of parallel universes.
    • Relation to Project: Simulation of the divergence of timelines in the canvas, reflecting the idea that every quantum event leads to a branching of the universe into a multitude of possible outcomes.
  3. Timeline Theory:
    • Description: This concept revolves around the notion of time as a linear or branching path, where events are ordered from past to future. It suggests that different choices or events can lead to different timelines.
    • Relation to Project: There will be a visual ‘net of timelines’ in my project that will embody this theory, with the user’s actions causing divergences and convergences in the timelines, illustrating how different choices can lead to different futures.
  4. Butterfly Effect:
    • Description: A principle of chaos theory stating that small causes can have large effects. The classic example is that the flap of a butterfly’s wings might ultimately cause a tornado.

Interaction Methodology

Chosen Interaction Method

The primary mode of interaction will be through a mouse. Users will influence the timeline network by clicking and dragging within the canvas.

Implementation Plan

  • Clicking on a blank area of the canvas will create a new timeline.
  • Dragging the mouse will cause the timelines to twist and merge.
  • Right-clicking (or a similar gesture) will allow users to erase or alter segments of the timelines.

Canvas Design

User-Interaction Instructions

Clear instructions will be provided on the canvas, guiding users on how to create, alter, and interact with the timelines.

Parameters and User Experience Plan

  • The canvas will be designed to be intuitive, with minimal instructions needed.
  • The parameters will include the thickness of the timelines, their color, and the degree to which they interact with each other.
  • A plan to guide the user experience will be illustrated, ensuring that the project is both visually captivating and easy to understand.

Sketch

Week 10 assignment: Proton-Electron Sandbox

Overview

The Proton-Electron Sandbox is an interactive simulation built using P5.js and Matter.js. It allows users to explore the behavior of charged particles, represented as balls, in an enclosed space. Balls can be either electrons (negatively charged) or protons (positively charged) and they interact with each other based on electromagnetic forces – like charges repel and opposite charges attract.

Files

  • index.html: The HTML file that hosts the canvas for the simulation.
  • Ball.js: Defines the Ball class representing charged particles.
  • Sketch.js: Contains the main logic for the simulation, including setup, draw loop, and event handling.

Ball.js

Class: Ball

Represents a charged particle in the simulation.

Constructor

  • x, y: The initial position of the ball.
  • radius: The size of the ball.
  • charge: The electrical charge of the ball (+1 for proton, -1 for electron).
  • options: Matter.js body options.

Methods

  • show(): Renders the ball on the canvas.
  • calculateForce(other): Calculates the electromagnetic force exerted on another ball.
  • applyForce(force): Applies a force vector to the ball.

Sketch.js

Global Variables

  • engine, world: Matter.js engine and world instances.
  • balls: Array holding all ball objects.
  • boundaries: Array holding boundary objects.

Function: setup()

Initializes the canvas, Matter.js engine, and world. Also sets up the boundaries.

Function: draw()

The main draw loop. Updates the physics engine, calculates and applies forces, and renders balls and boundaries.

Function: mouseClicked()

Handles mouse click events to create new balls at the cursor position with random charges.

Class: Boundary

Represents static boundaries in the simulation.

Constructor

  • x, y: Position of the boundary.
  • w, h: Width and height of the boundary.

Method

  • show(): Renders the boundary on the canvas.

Usage

To use the simulation, open index.html in a web browser. Click anywhere on the canvas to create new charged balls. Observe the interactions between the balls based on their charges.

Demo

Customization

  • Ball Properties: Modify the Ball class to change the appearance or behavior of the balls.
  • Force Strength: Adjust the force calculation in Ball.js to simulate different interaction strengths.
  • Boundary Configuration: Change the dimensions or positions of the boundaries in sketch.js.

Allien Intelligence Lecture reading response

The intersection of AI and architecture, as discussed in Neil Leach’s lecture, is both fascinating and challenging. From my perspective, the integration of AI into architecture heralds a significant shift in how we approach design and construction. AI’s ability to process vast amounts of data and generate innovative designs can lead to more efficient, sustainable, and aesthetically unique buildings. This could revolutionize the field, making architecture more accessible and adaptable to changing needs.

However, the lecture also touches on a critical concern: the potential impact of AI on employment within the architecture industry. As AI becomes more capable, it could potentially reduce the demand for traditional architectural roles, echoing broader concerns about AI’s impact on employment across various sectors. This raises important questions about the future of professional training and the evolving role of architects in a world where AI plays a central role in design processes.

The ethical considerations of AI in architecture, particularly regarding data privacy and the biases inherent in AI algorithms, are also crucial. As AI systems often learn from existing data, there’s a risk of perpetuating historical biases in design choices or urban planning.

While AI undoubtedly offers exciting opportunities for innovation in architecture, it also necessitates a careful consideration of its broader social, ethical, and professional implications. It’s crucial for architects and industry professionals to engage actively with these emerging technologies, shaping their development in a way that maximizes their benefits while mitigating potential drawbacks.

Assignment 9: Immune cells vs. Disease cells

Inspiration:

The inspiration for this project stems from the incredible complexity and beauty of the human immune system. Observing the intricate dance of immune cells as they work together to defend the body against invading pathogens is a mesmerizing spectacle. Additionally, the field of artificial life and emergent behavior in simulations served as a key inspiration. The idea of applying the principles of flocking behavior to simulate the coordinated movement of immune cells creates a visually compelling representation of their protective role in the body.

Concept:

The main concept behind this project is to use the principles of flocking behavior to simulate the movement and interactions of immune cells in response to the presence of disease cells. The flocking algorithm is based on three key principles:

  1. Separation: Each cell maintains a certain distance from its neighbors, representing the need for immune cells to avoid crowding, ensuring efficient patrolling of the body.
  2. Cohesion: Cells are drawn towards the average position of their neighbors, promoting a sense of unity and collaboration in the immune response.
  3. Alignment: Cells align their direction with that of their neighbors, mimicking the cooperative movement of immune cells as they collectively respond to threats.

The disease cells, represented as potential pathogens, introduce a dynamic element to the simulation. They act as attractors, causing nearby immune cells to adjust their movement to intercept and neutralize the threat.

Demo:

Reflection:

This project serves as a visual exploration of the principles of flocking behavior applied to the context of the immune system. Through this simulation, the intricate choreography of immune cells is brought to life, providing a dynamic and engaging representation of their vital role in protecting the body.

The use of P5.js as the framework for this project allowed for a seamless integration of visual elements and behavioral logic. Experimentation with parameters such as separation distance, cohesion strength, and alignment influence provides an opportunity to fine-tune the simulation and observe the emergent patterns that arise.

Additionally, the project opens up possibilities for educational purposes, as it provides a tangible and interactive way for individuals to grasp the collective behavior of immune cells. By observing the simulation, users can gain a deeper understanding of the coordinated efforts employed by the immune system to maintain health and combat potential threats.

In conclusion, this project not only explores the artistic potential of simulating immune cell behavior but also serves as a tool for educational outreach, bridging the gap between art and science to enhance our appreciation for the complexity of the human body’s defense mechanisms.

Assignment 8: Snickers and Mouths

Inspiration:

Inspired by the playful movements of animals in nature and classic video games, this project aims to bring a sense of whimsy and curiosity to the canvas. It draws from the idea of contrasting behaviors in a dynamic and visually engaging way.

Concept:

The project features a canvas where Snickers and Mouths, represented as animated elements, interact with distinct steering behaviors.

  • Snickers: These elements wander aimlessly around the canvas, moving in a random and carefree manner, much like the unpredictable paths of creatures in the natural world.
  • Mouths: Mouths, on the other hand, are purposeful seekers. They are drawn to the Snickers and move strategically to follow them, akin to the way predators seek their prey.

This simple concept focuses on the contrast between wandering and seeking behaviors, creating a visually captivating and contemplative experience for viewers.

Program

 

Midterm Project – Generative Artistry


Concept 🧠

“Generative Artistry” is a project that seamlessly transitions from an interactive Pac-Man-inspired game to a mesmerizing display of generative art. This transition serves as a metaphor for the creative process itself, highlighting the unpredictable and varied approaches artists take to contribute to a shared vision. The project simulates the collaborative work of artists, with each “artist” independently contributing to the creation of a shared artwork.

Artistic Vision 🎨

Inspiration 💡

The inspiration for this project was to explore the idea of how multiple artists, each with their own unique style and perspective, can collaborate to create a shared artwork. The project draws inspiration from the chaos and unpredictability of artistic creativity and how individual contributions can come together to form a cohesive whole. The use of randomness, metaphor, and progressive revelation in the project aims to engage users and make them part of this creative journey.

Research 🔍

Initially I had an issue where every artist was working independently and the final outcome was quite messy and random, so I had to tweak the randomness part and researched how to make the each individual part to be relatively close. This led me to the topic of image convolution (8 neighbouring artists influence the 9th artist so that eventually the art doesn’t loose the original silhouette).

Coding Translation and Logic 🔄

The project was meticulously planned to create a seamless transition from the Pac-Man game to generative art. The main challenge was coordinating the actions of individual “artists” (represented by circle balls) to ensure that their movements and colors contribute to the overall artwork.

Coding Logic 💻:

  • The Pac-Man game is created with user control of a red ball using arrow keys.
  • Yellow balls move randomly, adding unpredictability.
  • Once all yellow balls are consumed, the game transitions to generative art.
  • The generative art canvas is populated with circle balls that move unpredictably.
  • Each walker looks looks for 8 neighbouring colors to have the same scale of color for current pixel in the canvas.
  • Each circle ball represents an “artist” and leaves a trail of colors behind.
  • The collective movement and colors gradually form a shared artwork.

Coding Snippet 📝:

// Code snippet for handling the transition from game to generative art 
if (pacManEaten) { 
  // Transition to generative art 
  gameState = "art"; 
  initializeArtists(); 
}
// propogated rgba color value for given pixel that depends on color of neighbouring pixels
let color = [0, 0, 0, 0];
neighbors.forEach((neighbor) => {
  // pixel values of neighbour pixel
  let pixelColor = img.get(neighbor[0], neighbor[1]);
  // randomizing and color transformation
  if (!this.targetKnown) {
    // in case there is no given target image, then abstract colors
    color[0] += pixelColor[0] + random(-20, 50);
    color[1] += pixelColor[1] + random(-20, 50);
    color[2] += pixelColor[2] + random(-20, 50);
    color[3] += pixelColor[3] + random(-20, 50);
  } else {
    // in case there is a given target image
    color[0] += 255 - pixelColor[0] + random(-20, 50);
    color[1] += 110 - pixelColor[1] + random(-20, 50);
    color[2] += 200 - pixelColor[2] + random(-20, 50);
    color[3] += pixelColor[3] + random(-20, 50);
  }
});
// max rgba color values among neighbouring pixels; it is needed to map the pixel color to 255 range because each rgba value is a sum of neighbours
let maxColor = [0, 0, 0, 0];
neighbors.forEach((neighbor) => {
  let pixelColor = img.get(neighbor[0], neighbor[1]);
  let overall = pixelColor[0] + pixelColor[1] + pixelColor[2];
  let maxOverall = maxColor[0] + maxColor[1] + maxColor[2];
  // tracking the max pixel color
  if (overall > maxOverall) {
    maxColor = [pixelColor[0], pixelColor[1], pixelColor[2], pixelColor[3]];
  }
});
color = color.map((c, index) => {
  // mapping the rgb color to 255 range and mapping alpha to 0-1 range
  if (index === 3) return constrain(c / neighbors.length, 0, 1);
  return Math.floor(constrain(c / neighbors.length, 0, 255));
});

Pen plotter sketch ✏️:

Demo 📺

Link to source code

Challenges 🏋️‍♂️🔥:

  • Coordinating independent movements of the “artists” to create a cohesive artwork.
  • Implementing a system where each artist’s color and movement are influenced by its neighboring artists.
  • Creating a smooth transition between the game and generative art phases.

Proud Moments 😊🏆:

  • Successfully achieving coordination among individual artists, creating a shared vision.
  • Utilizing kernel operations on image matrices to ensure that artists’ colors are influenced by their surroundings.
  • Tweaking different colors.

Pen Plotting Translation 🔄

Pen plotting was utilized to create a physical representation of the generative artwork. The code had to be adapted to accommodate for plotting, taking into consideration factors such as pen movement, paper size, and ink color.

Pen Plotting Process 🏭:

  1. The generative art canvas was scaled to fit the plotting paper size.
  2. Pen movements were synchronized with the movements of the “artists” on the canvas.
  3. Special attention was given to adjusting the line weight and color to achieve the desired physical output.
  4. In order to generate more aligning SVG files, I reduced the number of walkers so that less noise and less trace is left on the canvas.
  5. To make the plotting more visually appealing, I layered the same SVG on top of itself and moved a bit to sides to create a glitch effect, drawing each layer with different colors.

Areas for Improvement and Future Work 🔍📈🔮

While the project successfully demonstrates the collaborative aspect of generative artistry, there is always room for improvement and expansion:

  1. Collaborative Interaction: Enhance the collaborative interaction among “artists,” allowing them to influence each other’s movements and colors more dynamically.
  2. User Engagement: Implement additional interactive elements to engage users during both the game and generative art phases.
  3. Visual Enhancements: Experiment with different visual effects and techniques to create even more stunning generative artwork.
  4. Extended Metaphor: Develop the metaphor of the creative process further to provide users with a deeper understanding of the art-making journey.
  5. Expand Plotting: Explore the possibility of creating physical artworks with more complex pen plotting techniques, potentially incorporating new media or materials.

Overall, “Generative Artistry” provides a captivating experience that can be further developed and expanded to explore the depths of collaborative art creation and user engagement.

Other projects developed 🏗️📋

Midterm progress 2: Generative Artistry, Zulfkhar

Generative Artistry: Unveiling Creativity through Chaos

Concept

The project, “Generative Artistry,” aims to captivate and engage users by seamlessly transitioning from an interactive Pac-Man-inspired game to a mesmerizing display of generative art. This transition serves as a metaphor for the creative process itself, highlighting the unpredictable and varied approaches artists take to contribute to a shared vision.

Description

Part 1: The Pac-Man Game

Interactive Start

  • The project begins with a red ball that can be controlled using arrow keys (up, down, left, and right).
  • The player’s objective is to navigate the red ball to “eat” all the yellow balls, reminiscent of the classic Pac-Man game.

Chaos in Motion

  • While the player maneuvers the red ball, a couple of yellow balls move randomly, adding an element of unpredictability and challenge to the game.
  • The dynamic movement and contrasting colors draw players into the experience, encouraging them to participate.

Symbolic Disappearance

  • Once the red ball successfully consumes all the yellow balls, the Pac-Man game vanishes from the screen.

Part 2: The Generative Art

The Unveiling

  • After the Pac-Man game disappears, the screen transitions to a canvas where a multitude of small circle balls appear randomly.
  • These circle balls move unpredictably across the canvas, creating a chaotic yet visually captivating display.

Divergent Colors and Movement

  • As the circle balls move, they leave a trail behind them in various colors, producing an abstract and seemingly random composition.
  • Each circle ball represents an “artist,” and their choice of colors and movements is distinct, mirroring the unique perspectives of real-world artists.

Emergence of Shared Art

  • Over time, as the circle balls continue their movements and mark the canvas with diverse colors, the big picture gradually emerges.
  • The seemingly disorganized chaos transforms into a cohesive and shared artwork.

Metaphor for Creativity

  • The project symbolizes the creative process by showcasing how multiple “artists” (represented by the circle balls) contribute their individual perspectives to create a shared artistic vision.
  • Just as in real life, each artist’s interpretation of the final artwork differs, resulting in a unique and collaborative piece that deviates from the original but retains its essence.

Unexpectedness and Revelation

  • The project utilizes the element of surprise and gradual revelation, as players initially engage in a game without knowing its deeper artistic significance.
  • Users only comprehend the full narrative and purpose when the big picture of the generative artwork becomes evident.

Techniques Used

  • Randomness: Random movement patterns and colors are employed to simulate the unpredictable nature of artistic creativity.
  • Metaphor: The transition from the game to generative art serves as a metaphor for the creative process, emphasizing the diversity of artistic approaches and outcomes.
  • Progressive Revelation: Users gradually discover the project’s artistic depth as the generative artwork takes shape over time.
  • Interactive Elements: User control of the red ball via arrow keys adds an interactive element, making the project engaging and inviting.

Visual Progress

Now finally the “artists” can draw something more realistic and creative as following:

Conclusion

“Generative Artistry” is not just a visually captivating project but also a thought-provoking exploration of the creative process. By seamlessly blending a playful game with generative art, it encourages users to reflect on the nature of art, collaboration, and the beauty that arises from chaos and diversity.