Activity

gunnsdc

Game Adjustments

  • Added a “too many balls” mode where a large amount of moving, interactable balls are spawned that cannot score but can alter the main ball’s momentum
  • Added an “obstacle” mode where static objects are scattered randomly among the screen. These don’t move, but can block the ball and reflect it
  • Added a bot difficulty selector

Looking Forward

  • I want to implement a ball color, but I know that it’s going to be tedious because I think I have to make a storage buffer that relates an object’s color to its triangles
  • I also want to implement sound effects which should be easier
0
gunnsdc

Winning & Losing

  • Added point functionality
  • Made point UI
  • Made a start screen (just blur that covers the window along with some text and a button)
  • Different messages based on winning or losing

Enemy Bot

  • Bot predicts where ball will go using simple geometry
  • Should probably base prediction length on time rather than distance, but this will do for now

Refactoring

Did a ton of refactoring today because I didn’t like the way the game state object was laid out. The paddles are their own composed objects now and so is the bot. Ultimately, the logic for game state is complete.

Looking Forward

  • I want to add the ability to make adjustments (the size of the paddles, the number of balls, randomly placed obstacles, etc.)
  • I’ve focused absolutely no energy on optimization and just focused on attaining a MVP, so I haven’t used Rust or WASM yet. Coming soon.
0
gunnsdc

Game State & Fixes

Game State

The game state is an object that controls the state of the game (e.g. the score, the objects in the game). Within it I added the paddles, the left paddle controls (the one the user controls) and the ball. I’ll implement a simple AI for the user to play against, although multiplayer implementation is planned.

Fixes

The collision was really buggy and, when two objects would collide, the velocity in both of the axes would be inverted. I fixed this along with other minor bugs.

Organization

Implemented a constants file from which game constants (canvas width & height, default ball speed, etc.) can be customized.

Attachment
0
gunnsdc

Collisions

I first tried implementing collisions in a cluttered fashion with math I honestly didn’t even understand. This caused a lot of useless headache, and the worst part about it is that I knew I had the answers to what I had to do in me the entire time.

I was racking my brain for how to implement this, and once I got fed up with my spaghetti solution, I checked Wikipedia for “elastic collisions” and there it was: the kinetic energy formula and the momentum formula I knew and loved from my physics class. I was too stubborn to pick up a piece of paper and actually write out what I wanted to do, and more importantly, the physics behind it.

It seems like I’ve learned something from this headache, though. When I’m stuck on a problem, maybe I should, you know, actually try to solve the problem instead of sitting and just thinking of a solution.

Anyways, I want to add colors and controllable paddles. Admittedly I’m scared of working on the WGSL and the fragment shaders, so I’ll probably work on the paddles first.

Attachment
0
gunnsdc

I began logging this project after I had already done some work, so here is what I’ve done so far (before this log):

  • General project setup to allow me to use both Rust compiled into WASM and Typescript together
  • Make a frontend website with a cool moving background and some other elements with TailwindCSS and React
  • Make a simple game renderer using WebGPU that converts game objects into triangles and renders them onto the blue space you see in below

For this devlog, I didn’t have much time, but what I did was:

  • Quickly make a simple ReadMe for the project
  • Start making the framework for collisions and overall physics

All I have is some simple kinematics implementations (acceleration, velocity, etc) and I want to add momentum and collisions, so I added a mass property to game objects.

I want to do some research on Minkowski differences so I can efficiently calculate collisions and especially the side that they occur on. I’ll probably implement this tomorrow.

Attachment
0