Talks

Building Board Games with Ruby

Building Board Games with Ruby

by Yonatan Bergman

The video "Building Board Games with Ruby" features Yonatan Bergman, who shares his journey of designing a physical board game using the Ruby programming language. The talk begins with an overview of the resurgence of board gaming, highlighting how modern board games incorporate various mechanics and themes, creating a vibrant community around tabletop experiences. Bergman discusses the current state of board gaming, mentioning the significant rise in interest and sales over the past two decades, as well as the impact of crowdfunding platforms like Kickstarter on game production.

Key points discussed in the video include:

- History and Popularity of Board Games: Bergman explains the evolution of board games, emphasizing the diversity of games and their mechanics. He provides examples of popular games like Settlers of Catan and Ticket to Ride, illustrating the depth and variety within the medium.
- Board Game Development Process: The production process involves designers creating prototypes, collaborating with publishers, playtesting, and refining rules. Bergman explains how playtesting can take various forms, including blind playtesting where feedback is gathered without guidance.
- Using Ruby for Game Design: Bergman describes creating a board game called ‘Missiles and Microchips’. He details how he implemented a game simulator in Ruby to test different mechanics and interactions between players, enhancing his understanding of how to balance gameplay.
- Iterative Development: He shares his experience of iterating through various player strategies and simulating thousands of game scenarios to refine his game's mechanics and rules based on statistical analysis.
- Prototyping and Community Engagement: Bergman went through the process of creating a physical prototype and tested it with colleagues and board game enthusiasts, which allowed him to observe player interactions and gather valuable feedback. He emphasizes the excitement of watching strangers play his game without his input, highlighting the community aspect of board gaming.
- Future Aspirations: Although still a work in progress, Bergman hopes to continue developing his game with the goal of eventual publication. He encourages attendees to check out his simulator code on GitHub and participate in a raffle for prototype copies.

In conclusion, the video not only presents the process of board game design through a technical lens but also showcases the social aspects of gaming and community engagement in board game culture. Bergman’s experience demonstrates how programming, specifically with Ruby, can enhance rapid iteration and testing in game development, making board games more accessible and relatable for designers.

Overall, the talk conveys a sense of optimism and creativity within the board game hobbyist community, inspiring others to explore this medium of social interaction.

