Midterm Project Zayed Alsuwaidi

To bring the initial concept of Russian Roulette to life, I decided to use generative AI for the images. I faced several issues sketching the artwork myself on my iPad, and I wanted a surreal realism and impact from the art. The images are therefore generated by DALL-E.

Here are the Game Mechanics:
Players

  • Player: Player starts with 100 health, the bar is at the top-left (50, 50).
  • Opponent: Also 100 health, bar is at top-right (650, 50).
  • Health: Drops by 50 when hit. Game’s over if either of us hits 0.

Gun

  • It’s a 6-shot revolver (shotsFired tracks how many times it’s fired).
  • The chamber’s random—loaded or empty (isLoaded)—and resets on reload.
  • Every shot counts toward the 6, whether it’s a bang or a click.

States

  • “between”: Whether the choice is to shoot (S) or pass (N).
  • “playerTurn”: Player shoots, showing playergun.gif.
  • “opponentTurn”: Person shoots, showing persongun.gif.
  • “reload”: After 6 shots, we reload, and they shoot at me!
  • “gameOver”: One is down; hit R to restart.

My Journey Building It
I started with the basics—getting the images and health bars up. That was smooth, but then I hit a wall with sounds. I added gunshot.m4a for hits, and it worked sometimes, but other times—nothing. That was frustrating. Turns out, browsers block audio until you interact with the page, so I had to trigger it after a key press. Even then, emptyclick.m4a wouldn’t play right when the opponent fired an empty shot. I kept seeing “sound not loaded” in the console and realized the timing was off with setTimeout. I fixed it by storing the shot result in a variable and making sure the sound played every time—loaded or not. Adding the reload mechanic was tricky too; I wanted the opponent to shoot during it, but keeping the flow consistent took some trial and error.

Image:

The image (From DALL-E) I used to depict the person wearing a silk mask covering his facial features and creating a feeling of suspense:

 

 

Gameplay Flow

  1. Start: Game kicks off in “between” with nogun.gif.
  2. My Turn:
    • S: I shoot.
      • Loaded: gunshot.m4a, light flashes, opponent loses 50 health.
      • Empty: emptyclick.m4a, no damage.
    • N: Pass to the opponent.
  3. Opponent’s Turn: They always shoot now (I made it consistent!).
    • Loaded: gunshot.m4a, light flashes, I lose 50 health.
    • Empty: emptyclick.m4a, no damage.
  4. Reload: After 6 shots:
    • Switches to “reload”, shows nogun.gif.
    • Gun resets with a random chamber.
    • Opponent shoots at me:
      • Loaded: gunshot.m4a, light flash, I take damage.
      • Empty: emptyclick.m4a, I’m safe.
    • Back to “between”.
  5. Game Over: When me or the opponent hits 0 health.
    • “Game Over! Press ‘R’ to restart” shows up, and R starts it over.

Controls

  • S: I shoot.
  • N: Pass to the opponent.
  • R: Restart when it’s over.

Visuals

  • Canvas: 800×600—big enough to see everything.
  • Images: Centered at (400, 300), 300×300 pixels.
  • Health Bars: Red base (100 wide), green shrinks as health drops.
  • Light Effect: A cool yellow-white flash when a shot lands—fades out fast.
  • Instructions: Text at the bottom tells me what’s up.

Audio

  • Gunshot: gunshot.m4a for a hit—loud and punchy.
  • Empty Click: emptyclick.m4a for a miss—subtle but tense.
  • Volume: Set both to 0.5 so my ears don’t hate me.

Overcoming Challenges
The sounds were my biggest headache. At first, gunshot.m4a only played after I clicked something—browser rules, ugh. I fixed that by tying it to key presses. Then emptyclick.m4a kept skipping when the opponent shot an empty chamber. I dug into the code and saw the random shoot chance was messing with the timing. I simplified it—stored the shot result, made the opponent shoot every time, and checked isLoaded() right before playing the sound. Now it’s rock-solid.

