Inspiration

One of our team members began watching Peaky Blinders during the first day of the hackathon and they instantly fell in love. The aesthetic intrigued him, and with the hackathon on the horizon, he knew what to do. A classic bar fight, set in a tumultuous time period, gave birth to the idea of Barfight! the game.

What it does

Barfight! contains a few critical mechanics that make up the games structure and attempted game loop:

Characters: There are four critical characters that make up Barfight!. The first one is Shelby, signified by the dapper hat he wears. He begins with nothing, and is the character that the player controls. The bald men, possibly all named Danny, are the melee characters of the game. They wield a knife and constantly chase the player at a menacing, but manageable pace. Finally, there are the gun-men, possibly all named Thomas, wielding Tommy Guns (See what we did there, also Thomas Shelby from the show.) that spray in bursts of bullets aimed at the player. Tommys have the passive ability of being smart and don't mindlessly charge at Shelby, backtracking once he gets too close. The fourth is the insanely cool bartender, which only has a one percent chance of spawning. A bit of an egg, for those interested, the internal name is "Critical Massey," named after our computer science teacher.

Flipping Tables: In a classic bar brawl fashion, we developed the ability to flip tables for cover. Along with flipping the table, the character sweeps the loot off the table before flipping it. Tables themselves are objects that can't be walked through, as they are solid objects. Bullets can fly over them prior to them being flipped, but not afterwards. The strategy comes from flipping tables, sweeping loot, and using that loot to push through the Dannys to the Tommys, while protecting yourself behind flipped tables.

Table Loot: Table loot comes in four different varieties, nothing, candles (decorative nothing), glasses, and bottles. Glasses and bottles are the only important elements. Glasses are a one use projectile that can be chucked, spinning through the air, clocking and shattering into enemies. Bottles are similar in that they are glass and break easily, however, they act as a melee option. Each KO both Danny and Tommys instantly. Although not considered table loot, as it doesn't originate from tables, Thomas can drop his Tommy gun upon KO, and Shelby can pick it up to use against the remaining enemies. It's a very powerful tool with seemingly infinite ammo and a decent fire rate. It can also KO the enemies instantly.

Random Generation: No game is the same in Barfight! To find the same iteration of generation is a 0.69% chance. We achieve this through cleverly cloning tables and placing them along a grid in a random pattern. Then, for each table, a random number, 1-4, would select what item is placed atop that table. All tables are intractable, all items can be used or destroyed. This is actually a very difficult thing to do in Scratch, although seemingly simple, due to limitations it is a struggle. More on that in later sections however. Beyond just the tables, the bar of the pub can be found in 4 different spots allowing for more variability. It keeps it fresh for the first few rounds.

How we built it

We built Barfight! in Scratch. Scratch is a basic block coding language. What we do with it though, pushes it to such a limit it fails to properly handle everything near the end of the project. We consistently find this error when we build big projects in Scratch. It is really good at simple stuff, but the second someone wants to go above and beyond it all of the sudden becomes an optimization and algorithmic nightmare. It is hard to build big in Scratch, but that's apart of the fun. The challenge and our collective fluency in the language is what draws us to use it. To collaborate, we used Ghandi IDE. Ghandi is a forked version of Scratch that allows for real time collaboration. It only helps but bolster the difficulty as we watch our projects slowly desync from each other as it grows in scale.

Sprites were done in Aseprite. Masterfully crafted by one of team members, they all attempt to match the vibe of a 1919s tavern. Our artist has years of experience in pixel art and truly loves it. They code a plethora of Minecraft mods with stunning art that only enhances the experience. We attempted to emulate that level of artistry in an effort to make our project visually appealing and to fit that retro/pixel aesthetic that this category demands. One of our other team members does not own the software and is less proficient in Pixel Art, although most sprites were done by our more professional artist.

Challenges we ran into