00:00:13.400 Hi everyone. So as Jim said, my name is Yonatan Bergman, and I'm here to share the story of how I built a board game and how Ruby relates to it.
00:00:17.960 Now, I'm not going to talk about digital board games but actual physical board games, so I hope you enjoy the talk. I'm a tech lead at the eBay Israel Innovation Center, down in Tel Aviv, and we build cool projects for eBay, mostly using Ruby and Rails.
00:00:30.279 I wanted to start off with a short introduction to board gaming because I guess when I say board games, some of you think of this, or maybe this.
00:00:34.360 However, board games have changed a lot in the past 20 years. I want to have a quick show of hands: who here has played a board game in the past year? Wow! And how about in the past month? Not bad! Today, there's a current revival of board gaming as a hobby, and more and more people are playing board games each year.
00:00:47.759 Modern games also have a wide variety of mechanics and themes available to them, from Settlers of Catan, which is considered the grandfather of designer games, to Carcassonne, a game where you build a medieval city in France, and Ticket to Ride, a set collection game where you lay railway tracks across the US and try to block off your opponents.
00:01:02.760 There are lesser-known games like Agricola, a worker placement game where you build a farm and harvest food to make sure your family doesn't starve over the winter, and Galaxy Trucker, a chaotic game where you build a spaceship and try to navigate it through meteors, aliens, and pirates.
00:01:18.040 Then there's The Resistance, a social deduction game with no physical parts, where you accuse your friends of being spies all the while hiding the fact that you are one. There are many other fantastic board games right now, but what they all have in common is that they bring people together around the table.
00:01:36.040 Board gaming as a medium is unparalleled in how it combines competitive gaming with social interaction. We are currently in a golden age of board gaming, as people say, since 1999. Sales have been growing at a rate of 10 to 20% each year, with the number of games published growing accordingly.
00:01:52.240 For example, around 500 games were published in the year 2000, but last year more than a thousand new board games were published. That's a crazy amount and a lot of copy-pasting to create the necessary research.
00:02:00.799 Now, let's talk about how board games are made. I'm going to generalize the process; it doesn't apply universally to all games but should give you an understanding of the production process.
00:02:18.600 We start with a designer, the person who invents the game, usually the one whose name adorns the box when it is ready. Designers come up with the basic mechanics and rules of the game and go through several iterations, often adding a theme, whether it's farming, racing, giant monsters, or something else.
00:02:25.400 Once they have a prototype ready, they will show it to publishers. While a designer is usually one person or a small group, a publisher is typically a larger company that helps produce the game. The designer showcases the prototype to several publishers to get one interested in buying the rights to the game.
00:02:41.119 After securing a publisher, the game goes to an internal development team. These are not programmers, even though they're called developers; they are people responsible for preparing the game from its raw state to a ready-to-print version. They work with artists and content writers to get all the assets ready.
00:02:54.640 They finalizes the game’s rules and theme, which they might even change based on other games the company is currently producing. They conduct extensive playtesting during this phase, which is an iterative process trying to iron out bugs in the game.
00:03:07.800 There are various playtesting methods, such as open, closed, and even something called blind playtesting, where you simply send out a game to a group of people without helping them, and later gather their feedback.
00:03:20.480 Once the game is ready for print, it is sent to the manufacturer. Let's talk about costs for a moment. When producing a video game or an app, the expenses are mostly in development and getting multiple copies out once you are done is relatively inexpensive, even free.
00:03:29.600 However, when you're producing a board game, every physical copy incurs costs related to materials, production, shipping, and storage, which you might not immediately think about. Therefore, producing a board game is a complex process that involves many different people and requires a lot of support.
00:03:45.480 Fortunately, things have been improving over the past few years. Kickstarter, the crowdfunding website, has been a real game-changer in the scene as it enables people to get their games out there and fund them without needing a publishing house.
00:04:04.240 Over the past four years, the tabletop category on Kickstarter has seen a total increase in funding from $100,000 in 2010 to over $30 million collected for board game campaigns this year, which is crazy. It is also worth noting that, with many games relying on Kickstarter for production, one out of every three campaigns fails.
00:04:19.280 Another interesting way people are getting games right now is with print-and-play, which is essentially about open-sourcing board games. Creators publish rules and all the necessary components needed to play the game online.
00:04:32.400 You, as a player, can go online, print out the components—whether it’s cards, boards, or whatever—and just play the game. This is widely used for playtesting as you don’t always have access to your testers, so you can send them a PDF and expect them to print the rules and play the game.
00:04:50.199 This was just a little taste of the current state of board gaming. I didn’t touch on everything out there, but I hope you can see that board games parallel the process of developing software, which was probably one of the reasons I was naturally drawn to building a board game as a side project.
00:05:02.480 A couple of months ago, I had an idea, and I started designing my first board game which I have called 'Missiles and Microchips.' It’s a sort of cross between poker and a game I used to play as a kid called Standoff, mixed with some game theory.
00:05:19.920 In the game, you play a rogue supercomputer trying to take over the world, but to succeed, you must fight the other computers out there. Each player starts the game with five energy points, which serve as both your life and your score.
00:05:39.599 The goal is to be the first to reach 10 points or to be the last standing player. At the beginning of each round, all players simultaneously select an action and target from their hand; everyone has the same set of available actions and targets representing the other players.
00:05:48.360 After everyone reveals their chosen target, starting with the first player, they can change their hidden action by paying one energy point to do so. This is particularly useful for bluffing or when you notice that everyone is ganging up on you.
00:06:02.559 Players then reveal their chosen actions, which can be one of three outcomes: attack, block, or charge. An attack, if successful, will remove one energy from your target and disable any charge they're attempting to perform; the block protects you from incoming attacks but costs one energy if used when no one else is attacking you; and charge adds one energy to your pool, functioning as a way to heal yourself.
00:06:20.560 The interactions between actions depend on who you are targeting and what their actions are. Given these mechanics, there are 18 different combinations between two players in a round, and because everyone plays simultaneously, it creates very interesting interactions around the table.
00:06:40.679 After resolving the actions, players update their energy. If someone has won, we stop the game and celebrate; otherwise, players take their cards back, the starting player token moves, and we go through another round. The game continues until one player reaches 10 energy points or all but one player are eliminated.
00:06:58.920 So those were the basic rules of the game, and now for the interesting part: I want to go through how I developed these rules. The story began during a lunch break when I was sitting with one of my coworkers, who is also into board games and game design. I was sharing my game idea with him and mentioning the challenges I faced with how the actions interact with each other and the specific numbers involved.
00:07:17.000 We discussed it, and decided to write a simulator in Ruby. That night, I created a very simple first version: you input how many players were playing, and I built all the basic elements necessary to simulate a game, including the rounds, the players, and the cards.
00:07:35.520 Initially, my players made completely random selections, where they picked cards out of their hands using a sample, and I printed out who won the game and how long it took. The next version included winning through accumulating a certain number of points: you input the starting energy for each player and the amount of energy required to win, and you could see the outcomes.
00:07:55.840 The output was very verbose. The outputs were truncated since there could be 47 turns in a single game, simply because I was simulating one game at a time. So, the next step was to wrap it up to simulate multiple games for a more statistical analysis of how the game performed overall.
00:08:15.560 I analyzed how long a game lasted given the random nature of players in the system, printing the average number of turns and determining how many times each player won. My logic was that if the players were random, each should win roughly the same number of times.
00:08:36.000 The most crucial class in my code was the action resolver class, which receives the board state for a player-target pairing and returns the resulting change in energy for both players. Action resolvers were instantiated inside a round resolver class to determine the outcomes of each player’s actions and their targets.
00:08:54.680 The code for the action resolver was written to allow exploration and adjustment of the fundamental rules of the system. Maintaining clarity and ease of change was paramount for me; I developed a sort of Domain-Specific Language (DSL) to outline how each action resolves.
00:09:12.120 One of the first rule changes was that if you attempted to charge while under attack, the charge would be disabled, and you wouldn’t gain the point. This change was minimal and only required a single line of code, and it did not affect the readability of the method.
00:09:31.200 I started utilizing the Hashy library throughout my code, finding it incredibly helpful. If you haven't used Hashy yet, I highly recommend checking it out—it's great for everything from parsing APIs to working with the command line and simulating board games.
00:09:44.240 After a few weeks of experimenting with my game, I felt confident enough to test it with actual players. I gathered some blank cards and cubes from another game and created my very first prototype.
00:10:05.120 I have a small tip for those who enjoy creating, along with a plug for eBay. I maintain a maker kit at home that contains all the essential items I need to quickly prototype different concepts—be it video games, board games, websites, or mobile apps. It includes blank playing cards, Post-it notes, dice, tokens, pens, markers, and even a small hourglass.
00:10:25.440 I use it whenever I require physical stimulation for my creative processes, and I’ve found it invaluable in many cases. Returning to the prototype, I illustrated all the action cards and uniquely defined the computers based on popular culture, naming computers like HAL from 2001: A Space Odyssey and Skynet from Terminator.
00:10:42.920 We played several rounds of the game at work, and it provided me with insights into how human players interact with my game. From the feedback gathered during these initial sessions, I went back to coding and worked on expanding my player system.
00:11:02.400 I no longer wanted just random players; instead, I aimed for them to have some semblance of strategy. I focused on simplicity and ease of alteration as I developed a simple player approach that extended random players but included some smart decisions: defending when under attack and repairing when low on energy.
00:11:19.040 As I improved the interface, I began testing these new simple players against the completely random ones I had previously coded. I noted that the intelligent players began outperforming the unpredictable players, at least by a margin of 7%, which was pleasing.
00:11:35.840 I felt satisfied with the performance of my new smart players and wanted to examine how the number of players influenced the game length. Thus, I set up multivariable tests that simulated 10,000 scenarios for each combination I created.
00:11:56.880 In total, I worked with 150 different combinations of player counts, starting energy amounts, and energy levels required to win the game. After all of these simulations, I analyzed the average number of turns for each combination, leading to 1.5 million simulations that consumed roughly 40 minutes of processing time.
00:12:14.320 I handled the data similarly to what you would do with big data: I put it into a chart. If we focus on the chart, we can see that the average number of turns increased each time the starting energy was set to exactly half the energy required to win, which made perfect sense.
00:12:30.840 If a player begins with energy at precisely half of the winning requirement, they find themselves in equilibrium between the two win states. I also examined how adding a new player affected game duration, with each plot representing another player included.
00:12:47.760 While testing out different starting energy combinations, I observed two trend lines. The upper line illustrates the average turns per player when the starting energy is high, while the lower one shows the same metric with low starting energy—indicating that the higher starting energy had a more significant impact on extending gameplay.
00:13:03.360 I used this data and those trends to refine my game’s variables, making an informed decision to start with five energy per player and set the goal of 10 energy to win. Similar adjustments were made throughout my rules.
00:13:19.520 For example, if a player blocks but no one is attacking them, they now lose one energy point. This change allowed me to conduct a regression using my multivariable tests and compare how the game altered with the new rules.
00:13:37.280 I was pleased with my game’s numbers and shifted my focus towards designing a more polished prototype, starting with creating unique personas for each of the computers while conducting research by watching 80’s movies about computers.
00:13:54.080 I then ordered my first prototype from a company called The Game Crafter, which provides printing services for smaller quantities—perfect for developing prototypes. Their online interface lets you upload any artwork for cards, boards, or boxes, and they offer a large selection of game components.
00:14:10.720 The prototype arrived, and it looked fantastic. Getting a physical copy of something you developed is incredibly exciting. We sat down to play it at the office that day, and the customized card art and sizeable yellow cubes added a lot of character to the game.
00:14:29.760 While we faced some issues—like one player holding a card upside down—I took that opportunity to return to coding. Simultaneously, I explored another theory by creating a straightforward player design that would constantly repeat the same action without variation.
00:14:50.480 I tested these single-minded players against my simple players. Each performed worse, which was encouraging. Through these tests, I discovered something interesting: in games with four or more participants, consistently charging provided a significant advantage over blocking.
00:15:07.560 After this last iteration, I decided to develop an even better prototype, refining the rules, crafting player aids, and preparing a nice box. I’ll take a moment to discuss that writing rules can be quite challenging.
00:15:26.360 Although it often resembles coding, it’s essential to distinguish superior rules from inferior ones. The more you read others’ work, the easier it becomes to write your own. While drafting rules, keeping them direct, concise, and referring players to other sections when necessary is vital.
00:15:40.080 I rewrote my rulebook several times, refined it even more, but I was satisfied with the outcome and mounted an order for another prototype. I brought this new prototype to the monthly board game meetup in Tel Aviv, where I played a few rounds of the game with fellow board game enthusiasts who were willing to help test it.
00:15:58.800 A few meetups later, I took my game and set it on the gigantic pile of games at the center of the room, where anyone could pick whatever they wanted to play. While I was across the room playing something else, I noticed someone browsing through the pile, picking up my game, opening the box, and reviewing the rules.
00:16:16.560 For the first time ever, I experienced the amazing moment where a group of people I didn’t know picked up my game, learned the rules, and began playing without my involvement. It was exhilarating to see that unfold.
00:16:31.040 Of course, once I saw them playing, I couldn’t resist approaching them to film and take photographs, even though they might have sensed my excitement. I still haven’t finished developing the game, but I hope to get it published one day, perhaps in the not-too-distant future.
00:16:51.680 For now, it remains one of my cooler side projects. I posted the code for the simulator on GitHub, and you're welcome to check it out. I can't promise it’s as clean as during the presentation, but it works!
00:17:08.440 I was a bit worried about the production and shipping issues due to my hard work, which is somewhat unusual to mention at a Ruby conference. However, I’m happy to announce that we have made progress. I'm giving away four copies of the prototype here at GoGaRuCo.
00:17:25.960 These are special editions created specifically for this event, featuring a unique character called 'the GoAB bot.' To participate in the raffle, simply tweet about your first computer and add the hashtags #GoaB and #Microchips. Later today, I’ll run a script to find four winners from Twitter.
00:17:44.760 I hope you've enjoyed this short journey through board gaming with me. My name is Yonatan Bergman, and feel free to come check out the game or just say hi. Thank you so much for having me here!