this.state = "playerTurn";
    this.currentImg = playerGunImg;
    let shotFired = this.gun.shoot();
    if (shotFired) {
      if (gunshotSound.isLoaded()) {
        gunshotSound.play();
      }
      this.opponent.takeDamage();
      this.flashAlpha = 255;
    } else {
      if (emptyClickSound.isLoaded()) {
        emptyClickSound.play();
      }
    }
    setTimeout(() => this.checkReloadOrNext(), 1000);
  }

  opponentTurn() {
    this.state = "opponentTurn";

 to show how I handled the opponent’s turn.

Key Gameplay Highlight

  • Reload Mechanic: The reload’s risky and cool—opponent gets a free shot!
setTimeout(() => {
     let shotFired = this.gun.shoot();
     if (shotFired) {
       if (gunshotSound.isLoaded()) {
         gunshotSound.play();
       }
       this.player.takeDamage();
       this.flashAlpha = 255;
     } else {
       if (emptyClickSound.isLoaded()) {
         emptyClickSound.play();
       }
     }
     setTimeout(() => this.checkReloadOrNext(), 1000);
   }, 1000);
 }

 checkReloadOrNext() {
   if (this.gun.needsReload()) {
     this.reloadGun();
   } else {
     this.nextRound();
   }
 }

 

 

 has the logic for resetting the gun and surviving that tense moment.

Technical Bits

  • Classes:
    • Player: Tracks my health and draws the bar.
    • Gun: Manages the 6-shot limit and random chamber.
    • Game: Runs the show—states, visuals, all of it.
  • p5.js Stuff:
    • preload(): Loads my assets.
    • setup(): Sets up the 800×600 canvas and sound volumes.
    • draw(): Keeps everything on screen.
    • keyPressed(): Listens for S, N, R.

Endgame
It’s over when me or the opponent’s health hits 0. I see “Game Over! Press ‘R’ to restart”, hit R, and it’s back to square one—health full, gun reset.

What’s Next?
Maybe I’ll add a manual reload key or a score counter. Also, I would re-design the game with different artwork to make it more immersive.

Here is a snippet of the state handling, which was key to ensuring less redundancy by preventing procedural programming of the game. Also, the states handle the logic, and this was key in establishing how the game runs i.e if there is an issue with the Game Class, the rest of the gameplay mechanics are directly impacted.

