top of page
Search

319K Game Project: Space Soccer

  • Writer: Arjun Singh
    Arjun Singh
  • May 6, 2017
  • 3 min read

I partnered with Kevin Shim once again for our 319K game project. Finally I got to put all of my bitmap and pixel art knowledge to good use. After deliberating over all our favorite project options, we settled on making our own version of an Atari classic: Warlords.

The game isn't hard to grasp. There are 4 players corresponding to 4 corners, and a ball. Your job is to score on any of the other 3 player's goals. You score to accumulate points. If you score on yourself you lose points. See? Like I said, the premise of the game is simple. The real magic comes from all of the bells and whistles. It ended up being the features that helped us impress our peers in the project popularity contest.

The first thing we did was formulate a function that would determine when the ball collided with an object. I set up invisible walls around the screen and set the ball to move in one direction. Our solution was to call an interrupt anytime the player pressed the kick button (more on this later) and the function would shoot the ball in the direction the player specified. Otherwise we made the function use angles to predict when the ball would collide with a wall or goal. If the ball hit a goal, the last player to have kicked the ball would either win or lose points. If the ball hit the wall, this collision would pass data to another function which handled reflection direction.

We were going for realistic collisions, so the reflection function had to come up with a new vector and reduce the vector as much as possible... all without a floating point unit! This proved difficult but in the end it provided a smooth and aesthetically pleasing bounce. I want to point out that the original game and pong used predetermined reflections while our reflections are completely dynamic.

Once the ball to environment interaction was set up, it was time to move on to the background. We used the TI TM4C123GXL microcontroller for our game. After studying the documentation, we realized we're tight on both memory and storage. The reflection function took up a lot of processing, but it's also the bread and butter of the game so its intensity is justified. This means we had to scrutinize the efficiency of every other aspect of the game. Sound and bitmaps take up the most storage so Kevin and I split up. He handled making sound bytes, and I messed with the graphics.

Long story short, I experimented with a Kentec display and it didn't work out. I used 2 Sitronix ST7735 LCDs instead. One displayed the score and the other displayed the game. The Sitronix screen was significantly smaller than the Kentec display, and didn't do the game justice. If I had planned in advance I might have been able to get the Kentec to work. Anyways, since we were limited on space, I went online and retrieved a picture of, well, space. A picture of a galaxy scales well believe it or not. Put simply, I shrunk the galaxy to a fraction of the size of the ST7735 dimensions and wrote my own driver. Through the driver, I utilized the properties of pixel art to magnify the image and simultaneously make it look nice. I then triple buffered the image in its compressed state against the ball and the players.

We bought small perforated boards, 4 buttons, and 4 joysticks (2 potentiometers each) to make our controllers. We put colored shrink wrap around the wiring to keep everything clean and indicate which player controller the user was holding (yellow controller meant yellow player etcetera). I made the players into alien ships that, when buffered, had transparent parts to them. Yep, more wow factor... you can see the galaxy through parts of your ship. Players moved their ships with the joystick and kicked the ball in the direction of their joystick by pressing a button when the ball was in proximity of their ship.

Those were the best parts of the game. We competed against every other project in our class in a big popularity contest, and we emerged in the top 5. If I find a picture of the hardware I will post it. Otherwise here is a blown up version of my galaxy.

Thanks Kevin! Couldn't have done it without you!

 
 
 

留言


bottom of page