A S C R A P B O O K O F S O L U T I O N S F O R T H E P H O T O G R A P H E R
Enhancing the enjoyment of taking pictures with news that matters, features that entertain and images that delight. Published frequently.
28 April 2014
We happened to read Plastic Dice in Bulk by Mark Krawczuk at Cool Tools on Friday. Even though we enjoy a strong aversion to games played in a chair and suffer an allergy to gambling, we were charmed by this game of simple rules requiring only three dice.
The next morning we woke up thinking that, lacking dice, we could code the game as page on our Web site.
As code goes, it's simple enough to be a school assignment, really. Each die is just a number. You can simulate a roll with a random number function.
You just have to display the throw. You could do that by printing the text, but we thought we'd photograph the six sides of a die and simply name the images after their value. So dice-1.jpg would display "one."
That could be a school assignment, too, we thought. For product shots.
We spent most of the morning hunting down a die. We really didn't want to have to go shopping for one. Finally we managed to find one attached to a book of games.
The set wasn't fancy. We just put it on some foam board.
Then we got out the D300, stuck it on the old tripod and put an antique Vivitar Series 1 70-210mm macro zoom on it (for the macro). Then we set up the Flashpoint 180 Monolight we're using to shoot all our product shots these days. We linked it to the D300 with a FlashFire trigger. All this stuff was easier to find than the die.
The strobe is so hot that even stopped down all the way and at our highest sync speed (which wasn't that fast, alas), we were burning out the image. We moved the strobe back but we couldn't move it far enough away to solve the problem. So we put an umbrella on it (it comes with a small white umbrella) and that did the trick. We liked the diffused light anyway.
We might have just aimed the light at the white ceiling get a nicely diffused bounce light but the camera's shadow would have fallen on the subject.
We used Lightroom to apply two presets to the six shots. First Antique to give our app a little polish. And then Auto to bump up the contrast a bit.
Presets are helpful for applying a particular look and we wanted some little hint that these were more than portraits of dice. Antique gave them a golden glow not at all inappropriate to the game.
We exported the six images, renamed to reflect their value. Then we opened them in Photoshop.
We wanted to crop them so they were all in the same position. When we rotated the die as we shot them, they shifted up and down the frame slightly.
So we framed the first one, cropping it square and then copied the second to a layer on top of that. We dropped that layer's opacity to 50 percent (roughly) so we could align it to the image underneath it. Then we kicked it back up to 100 percent opacity.
Repeat for the other four images.
Then we resized the image to 150 pixels square and simply saved each layer for the Web.
We had our simulated dice.
In the bedsheets we had envisioned this as a Web page similar to our Beebo Rationalization Machine. That's a one-page file of HTML spiced with PHP to do the heavy lifting, displaying either the prompt to roll or the dice you rolled.
The HTML with CSS would determine what our page looked like and PHP would let it function, rolling the dice by using an HTML Submit button like you see on any form and displaying the results if we've already rolled. PHP can paint the page differently depending on what has or hasn't happened.
We typed up a title and the house rules. Don't ask us why we dropped the hyphen from Ceelo. We didn't see a reason for it and we thought it would be wise to distinguish our version from any official one. Everyone seems to play by different rules so we thought we should list ours.
In fact, they do differ from the rules in the Cool Tools story which didn't account for comparing three-of-a-kind to any value other than another three-of-a-kind.
Under that we put the Roll button.
We honed the text a bit until it fit on an iPad screen. You shouldn't have to scroll up to roll the dice.
That's the part of the page where we display the dice, too.
ROLLING THE DICE
Rolling the dice is as simple as calling the random number function and storing the result in an element of an array (or list). Our array had to have three elements, one for each die. Simple as one, two, three (or 1-2-3).
Displaying the result is simple, too. We use the value of each element as part of the file name. The JPEG of the die showing six dots is dice-6.jpg for example. Just the way we dreamed it.
That's as far as we had imagined things when we woke up. But after a few test rolls, we realized there were a few more things we could do.
EVALUATING THE ROLL
After you roll, you look at your throw to see where you stand. The program could do that for you, though, applying the rules and acknowledging any instant win or automatic loss, any failure to get a combination and figuring out what you score when you roll a pair and a spare.
It could even count the failures to get a combination, closing you out when you hit five in a row.
And once a turn has been completed, it could welcome the next player or restart the whole game.
One thing that makes the evaluation of the roll easier is to sort the result. So instead of looking at "121," we could be looking at "112." That makes it possible to look at fewer patterns.
Then we just test the roll for the various conditions in the rules and build a message to display after we've completed the evaluation.
As we played the game, we saw a few more things we could have the software do.
Like keep track of the highest spare-and-a-pair score to evaluate subsequent rolls as either the new leader or just a nice try.
We also kept the feedback positive. But there's no reason it has to be hard-wired into the page. We could have a separate data file with different kinds of feedback available (a little like Beebo).
You could have a set suitable for children (which is what we developed). Another suitable for mixed company. One for prison populations. Different languages even.
Software evolves because our minds evolve. Folks who say Photoshop (to take one popular example) is mature really just mean turn off the lights when you leave.
We thought we could use a background image so we launched Photoshop CC and opened the four, five and six dice images. The game is also known as four-five-six, apparently, so we thought overlaying those dice at various capacities and ghosting the thing with a bit of a graduation tailing it to pure white at the bottom would be just the ticket.
So we overlaid the images, adjusted each layer's opacity, moved them around a bit, extended one background or another, added a graduated adjustment layer and got just what we wanted.
The CSS tag for the background let us position it at the top, centered, under the type.
This wasn't a paint-by-numbers process. We tried a number of different looks and combinations before getting something we liked. But all we had to do was edit the image in Photoshop CC, save it for the Web and reload the page.
By some odd coincidence we happened to hear a radio interview with Dr. Stuart Brown the next morning before we got out of bed. The founder of the National Institute for Play, he stressed the importance of play for an hour as we tried to sleep in.
But he was right. Get up and ... play. So we thought we'd share our little dice game with you on its own Ceelo Dice page. You can even look at the page source to see how it works.
<g> Well, we're not relying on
mt_rand()for any security or cryptographic function just a number between one and six. As for its randomness, after playing it for a few days, the results seem a little more even handed than a lot of dice I've seen. All the faces are square and the corners rounded <g>. -- Mike
Well played, good sir, well played. -- Aaron