Inspiration

A common mistake for inexperienced dungeon masters is to insist on rolling and moving every single NPC. Nobody wants to watch the DM roll dice for 15 min+. I thought this project could help keep the focus of the players including the DM less focused on the roll play and more focused on the role play.

What it does

This app automates combat turn by turn. Simply type in the NPC's that won't be directly interacting with the players in the combat, and then once a turn enter a command and update the pieces on the board.

How I built it

Given that the theme of this hackathon was table top rpg. I thought it thematically appropriate to make this a command line app. The whole thing is written in c++. This design choice was because I enjoy working with pointers in c++.

The main part of this project is in the World constructor. Typically it is bad form to have the constructor do anything but construct, but for sillyness sake, I made the whole application run in the constructor and once the user finishes the program ends. I thought it somewhat poetic that all the important things happen in the making of the world, but when it is finished the world is immediately destroyed. The world contains two lists of Basic Characters that the user will populate with npcs. The user can call for an instance of combat where all npcs will "take their turn". The npc's will approach the nearest combatent and attack if able.

Basic Characters are held in the BaseChar class. The most important functions are; approachCombatent, findDistance, findTarget, and attack.

Challenges I ran into

My greatest challenge was handling list iterators and pointers. At times it was challenging trying to compare an iterator for a list and an object. I also had some trouble with the movement of npc's. the npc's would move apparently like they were supposed to until they were aligned vertically but not close enough horizontally, the program would then enter an infinite loop with no movement. It turned out I had hit a wrong key and was only moving in the y direction when the x coordinate was off. I also had some trouble getting random dice rolls

Accomplishments that I'm proud of

I'm really proud that I was able to acomplish my goal of automating large combat. This project still needs some polishing, but I got the main goal of creating a command line app that automates combat.

What I learned

I learned how to use list to store and access objects. I also learned how to use srand() and rand to create psuedo random dice rolls. I learned that srand() must be used to provide the "random" seed to rand() in the application.

What's next for Autonomous Combat for Abnormally Large Encounters

My short term goals are to create child classes based off of the BaseChar class. In D&D there are many things that affect combat, magic spells legendary resistances. I'll start incorporating the finer details into the project. My long term goal is to create a "magic board" (the names a work in progress). I want to create a way to move pieces on an actual board. I've got a general idea of what I'll need, magnets, robot arm, motor... but that'll be for another day.

Built With

Share this project:

Updates