Category Archives: Programming

New Dice Roller Updates

At the request of my cousin, I recently added the ability to roll the narrative dice from Fantasy Flight’s Edge of the Empire system to my dice roller.  After putting this off for quite a while, I sat down and powered through it over the course of a couple of evenings.  As expected, the hard part was really getting the iconography together, organized, and displayed in a way that looked good, while the plugin system I developed for my dice roller really made the coding very easy. Continue reading New Dice Roller Updates

Dice Roller Updates

Since I’ve been working on unifying my website, I decided that I would take some time to update some of the other sections of my site while I was at it. The first thing that I wanted to work on was my dice roller – this is probably some of the oldest working perl code that I have, and it shows. It has some fairly obvious security flaws, an inflexible persistence model, and is lacking some options I’ve wanted for a while.

So, I’ve decided to update the code. Since it’s less than 150 lines of code, it should be easy to rewrite from scratch, so that’s my initial plan. Here is my feature list, in priority order:

  1. Rewrite the rolling engine:
    1. Strip the CGI parameter for id – I don’t have a use case for multiple dice rollers anymore.
    2. Sanitize input.
    3. Update storage model for rolls.  (Used Storable)
  2. Rewrite the display engine:
    1. Strip the template parameter – This is a security hole and I don’t have a use case for it anymore.
    2. Sanitize output.
    3. Find a better way to import templates.  (used HTML::Template)
  3. Do better session management
    1. Keep the user’s options so they don’t have to retype them every time.
    2. Explore cookies or CGI sessions for this.  (Used CGI::Session and cookies)
  4. Unify my Gaussian dice roller via options rather than a separate script.
  5. Provide options for counting dice over a threshold (like World of Darkness “successes”).
  6. Provide options for getting the total value of the dice (lots of games do this).
  7. Explore output filters
    1. Name
    2. Game name?
  8. Provide options for glyph dice (Star Wars).
  9. Provide options for exploding dice.

And, as it turns out, it took me longer to write this post than it did to update.  Here it is!

Website Unification

It’s been a while since I’ve had a unified look-and-feel to my website. The last time I went through unifying all of my pages, the web was a different place – CSS was the go to technology to make the look and feel of your website work and javascript was used really only if you had something more complicated. At the time, web design was more focused on delivering content than it was in delivering design, so you could get away with something simple that also happened to look decent.

Now, I won’t claim that my old site design was good for its time, but it was a simple implementation that achieved my goal of being able to deliver multiple different types of content: a blog (PivotX), a wiki (Dokuwiki), my web apps, and my static pages. As a comparison, my old design had less than a hundred lines of CSS and a handful of layout elements. My new wordpress theme has over a thousand lines of CSS, and the relevant layout hierarchies are over four layers deep. Continue reading Website Unification

Thanksgiving Apocalypse Game Preparation

Thanksgiving is coming soon, so I’ve started to think about my list for this year’s Thanksgiving Warhammer 40K Apocalypse game. I still have some models to put together, but I also need to figure out how I am going to create my list this year.

A while back, I created my own Warhammer 40K army list creator database in Microsoft Access. This was a great planning tool for me as it allowed me to pretty easily select squads and equipment and it would compute points for my army. It also allowed me to print out easy cheat sheets with model stats, weapon info, etc. so that I could come to the table prepared to play. Unfortunately, the biggest part of creating this database was actually data entry – I had to enter in the point costs for each option under each unit profile; this meant that the database was tied to my codex, and became out of date as soon as a new code was released. Additionally, since data entry is the most annoying part of any programming project, once it’s out of date, I am not very motivated to update it. Continue reading Thanksgiving Apocalypse Game Preparation

Automatic Creation of Tab Separators

As part of my work to organize my Pathfinder ACG box, I found that I needed a way to create alternating tabs in a general way. In particular, a few times, I found myself in the position where I had designed the tabs in photoshop only to realize when I was done that I had forgotten something. Or, in the case of Wrath of the Righteous, that there were new cards that needed to go in the middle of the sequence. Since this would require re-ordering all of the tabs following it, this became a bit of a task.

To solve this problem, I decided that I wanted to write a program to lay out tabs for me, and automatically take care of that alternation. To prototype, I create a short function in perl that had the basic imagemagick commands that I would use, and took a big list of tabs as input. The script automatically “-flop”ed the template to perform the horizontal mirror, and placed the appropriate text in position from the correct edge (i.e. positioned from the left edge on the left tabs, and from the right edge on the right tabs). I used this prototype to figure out the basic features I would need, and created the tabs for Rise of the Runelords and Wrath of the Righteous. Continue reading Automatic Creation of Tab Separators

Printing 3D Pictures

I have a 3D printer, and I’m often looking for cool new things that I can make. Since I’m not an artist nor a designer, this can be quite tricky, and instead I have to rely on my other skills, such as programming to do interesting things. A while back, I learned how to write STL files (the standard file format understood by 3D printers) via C++ or perl. This really opened up what I could do, since I could now create designs programmatically.

One technique I have spent a fair amount of time working with is embedded raster imagery. Namely, given an image or icon, I want to create a 3D object with that icon extruded, embossed, or otherwise present on the object that I’m making. A few examples of this are my Aquan/Kurak Alliance command tokens:

Continue reading Printing 3D Pictures

Strategize All The Things

Some time ago, I wrote a program to generate image mosaics from Magic: The Gathering cards. I eventually got it to a point where I could generate reasonably nice mosaics, but there were a number of places in the code where it became impossible for me to do more interesting things with my solvers. So I recently set out to do a complete code cleanup, to make it easier to do some of those things.

Continue reading Strategize All The Things

Photomosaics

I’ve started looking at what I’ll need to do for my Warhammer Table program, but, in the meantime, I thought I would write about another bit of software that will always be a work in progress: my photomosaic program. At present, this program is not yet complete – it lacks any form of interface, which means that anytime I create a new mosaic, I need to recompile.

At any rate, the purpose of this post is to talk about what this program does, and what challenges I am trying to solve. Later, I’ll get into the particular algorithms I used and why.

Continue reading Photomosaics