Limited Scratch Capabilities: Scratch has a limited amount of data that it can process. This makes anything that requires demanding back-end algorithms and processes (like procedural generation) take up a lot and very quickly. Near the end of the project, things started to simply begin breaking for no apparent reason. One of instant it would be working and the other it would not, without any changes being made to the program and it's function. But this is something we navigated around, targeting some critical issues that became even more apparent. An example of this is a phantom bullet bug, where bullets would spawn from no where. We at first assumed this was a de-sync, we were confident in our Tommy spawning system, one that we spent a fair amount of time ensuring it would work to our specificity. However, the "de-sync" led us to reconsider and we managed to solve the issue. Turns out, we forgot to render the origin of said phantom bullets, their Tommies were literally hidden from view. Tommy spawning was improved overall and it worked out in the end. One challenge we can't overcome with the limitations is the difficulty of editing the project at such complexity. Edits simply stopped saving and so our progress also was forced to stop.

Detection and Table Flipping: Logically, a player would have to select the table they want to flip over. Also, a player shouldn't be able to flip a table on one end of a map and be on the other. They have to be deliberate, and so do we in how we choose to address this. The solution that we initially came to was to use the distance sensor to detect the distance between the sprite of the table and the player. Easy, quick, and simple. But, the distance sensor does not go based off of clones, it follows the parent sprite. If you remember correctly, our table generation is purely based off of clones. Clones help simplify the entire process. We don't have to copy over hefty lines of code in to a bunch of individual sprites, allowing for better optimization. Because we used clones, distance does not work. We came up with two solutions: Avery's: "The simple solution," as he called it, was far from simple. The Scratch interface acts as a coordinate grid of pixels. Given two points, one being a center (a table clone's coordinates) and the coordinates of a player, one can find the circle using the circle formula: (x-h)^2+(y-k)^2=r^2. With a circle, comes a radius (r). That radius is distance between a table and a player. Avery spent a solid 6 hours coding this circle formula. One thing that was needed with this were IDs for each coordinate and radius so they could be associated with a clone on screen. Avery spent that painstaking and valuable time creating a list, sequentially setup to include all the necessary details. He even made custom blocks, common practice amongst hardcore scratchers, not something Avery does much. But there was one last hurtle he couldn't cross, how did he know which one is the closest to the player? That was when Spencer, had a brilliant idea that they implemented in maybe thirty minutes. Spencer's: "The actually simple solution," as Avery calls it, was really quite simple. Spencer ghosted a little rectangular hitbox that followed the front of the player. Ghosting, one of the many things Spencer taught Avery this Hackathon, is a method of concealing a sprite in scratch without eliminating its interactions with other sprites on the board. Tables that were clicked on within that hitbox led to a flipping table. The solution was so simple, but also very creative in its use of the ghost visual effect.

Accomplishments that we're proud of

  • Sprites
  • What we achieved within the time
  • The charm
  • The trailer/video
  • It's actually pretty fun when you get lucky enough to get a good spawn and weapon allotments. Flipping tables and combining different sets of items is really satisfying
  • The blood effects, saying this as people who don't like all that much gore, are a really nice touch
  • We like the concept a lot
  • Collisions with circular objects - collisions are generally difficult to pull off in Scratch as scratchers have to build their own physic systems from the ground up.
  • No AI usage - 100% humanslop!!!!!!!!

What we learned

  • Ghosting
  • Sometimes, when you are struggling to come up with solutions, don't immediately jump to the first solution you think of, especially if it is extremely complex. Even if it includes some really cool code and usage of math that has never been seen before.

What's next for Barfight!

We would totally be interested in remaking Barfight! into a proper rougelike in a professional game engine. One with fleshed out characters that aren't just members of the Shelby family and Peaky Blinders family. Something like Enter the Gungeon (you can flip tables in gungeon) or Hades (really cool characters.) Sounds, particle effects, and general polish is definitely needed. One of the things we really need is a core gameplay loop, one that doesn't currently exits. However, the concept and structure for it does.

Slide show link:

https://docs.google.com/presentation/d/11pDRGkZ4B4zhXD5ghxLbziCqUEDQ9bEwCGvCdrjiJN8/edit?usp=sharing

Built With

  • aseprite
  • gandi
  • pixelart
  • scratch
Share this project:

Updates

Submission history