# Perpetual Crusades

## About the Project

 This project was developed as a submission for Penn Apps XXI, held from September 11th - 13th, 2020. You can play it over here: [Perpetual Crusades](https://www.adityavsingh.com/perpetual-crusades)!

## The Story behind the Game

19 years after the Second Dragon Crusade in Draconheim, there has been a major outbreak of Dragon Pox among the humanoid races. Humanoids speculate that after the mutual deaths of humanoid Warlord Slaythurnax and dragon Overlord Aldone in their climactic battle in the Second Dragon Crusade, the dragons had vanished but have now come back seeking revenge on all those responsible, and so has the virus they carried during the First Dragon Crusade. A trio of a knight, wizard, and rogue have been commissioned to find out the remaining dragons and kill them, and on the other hand, three dragons have started on their journey to avenge their fallen Overlord. What happens when their paths cross is your and only your destiny to observe. Look excited young adventurers, for you all must not perish in these perpetual crusades!

## Inspiration

Perpetual Crusades was inspired by the popular table-top role-playing game Dungeons and Dragons. While the narrative universe of this game is completely different from Dungeons and Dragons, the objective was to create a seamless medieval dragon-fighting experience for the players.

## What it does

Perpetual Crusades is a 2-player game where one player gets to choose their avatar between humanoid characters (knight, wizard, rogue) and the other between dragons (red dragon, blue dragon, green dragon). When the game is started, both the avatars are placed on an 8x8 board which is laid with tiles with differing properties and points, the players roll the die to journey through the board, and whoever reaches 20 points earlier is declared the victor! Overall, this game focuses on creating a good entertainment experience for all its players through an age-old humourous dice-based gameplay.

## How I built it

The game was built using React for handling the overall front-end design of the game, while JSX was used (in sync with React) to develop the gameplay logic and paradigms. The gameboard was created with the help of CSS Grid Layout. The overall game is hosted through GitHub Pages, due to its relatively static nature and the lack of back-end constructs.

## Challenges I ran into

The most intriguing challenge I encountered was to decide how to make the game end (in terms of the game over screen) and the logic behind keeping score counters updated for every move. In the end, there were a lot of loose ends in the code (redundant functions and repeated code) which I had to sweep through and clean. Commenting through the code was also a last-minute modification which was quite stressful.

## Accomplishments that I'm proud of

Building the game from start to finish was itself an achievement that I'm proud of. From using CSS Grid Layouts for the first time to going through tremendous amounts of stress over the graphics and stylistic aspects of the game, and still managing to pull through a complete product makes me really proud and enthusiastic about further improving it down the road.

## What I learned

Over the course of 36 hours, I learned way more about my own stress personality than I did technologies, but I'm really grateful for the experience! In the face of stress, I learned to use CSS Grid Layouts, improved my grasp of conditional rendering, watched through a couple React tutorials to comprehend handling State and Props, and finally managed to find graphical elements (which are attributed in the GitHub repository), without all of which the game wouldn't be what it is currently.

## What's next for Perpetual Crusades

After this hackathon, I intend to scale up the game with more fellow developers and designers, which would be a great experience both for the collaboration skills I would develop and the new insights I could gain regarding optimizing the game.
## Inspiration

Our inspiration for developing this tool comes from the love and passion we have for Dungeons & Dragons (D&D). We recognized that both new players and veterans often face challenges in character-building and tactical combat. Traditional gameplay requires extensive preparation and understanding of rules, which can be daunting. We wanted to create a tool that simplifies this process and enhances the gameplay experience by leveraging AI to create dynamic and challenging combat scenarios.

## What it does

Dungeon Tactics is an innovative, AI-driven battle simulator designed to enhance your Dungeons & Dragons gameplay experience. The tool allows players to pit their characters against AI-controlled monsters in a variety of combat scenarios. The AI makes strategic decisions based on D&D rules, providing a realistic and challenging experience. The simulator currently supports the ability to move and take both unarmed strikes and weapon strikes while adhering to the D&D 5E combat rules.

## How we built it

We built Dungeon Tactics using a combination of React for the interactive user interface and OpenAI to drive the AI decision-making for monster actions. The frontend was developed with React, providing a dynamic and user-friendly interface where players can control their characters on a grid-based map. We used the OpenAI API to implement the AI logic, ensuring that monster actions are realistic and adhere to D&D rules. Our development process also involved integrating the D&D 5e SRD API to access game data, such as monster stats and abilities.

## Challenges we ran into

One of the main challenges we faced was implementing the complex rules of D&D in a way that the AI could understand and apply during combat. Balancing the AI's difficulty level to ensure it provides a challenge without being unfair was another significant challenge. Additionally, ensuring seamless integration between the frontend (React) and backend (OpenAI API) required meticulous planning and testing. Handling the wide range of possible actions while also making sure that they rendered correctly on the screen was a great challenge.

## Accomplishments that we're proud of

We are proud of creating a functional and engaging tool that enhances the D&D gameplay experience. Successfully integrating AI to drive monster actions in a way that feels natural and adheres to the game's rules was a major accomplishment. We are also proud of the user-friendly interface we developed, which makes it easy for players to control their characters and engage with the simulator. Our tool not only aids in character building but also provides a fun and challenging way to practice combat scenarios. For both of us, this was our first time developing a React app on our own and it showed us a lot of what is done before even coding.

## What we learned

Throughout the development of Dungeon Tactics, we learned a great deal about the complexities of AI in gaming, especially in a rule-heavy environment like D&D. We gained insights into balancing AI difficulty and ensuring fair play. We also learned about the importance of seamless integration between different technologies (React and OpenAI) and how to manage state and actions in a dynamic, interactive application. Furthermore, we deepened our understanding of D&D rules and mechanics, which was crucial for developing an authentic gameplay experience.

## What's next for Dungeon Tactics

Moving forward, we plan to expand Dungeon Tactics by adding more monsters and supporting custom monsters created by users. We aim to incorporate additional actions such as reactions, bonus actions, and spell casting to further enhance the realism of the simulator and support more classes. Another key area of development will be improving the AI's strategic capabilities, making it even more challenging and enjoyable. We also plan to implement multiplayer support, allowing players to team up and face AI-controlled challenges together. Finally, we will continuously refine the user interface to ensure it remains intuitive and engaging for players of all experience levels.
## Inspiration

**We love to play D&D**

It just has everything! Friends, food, fun, and a whole lot of writing down numbers in the margins of a sheet of notebook paper while you try and figure out who had the highest initiative roll. As a DM (Dungeon Master, or game manager) and a player, we've tried using all sorts of online D&D tools to streamline our games, but have found them to either be insufficient for our needs, or too stifling, digitizing away the purpose of a tabletop game among friends. We wanted to create something in the middle ground, and that's what we ended up making!

## What it does

**Any projector, any size**

Our D&D projector software automatically detects a connected projector, and will open up a dashboard window to your desktop and a display window to the projector screen automatically. The desktop dashboard provides tools for you, the DM, to run your game! You can create and load worlds, characters, and monsters. You can hide the nooks and treasures of a darkened cave, or show off the majesty of an ancient temple. You can easily and rapidly perform a variety of computerized die rolls, and apply damage to players and monsters alike!

## How we built it

**Good old reliable Java**

We used Java and the Swing library to create our windows and display the game world. The display window is projected onto a table or floor with any kind of connected projector. This allows the players to interact with real game pieces in real time, while allowing the DM to alter the game board cleanly and rapidly in response to the state of the game.

## Challenges we ran into

**The bigger the application, the harder it crashes**

Creating such a large application with so many different features is something we haven't done before, so the scope definitely posed a challenge. Additionally, the organization of the code into a robust, scalable codebase proved difficult, but we feel we did a fine job in the end.

## Accomplishments that we're proud of

**A game board you can touch but you can't break**

We've created a fun and interesting way for people to play D&D with nothing more than their laptop and a projector! We've removed many of the annoying or time-wasting aspects of the game, while simultaneously maintaining the authenticity of a tabletop RPG played with real pieces in real life.

## What we learned

**Collaboration? More like code-llaboration!**

We learned a lot about how to put together a multi-windowed, expansive application, with support for many different features during program execution and the need for advanced file storage afterward. We also got better at communicating between the frontend and the backend throughout development.

## What's next for D&D Projector

**Game on!**

D&D is a ridiculously large game, with a vast set of rules, regulations, and variations. With the scalable interface we've built so far, we plan on expanding our dashboard much further to include spells, interactions between players and NPC's, hunger/thirst, exhaustion, and many other parts of the game we feel could be streamlined. We fully intend to be careful in what we add, as retaining the authentic feel of the game is important to us.
Our next D&D session is going to be a very interesting one indeed, and we're really looking forward to it!