Flatiron Element Hammer Project

Scott Peraza
3 min readMay 14, 2021

This was truly a fun project for me. Element Hammer was built as a basis for a dice rolling app. This app will be designed to be utilized by players of warhammer40k who regularly have to memorize rule books for rolls based on the units type and stats, as well as having different dice stat bonuses (like rerolls on six or one etc) based on the faction they are playing as well as their chosen subfaction.

Rather than having to carry 30+ dice around as well as memorize all the rules for rolling, I asked myself…..can this be made digital. Naturally the conclusion was yes! So in a prototype attempt to make the game easier for new players to start, my journey on this project started.

With such a complex starting point (warhammer has dozens of factions when subfactions are also taken into account) as well as a huge variety of special units that each have unique stats, I figured the best starting off point would be to nail down some form of base logic for just factions. With this I went ahead and created a migration for users, factions, and user_factions. Each faction has a buff type and the buff itself. The reason for this being that long term I would replace the ability to input the buff type, and instead offer a drop down that way I can use the buff type for a series of logic based calucaltions as naturally an armor buff vs an attack buff would be calculated differently. So by the model having access to a buff type with predetermined values, the calucaltions could run more smoothly than if I tried to lump both together under one string in the database, or only supplied a boosted value. Especially if in the long run maybe the factions buff type would change.

After this was complete, I decided any good game or dice roller etc would require admin login to update factions, create factions, or remove them. As with any game (especially warhammer40k) the rules can change quite often. So having non hard coded factions was very important to me. This also lead me to the conclusion that technically an admin should be able to edit user accounts. I restricted what could be edited to solely the username and email for now just to avoid any confusion if I forgot any changes to my test account passwords. Eventually admins and users will be able to edit the password in future iterations. For the sake of simplicity however it is restricted to just editing the username and password.

This project lead me to so many new ideas and ways of viewing my coding, taht ultimately I would like to carry on with this project until it is a perfect virtual dice roller for warhammer 40k, and a jumping off point for creating my own version of a pokemon game as I do miss that 16 bit nostalgia, since the warhammer logic and pokemon logic are actually fairly similar.

All in all, in a week I was able to get the users, admin, nested user/user_factions routes set up, as well as all associated logic and error handling. However I am looking forward to investing more time into this application to help it blossom into a program that can help new players get into warhammer 40k, and eventually developing my own pokemon style game.

--

--