class Game {
  constructor() {
    this.player = new Player("Player", 50, 50); // Player health bar at top-left
    this.opponent = new Player("Opponent", 650, 50); // Opponent health bar at top-right
    this.gun = new Gun();
    this.state = "between"; // States: "between", "playerTurn", "opponentTurn", "reload", "gameOver"
    this.currentImg = noGunImg; // Start with no gun image
    this.flashAlpha = 0; // For light effect transparency
  }

 

 

Midterm Progress

Concept:

 

I thought of two main ideas when thinking of making a game, and to highlight  the previous themes of randomness I decided to make a gambling-oriented game. The first idea I thought of was to make a blackjack game but with Russian roulette stakes. The second idea was to just simulate a Russian roulette. I continued with the latter game because it is more intuitive and the game would be more feasible to implement in p5.js.

 

Design:

 

I drew a basic sketch due to simply show the gameplay features where the level progresses based on the health of the person interacting with the game. If it is feasible, I will also implement another health bar for the dealer, where the player can shoot the dealer as well. I am focusing on the gameplay elements more than the artwork, since the backdrop is intentionally designed to be gloomy and dark. (The filling in of the sketches also represents a vast darkness obscuring the dealer’s torso).

 

The lighting portrayed will also be minimal, and the dealer’s face is drawn in a way where the dealer is wearing a mask that obscures his facial features (essentially like a uniform nearly fully garment that wraps around his entire face, making the facial features appear opaque). I will improve the sketch and render the artwork in SVG.

 

 

Challenges:

The main challenges are producing the artwork with the goal of making the experience as fun as possible, as I might have to compromise on certain gameplay features. I also faced challenges creating the artwork in a correct SVG format, but I am continuing to research this in order to be able to finalize my methods in sketching and digitalizing the artwork. Another challenge is the animations, and to solve this challenge I will focus on 4-5 main animations, one where the dealer shoots a bullet, one where the dealer loads the gun away from the player’s perspective, and one where the dealer shoots a blank.

 

Reading Response:

 

Computer Vision differs from human vision in the sense that the processing of images and light is sub-consciously performed in human vision. On the other hand, algorithms allow computer vision to map light and images into mathematical equivalents in real-time within programs, subsequently allowing the image to be processed.

 

One such method is frame differencing, two frames are taken, where one frame represents a certain amount of light and a representation of the image in pixels, and the second frame represents a corresponding frame with changes in light and pixels. The differences , namely in color and luminosity, between these two frames is summed across all of the pixels’ locations. Similarly, detecting presence performs these same calculations of differences but with a reference of the background of the image instead of two similar frames.

 

I believe that computer vision’s capacity for tracking and surveillance creates possibilities with no bounds, where interactive artwork can take form through the medium of augmented reality, as well as the depiction of interactive media artwork simulating motion and pictures with life-like movement. As highlighted in the reading, this capacity is not limited by definition of the generalizability of computer vision algorithms, where no single algorithm is generalizable, and several different possible algorithms can work in harmony to create a digital interactive artwork.

 

Week 4 Generative Text + Reading

For the task of creating generative text, I thought of representing historical conceptual frameworks on machine to create a journey through the development of this conceptualization from literature such as Turing’s ‘Computing Machinery and Intelligence’ in 1950, as well as Isaac Asimov’s exploration of social concepts through the use of machines and robots as a literary medium.

I aimed to extend this literature to create an interactive journey, where the user’s mouse movements will influence the tone of the sentences generated , transitioning to a more hectic state.

 

I am particularly proud of being able to make the generative text based on a function  ‘mood’ which changes how the text is displayed. This required several iterations to nail down:

choosePhrase(type) {
        if (this.mood >= 0.9) {
            return random(this[`veryPess${type}`]);
        } else if (this.mood > 0) { // Use regular pessimistic phrases
            return random(this[`pess${type}`]);
        } else {
            return random(this[`opt${type}`]);
        }

The optimistic phrases display by default, but the method enables the dynamic changing of text which highlights the aforementioned purpose and intent. Other challenges I faced were making the text display within the correct boundaries, and just thinking of which sentences to formulate and how they would be perceived by the user to try to improve the interaction as much as I can.

 

READING

Something that still intrigues me and is of particular interest is the conceptual framework on interaction and the mediums by which we express it. There is no agreement of one single concept of interaction. As a consequence, the mediums through which this interaction can be facilitated are limited by our agreement and interpretation of the conceptual framework at hand. I believe it is difficult to reason about the other fundamental notions presented by the Norman without a detailed analysis of the causality in human-centric design, the reception of it, and as a consequence the dynamic improvement of this concept in literature.

I am able to apply the principles and notions presented by Norman by utilizing the methodology in which he discusses these concepts firstly.  Secondly, I am also able to utilize his critical analysis of concepts in psychology on human interaction and human perception to have a deeper understanding of how the end-user interacts with my generative artwork or projects. In fact, this part of chapter 1 is of key interest, where the analysis of a design takes a methodological approach in viewing instances of design and how humans perceive them, whilst hinting at a psychological notion and referring to psychological literature. This also hints towards a more experiential view of this principle of human design (whether it is human centric or centered towards something else).

 

Week 3 OOP + Reading

Being tasked with creating generative artwork using Object Oriented Programming, I thought of my intent and drew inspiration from the Perlin Noise algorithm developed by Ken Perlin. Reminiscent of my generative artwork for week 2, I decided to create polygons of a dynamic (n) sides. These sides are adjustable by the user and through rapid clicks and interaction, the number of n sides of the polygons increases. The polygons also rotate in a random manner, as my artistic intent was to not follow a specific order, rather to allow the objects to move in any manner.

 

Without the rapid clicks, the art at hand is emphasized through the Perlin Noise effect, where the movement of the mouse generates a subtle but artistically significant noise.  In the grander sense, I would replicate this generative artwork on a larger scale, a larger screen, or perhaps that its canvas doesn’t have boundaries and is projected. However, to show a simple demonstration of it this pop-up suffices.

Technical Details:

I created three classes: Star, StarryBackground, and NoisyShape. The first class is responsible for the individual stars with a glowing effect, making the artwork seem more realistic and complimenting the life that the Perlin Noise adds to the art.  StarryBackground manages this array of stars and organizes them into the background of the canvas. NoisyShape is the key class for interaction and animations in the art, where rapid clicks change the level of noise, n sides, and creates distinctions in every iteration (the canvas constantly changes and does not reset).

I highlighted this class as it was the most interesting part to me:

 

//Noisy Shape and PERLIN POLYGONS

// A dynamic, multi‑sided polygon whose vertices are perturbed by Perlin noise.
class NoisyShape {
  constructor(x, y, radius, nSides) {
    this.x = x;
    this.y = y;
    this.radius = radius;
    this.nSides = nSides;
    // Pick one of the strategic colors.
    this.col = palette[int(random(palette.length))];
    this.noiseOffset = random(1000);
    this.rotation = random(TWO_PI);
    this.rotationSpeed = random([-0.001, 0.001]);
  }
  
  update() {
    // This creates an animation that rotates the polygons after rapid clicks, creating a dynamic and randomized movement.
    this.rotation += this.rotationSpeed;
    // When rapid clicks occur, intensify effects:
    if (rapidClickTriggered) {
      this.rotation += random(-0.05, 0.05);
      this.x += random(-3, 3);
      this.y += random(-3, 3);
      this.noiseOffset += random(0, 0.02);
    }
  }

Specifically, the part that stood out to me in creating this class was the perturbation of the polygons by the Perlin Noise.

 

READING THE ART OF INTERACTIVE DESIGN

 

Upon reading the art of interactive design, the author’s use of an introductory scenario to highlight a simple instance of interaction ( a conversation ) stood out to me and helped set a conceptual basis of interaction for me. What interests me is the assertion of this conceptual basis without referring to etymological significance in meaning. I believe that the author does this so as to not subtract from the emphasis on clarity through the concise medium of the scenario. However, I would argue that a small reference to the etymology of the word ‘interact’ inter + – act inter: A latin word meaning between. act (derived from the latin word ago) : Do / Action. This would help solidify the importance of displaying how important the reciprocation is in this back and forth between two actors

The simple conversation between Gomer and Fredegund does that exactly. It shows how important the roles and actions of both actors are. Therefore, the counterarguments the author answers in the subsequent passages are dismissed on the basis of weak interaction between (where one actor does the majority of the actions, and there is no distinct reaction by the other actor). i.e reading a book, movies, the example of Greeks and Romans in viewing paintings (which is significant in the context of computed generative art).

What stands out to me and impacts me in this reading is the utilization of the definition under the author’s continuous conceptual framework, highlighting interaction as a continuum… Therefore, I transcend my opinion and thoughts on interfaces as mediums to facilitate these interactions , thinking about the possible ways of facilitating interaction with no compromise on listening, thinking, and speaking.  Therefore, I must think of the user’s perspective or I would now have another user interact with my work, whilst making my own metrics as measures of these three aspects. Additionally, there must be a consideration of the target user / audience to establish a basis for how well that person would be able to think and speak. Therefore, I feel incorrect in how vaguely I thought of this part of interaction, with the assumptions that the interaction would be highly intuitive to everyone, and that they would be able to speak easily.

Week 2 Artwork + Reading – Zayed Alsuwaidi

I would like to start by explaining my artistic intent. I was recently interest in nihilism. As a matter of fact, I always thought of concepts within nihilism, and this materialized into this concept recently when reading some literature by Nietzsche. Essentially, I aimed to demonstrate my emotions and my perception of objects through this form of artistic self-obliteration, dissolving into the surrounding environment. Therefore, in this sense one might argue that this artwork tells a story (as per the inevitable dissolution into the evironment).

 

How I did it:

 

I made the canvas 800 by 600, and I decided to make the background a specific color of glistening yellow that resonated with me when taking inspiration from Yayoi Kusama’s Polka dots artwork.

I used noStroke() to create the shapes with no solid outline, as I wanted to blend in the repetitive elements (geometric figures symbolic of the representation of objects and elements in our perception of space-time).

 

Then I drew a representation of abstract ‘pumpkins’ but they aren’t really pumpkins, that is not the emphasis on art here. These rows of abstract pumpkins were drawn using a for loop.

 

I am particularly proud of the rest of my code where I believe I truly achieved my artistic goals. In this loop I tried to manipulate space and make use of the remaining space in the canvas from the pumpkins as a precursor to including the geometric figures as a representation of objects in spacetime. To do this, I used some simple boolean (if conditional).

if (random(1) < 0.5) { 
       let detailSize = size / 4; // These shapes will be smaller than the main shape.
       fill(255, 150, 0, random(100, 200)); // Set a transparent orange color.

       push(); // "Remember" the position again.
       translate(x + random(-size / 2, size / 2), y + random(-size / 2, size / 2)); // Move to a random spot somewhere on or near the bigger shape.
       ellipse(0, 0, detailSize + random(-5, 5), detailSize + random(-5, 5)); // Draw a slightly irregular circle.
       pop(); // Go back to the original position.
     }

 

 

READING RESPONSE:

Upon taking inspiration from Casey Reas, I focused on utilizing space and randomness as a method of employing artistic intent. As I mentioned in my explanation of the artwork, the randomness at hand is the implementation of these abstract spherical objects (as if they’re pumpkins or some orange circle), which fill the canvas randomly. After this, the random geometric shapes fill in the canvas randomly, this is my take on what Casey Reas outlined in his demonstrations of art through physical computing. I tried to add to this discussion further by taking inspiration from Yayoi Kusama, where I attempted to merge her abstract and repetitive use of polka dots, drawing inspiration from her use of color in her canvases of art. In my take on answering what I felt about the tension between order and chaos, I believe that I was able to show in my art how I perceive this tension, where a more nihilistic view is implemented, showing the symbolic geometric objects dissolve and move downwards in a randomized but nearly controlled manner.

 

Another aspect highlighted by Reas (timestamp 13:59) is the precise and logical structuring of things by artists, I made a new take on this where I favored randomness and chaos over structure and organization of elements in my art.

 

Assignment 1: Self Portrait

For my self portrait my intuition was to experiment with a style of art that is new to me. In this case I wanted to represent myself with a background of a dark star-lit sky. I always thought of the theory of existence, and as far as I know we are all representations of energy in the literal sense, with every form of life dependent on energy. Therefore, the distorted facial features are meant to blend into the background.

 

It is my first time using p5.js, and I am particularly proud of this line of code:

for (let i = 0; i < 200; i++) {
    fill(random(150, 255));
    ellipse(random(width), random(height), random(1, 4));
  }

It is a simple for loop that fills random parts of the background with stars, and I like seeing new representations of stars by repeatedly compiling the code. I tried to limit the use of functions and to instead use quadratic vectors to represent the rest of the elements of the portrait, which did bring about some difficulty. Looking forward, I will familiarize myself with the Quadratic Vector function, as well as other functions in p5.js .