Choosatron + Paper Darts = Awesome Times

 

Paper Darts Choosatron Station
Paper Darts Choosatron Station

Paper Darts has been extremely supportive of my Choosatron project from the moment they heard about it. They wanted to do what they could to help, but at the time I just needed to get it to work. Once the first prototype worked (named ‘Argyle’) they asked if I would be willing to bring it to their Paper Darts Volume 4 Release Party (buy the book)! They also posted an interview with me about the Choosatron here. Both an incredible honor, especially for someone not used to being involved with the literary community of our fair Twin Cities. It also served as a fantastic deadline for the second prototype, and gathering submitted stories. I was able to convince various clever friends and talented writers to write stories for me, and managed to get three completed and tested before the event. I was working over the last few months to acquire better/cheaper hardware to build the improved second prototype (named ‘Bomber’).

The second Choosatron prototype.
The second Choosatron prototype.

Time has been sparse but I managed to get the guts of Bomber working before heading to California for work which took nine potentially productive days away. Once I returned it was four days until the event, and I still had no enclosure for Bomber, and I needed to write more code! At the same time I was making sure the three submitted stories (from Robert Valentine, Rob Callahan, and Wes Burdine) worked properly on the Choosatron…this meant updates to my conversion scripts and other small fixes. I worked late Wednesday night, soldering at 4:30am, and half of Thursday right up until I had to leave for the event, but I made it.

Bomber is beautiful! I ended up using foam-core which looks very nice, is sturdy, and I could cut it all by hand. It also allowed for flexibility in design as I just tried different methods to mount and contain it all, until it worked. I achieved all my goals as it’s compact, components are secure, SD card is easy to access, USB port similarly easy, a functional coin return, and coin storage. I can continue to develop with it and easily transport it for demoing.

For the release party I didn’t have the keyboard screwed in, just taped from underneath, so people did freak out whenever they hit the buttons too hard and it popped through. 🙂 I assured them it was fine and stuck it back on. The day after this was immediately corrected.

The most exciting part of the event was getting approached by the program coordinator for The Loft Literary Center, Jennifer Dodgson. After getting the first prototype working I loved the idea that this could be used as an educational tool. She asked me what I thought about teaching a class using the Choosatron, and I was dumbfounded at my luck! I didn’t know much about The Loft at the time, so only got more excited as I realized what an amazing place this was for teaching young people. Needless to say I jumped on the opportunity and unless it turns out no one is interested, I will be teaching “Interactive Fiction and Game Design with the Choosatron” next summer. Wordy title I know. Each student will get to build their own Choosatron, and write stories to play on them!

For me personally this is a big deal. I come from a family of teachers but haven’t had the opportunity to teach kids myself, but have always wanted to, so I’m excited about the personal growth I think this will provide me. It also means more reasons and deadlines to keep the project alive instead of putting it on the shelf to gather dust like so many other things. The future is bright for the Choosatron, and more so for it’s mission. I’m proud of what I’ve managed to make happen in a relatively short amount of time (especially considering this was a side, side, side project), and look forward to it’s future!

Bomber's Guts
Bomber’s Guts

Choosatron: The Librarian’s Apprentice

The Librarian’s Apprentice is the first story ever submitted to be played on the Choosatron! Robert Valentine, a writer/director based in London, has done me the great honor of putting his time into such a random project. His excitement over the Choosatron was incredibly inspiring and definitely pushed me along, so thanks Rob! Hope you enjoy the video and disregard my terrible pronunciations. Anyway, without further ado please enjoy a video of my first play of Rob’s story.

Choosatron: Applying Feedback

I’m quite enjoying the part of the process I’m in now with the Choosatron. Getting quality feedback that makes you think, “Yes, of course!” is quite motivating in pushing development forward at a time where it would be easy to lay back and call it complete.

As mentioned before, two bits of feedback I wanted to immediately add are prepending the choice made as the new passage prints, and properly word wrap text so it’s easier to read. The logic behind word wrapping isn’t very complex. Start with how many columns you have available (32 in my case), take your first line of text, and from the end look at each character until you find a space. If one is found, set it as the end of the line (‘\0’ to terminate the char array), record the index, and print. Then start one past your index + columns (32), and do it all over again. If a space isn’t found, print all 32 characters since wrapping isn’t possible. Rinse, repeat.

It ended up being slightly more complicated in my case because of two reasons. First, to prepend the choice number creating an offset. If this was part of the text already it wouldn’t be an issue, but the text is loaded from flash memory on demand, filling its buffer, printing, and repeating until the entire file contents have printed. Of course this means we have the same offset problem every time we fill the buffer and have more to print since the column position could be anywhere in the line.

It was already late at night when I decided to tackle this issue, so I was annoying myself with some silly mistakes as I stepped through the logic coming up with a solution, and there were a couple ways I could go.

  1. Only read the required number of characters for each line at a time. This seems like it would be helpful, but ends up being a pain dealing with the tiny bits of leftover that need to be tacked on the next line, and means a lot of file reads. Meh.
  2. Do lots of memory copies to always send the word wrapping function the complete text to be printed. This is slower, and has a very high risk of running into memory limits if not done very carefully, and as a result will mean more file reads. It really just makes the problem it’s trying to solve worse. Argh.
  3. Keep track of a ‘rewind’ character count. Load enough content to know if the first line should wrap, rewind to the position just after that wrapped first line, and load more content until the buffer is full. Then the wrapping function starts with a fresh line!

Of course, I didn’t have those and other ideas all together…the third was a fight to get to. There is also an ‘indent’ to make sure I can send variable numbers of columns for wrapping, useful in special cases. Moving forward!

Choosatron: The Demoing

Last week was intense. Finishing a hefty project at work, building a card version of the Nakatomi Plaza in Die Hard for our Swede, rehearsals/costuming/props for “Matlock: The One Man Show” which is part of “Fringe Orphans” at the Minnesota Fringe, and finally finishing a few user facing features for the Choosatron and getting it in an enclosure! Phew!
I wanted to present the Choosatron at a new Arduino MN group to both give myself a deadline, and also get a little feedback from the hobbyist crowd.

Amazingly I got everything done and was able to show off my little contraption for the first time. At first everyone seemed a bit bewildered, not entirely sure what the damn thing was…but it sank in and people seemed to get really behind it. The impression I’ve gotten by everyone that’s touched it is that although it’s a very strange project, it’s also very unique and quite a bit of fun. I still only have my single test story written as I’ve been focusing on the hardware and software end, so I think with more and better stories it can only improve.

Choosatron’s First Home

Anytime you build a project that requires that others contribute in order for it to reach it’s full potential you’ve got a challenge on your hands. People are busy. Even the ones that LOVE your idea, and WANT to contribute, have plenty going on to make that difficult. The fact is that talented creative people are always in demand, and even the promise of getting paid isn’t necessarily going to change that. There are numerous other creative projects I’ve been trying to move forward that require design and visual work, but that seems to be where my progress starts to halt. I sincerely hope that the Choosatron doesn’t fall victim to this same blight. I’m too in love with the idea of collaborating to create work beyond one individual to let my hope die. We’ll see!

I brought it to work and did some user testing to see what people had trouble with, what they liked, and how I could tweak the experience a bit. There was some great feedback like implementing true word wrapping so reading is easier, and fixing the absurdly short time limit for continuing a story. I’m working on finished some of this sort of polish, along with internal logging so I don’t have to manually write down the choices people make, and how long it takes to play. There has also been a fair bit of interest in this potentially turning into a Kickstarter project, so people can purchase/build their own and the community of authors can grow. There are plenty of things I need to figure out before I’d consider that, but it would be fun! I’ve been researching how I can bring the cost down which has exposed some very interesting possibilities.

Along with that I’d like to look into interactive fiction formats that already exist (other than Twine) to see if I can open a big door by creating support for them. Even writing a Twine addon to natively support the Choosatron’s features (like autojump) would go a long way toward cleaning up the user experience as an author.

In the end, this project is really just the first in a series I’ve wanted to do, with increasing complexity and deeper exploration of story telling and game design. The intention isn’t to make a product to sell, but to explore immersing people using interactive applications to see what we might be missing in our current definitions and divisions of game, story, and genre. Of course, the next step might be getting the Choosatron into something a bit more permanent than a cardboard box!

Flip-dot signs!

Also called flip-disc. They are used in buses, train stations, and other locations for displaying information without using LEDs. Obviously used less and less now-a-days, but I still think they are incredibly cool. I’ve always wanted access to flip-dot boards so I can program them for my own wonderful amusement. Figuring out what they were called was more difficult than I expected. All I could think of was ‘flip flip flip’ signs! After a fair bit of googling I found this Wikipedia article on flip-disc displays, and an Arduino forum post, and finally knew what I was looking for.

So far the only vendor I’ve found is Alfa Zeta to purchase flip-dot components, and I’m currently waiting for them to get in touch with pricing. Would be soooo cool though. They have links to plenty of demo videos, but here is one that is an incredibly advanced use of flip-dots:

Watch this video on YouTube.

Choosatron: The Printening

One frustration I’ve run into with this project is the different power requirements my components have needed to work nicely. 12 volt, 9 volt, 5 volt, plus inconsistent amperage requirements. The thermal printer takes almost no power until you ask it to print, when it spikes to 1.5amps! Most of the other components don’t take too much; probably 300-500ma combined as a rough guess. I determined that I’d need a minimum of 2amps to power everything appropriately. 1.5 reserved for the printer and 500ma for everything else. The coin acceptor was the first annoyance since it wants 12v and the supplies I had were all 9v. I ended up finding many 12v power supplies ranging from 2-3amps that were for external harddrives so perfect! Except, after I get the coin acceptor power how do I get the printer what it needs?

12v to 9v, 1.5amp Output

The Arduino and components directly connected would all be happy with putting in 12v and having the arduino regulate it, but the printer needed too much raw power and 5v ends up printing too light. So! What I needed was something to take the 12v down to 9v after powering the acceptor, while still providing close to 2amps of output. I did some research and discovered I wanted a voltage regulator, so decided to hit ebay. I first found the nice little guy to the right which was what I wanted except only giving 1.5amps. I decided to get them anyway because it was cheap and quick to ship being in the US. Who knows when they will come in handy, and it’s still something I can do some testing with.

12v to 9v w/ 3amp Output

I kept looking however, and found exactly what I was looking for. 12v to 9v, and 3amps output! There was a 2amp output as well, but since I found a 12v 3amp power supply I might as well be able to support it. This part was only available in China, but cheap so I purchased. It took 3-4 weeks until it finally arrived! I had gotten the L7809 regulators and verified that they did in fact work as advertised. Hooked it all up, printed, and got a faint lettering due to the lack of power. Just days ago I got the part I was really waiting for! It had been such a long wait I had already started doubting it would fix my printing problems. I had played around with running the printer on 12v, but it would print a little too fast, and though it was darker than with the small regulator, it wasn’t good enough and I didn’t want to hurt the printer.

Well, I plugged the new voltage regulator in, fired up the Choosatron, and wow…after all the hours with both the hardware, and programming the software, FINALLY seeing it truly work! Beautiful, rich text. Take a look below! Just in time too as I’m planning on bringing it by an Arduino group meeting this coming Thursday.

I also completely finished the points feature, getting continues fully supported (if ending quality 1-4 of 5, insert a coin to continue, get prompted for how many choices back you want to move), as well as authors getting to set what a ‘perfect score’ is, along with a ‘continue penalty’. Phew! So much awesome stuff. The writing guide is finally online, along with a test story I wrote to help people get started. Take a look here!

So dark and perfect!
First Perfect Print

 

Choosatron: Crushing the Final Evil (Bug)

Last night I finished the last feature that would allow full story play support for the file structure I created. Auto-jump, which simply allows you to set a single, unlabeled choice on a passage so it will be printed out and immediately forward to the link provided and continue from there. This is useful when you want to converge two different paths back together with different narrative preambles but common narrative body and the same choices. Is that confusing?

Path 1: “…After singing along to the radio with your friend for hours, the cabin is finally in sight.”

Path 2: “…you awaken from the bizarre dream, your friend pointing ahead to the cabin up ahead.”

\/

“The gravel crunches under the tires as you park. It really is a beautiful cabin you think to yourself. Should be a great weekend.”

See what I mean? So with this in place I was able to play through, but suddenly…it stopped. Noooo! I happened to have a log statement outputting free kilobytes of memory before each passage is output, and it was heading steadily downward.

968…906…842…780…724…662…death.

No question, a nice juicy memory leak. A very consistent one losing about 62kb per passage. I walked through my code carefully, making sure that each path and passage element is correctly freed. Then I started commenting items out to keep the case as simple as possible. No change whatsoever. Only change was the memory leak was slightly less the more data I loaded in each chunk of the passages.

Choosatron Bits

Interesting…that means the fewer file.open() calls I make, the less memory is leaked despite loading the same number of bytes. At this point I did what any decent programmer would do: pick the best keywords for what I understand about my problem thus far, and google it. This, my friend, was a situation where something could have easily taken days to fix, but I noticed enough clues to find a problem I was not alone in. I immediately found an issue filed here: Arduino Issue 814. The gist is simple:

When a file is opened a malloc() is performed to get memory. When a file is closed the memory is freed. If the file object is destroyed before the file is closed, the memory is never freed.

File::~File(void) {
  close(); // <-- The FIX
  //  Serial.print("Deleted file object");
}

Hmm…my code looks like it’s closing files properly, but it’s worth trying the one line fix. I add it to the library, recompile, upload, run…968…947…947…947…947…and this continued to the end. Then I played again. Then I continued. NO LEAKS. This is one of the most incredible feelings in the world, especially when memory management is allll up to you. I’m using the Micro SD card as my memory (essentially) so not leaking it all over the place when I use it is a plus.

The Choosatron Deluxe Adventure Matrix™ software is working! It’s not done, but this is where it gets really fun. Getting people to write content for it, demoing it, and of course polishing the code and adding more features for authors to play with. Next step is setting up the power regulator, power input, and power button so I can take the experiment where the people are. Hopefully I’ll have it with me at CONvergence a couple days from now for some geeky attention.

Choosatron: Memory Corruption Devils

Whenever I’ve done lower level coding I try and remember that whenever you are experience completely bizarre behavior and there is absolutely NOTHING wrong with your code…there is something wrong with your code. Memory and stack corruption are notoriously difficult issues to pin down, as completely unrelated (and working) code can be the trigger that sets off the bomb. I just experienced this as I’ve been trying to finish the Arduino code for my Choosatron™ to load chunks of narrative passages, output them, present the choices, and finally accept a choice. This points it to the next passage and the process begins again. It’s a simple, beautiful cycle that should allow me to achieve unlimited length passages by reading limited chunk sizes, printing, and freeing before loading the next.

Suddenly, which is code for ‘I did something seemingly innocuous with terrible consequences’, I was getting incredibly bizarre behavior where output would just cease. Sometimes it would get further along than others, which meant I didn’t notice immediately after making the change causing it. The first red herring was when, hours into debugging, I hit one of the keypad buttons used for input. It printed “INSERT 2 COINS TO PLAY”. But that means…it reset somehow! I read about how serial communication can reset the arduino, though I didn’t understand it correctly and tried to immediately blame this for my problem.

I ordered a box of capacitors, which I needed anyway, so that I could keep the arduino from resetting. I tried it and nothing. I then realized that this couldn’t possibly have anything to do with my problem and started again! Then I found that if I didn’t use the clever macro to store log statement strings in Flash memory, like Serial.println(F(“Flash string”)), it seemed to work again! Why it’s obviously the macro to blame, not MY programming! But things got weird again, just much deeper than before.

What…the…hell…

Well…early on my scheme for dealing with the data I needed to load involved opening a file at a path, loading all the data, parsing, and moving on. So I did something that even at the time was something I new was a bad practice. A char array is passed in, I use it for what I need, free it, and do my work. Do you see the problem?

byte getByteFromFile(char *path, unsigned long index = 0) {
  File file = SD.open(path);
  free(path);
  byte b;
  if (file) {
    if ((index != 0) && (index <= file.size())) {
      file.seek(index);
    }
    b = file.read();
  } else {
    _print(F("[ERROR] File not found: "));
    _println(path);
  }
  file.close();
  return b;
}

I’ll make it more obvious, though an experienced programmer should already be annoyed at what I did, a nasty shortcut. With memory constrictions so tight, parsing data was getting painful. Here I have virtually unlimited memory on the microSD card and I’m trying to do everything in 2k of memory! I changed my scheme to virtually eliminate the need for parsing by having a much more verbose directory structure. Not as human friendly, but micro-controller work rarely is, and it’s all generated by Python scripts I wrote anyway. It was so convenient to use the same path char array over and over…yeah, that’s right. With the function above, when you use it, it gets freed (line 03), and the caller doesn’t know that. NEVER MANAGE MEMORY FOR SOMEONE ELSE. Keep it in scope people. Removed the free and suddenly the world was sunshine and roses once again!

The Swede is Life

…or…

He Who Controls the Swede Controls the Universe!

Dune Shield Fight
Dune Shield Fight

What’s better than sitting around drinking in the sun on Memorial Day weekend? Filming a swede for the bizarre, technically complicated, science-fiction adventure directed by David Lynch, that’s what! If you haven’t figured it out yet, I’m talking about the 1984 film Dune. After months of preparation fitting in those spare moments between work and life we finally got to our weekend of principle shooting. Continue reading The Swede is Life

Fashionably late – Still any dragons left?

As the title suggests, I’m an individual that is often fashionably late, at least by my application of the term. Events, parties, movies, dinner, work…and games. Last week I noticed Skyrim (for Xbox…I love PC gaming, but no time for it) hit $40 so snagged a copy. In very karmic fashion Amazon Prime 2-day shipping was also fashionably late NOT arriving Friday for my scheduled evening of dragon pouncing, but Monday instead. Though time was limited I couldn’t just not play…so I inserted the disc and…well, nothing.

Nothing. A black screen that lasted for just about…yes, ever. Always. Until it stopped and I was informed the disc to be unreadable. Someone really didn’t want me to get to this dragon party. Not to be thwarted, I quickly borrowed a copy from a friend explaining the obstacles being thrown in my path, and play I finally did. Don’t worry, a new copy is being swiftly sent from Amazon.

I’ve been playing single player games with a close female friend lately, lets call her Lala. It started with L.A. Noire, acting as my partner cracking cases which ended up being a wonderful enhancement of the game for me, so I suggested she help me put my character together to face this brutal medieval world with. There was no doubt I was to be a Cat Person (I don’t know the actual race name, and I prefer Cat Person). Initially my intent was to create “Catlock” since I’ve been researching Matlock for a Fringe Theatre script, but I began to doubt the availability of a cheap suits in the game. After deciding on all the physical features of my cute lady cat, we began quite a long argument on what the name should be.

Lala sternly informed me, after many suggestions, that I was not allowed to name Cat after food items or objects I could see around the room. I’m sure you can sense my exasperation at such absurdly limiting criteria, but I had decided to brought her into my single player world, so I must accept the good with the bad. Finally we landed on the fact that all my previous (real) cats had ‘M’ names…Monet, Mojito…you know, I think I WILL name my next cat Matlock. Anyway, the lovely name Moira came up, and suddenly the tension flowed out of the room. Phew! Of course you need a surname as well, but Lala was much more flexible here. We laughed at a number of ridiculous ideas until I landed on “Fuzzypaw”, which she immediately shortened to “Fuzzpaw” and suddenly we were done. It was time to venture into the unknown with Lady Cat Person Moira Fuzzpaw!

When it comes to games as open as Skyrim I have a particular approach to how I play my characters. I establish from the start a number of preferences and beliefs of the character to give them immediate direction and personality, but I like to leave room for the world to decide “what I really want to be when I grow up”. Moira finds casting magic absolutely distasteful, though wiggle room for enchanted items. Hand weapons are also a turn-off, except for a bow. She prefers to feel your face as she smacks you upside the head with her paw. As for loyalty, we’ll see how she’s treated!

Another habit of mine in open games is that as soon as I’m given free reign, I run the opposite direction of whatever I was told I should go do. Or at least straight into the woods so I can run into a pack of wolves that scared the crap out of me, but my flailing paws managed to do quick work to them anyway. My first real taste of adventure! No one coddling me or telling me what to do.

Lala and I decided to follow a road we came upon. After a few diversions trying to hunt elk with my bow, we came upon a farm where a small group were fighting a giant! I immediately rushed in to help, but fashionably late as usual the giant fell to the ground as soon as I arrived. My memory for detail is poor but this is the conversation I remember:

Mean Lady: Thanks sooo much for the help. *snort*
Moira Fuzzpaw (me): I did the best I could!
Mean Lady: Really? Wow, you suck.
Moira Fuzzpaw: *sigh* Who are you guys?
Mean Lady: The Companions idiot. We fix problems for money.
Moira Fuzzpaw: Like prostitutes?
Mean Lady: …
Moira Fuzzpaw: Can I join your club?
Mean Lady: YOU?!? You think you can be one of US?!? Anyway, go talk to this old dude. He’s a good judge of character. Good luck!
Moira Fuzzpaw: *gives the middle claw and walks away*

I was not a happy kitty. I wanted to help and they threw it in my face. I fumed and walked away toward the town, hoping to find an Inn since it was getting quite dark. I was confronted with a couple guards at a giant gate stating I wasn’t allowed entry because they heard about some stupid dragon…I’m not sure what that has to do with anything considering they can, you know, FLY, but I told him “I know about dragons!” and the morons prompting let me in.

After some wandering I found the Inn, bought a drink, jumped on a table pushing all items off (I’m a cat), and talked to an angry woman in the corner who got kicked out of the Companions. We had a great chat about what douches they are (she accidentally killed some boy…it happens!), and she really wanted to get out some aggression so I offered to box her a bit in the bar. “No weapons, no magic” she stated, which fit me perfectly. I smacked her around a bit, then helped her back up. A small pile of gold was handed to me and my first real in-game friendship was forged. I asked her to join me, and that we’d start off in the morning.

Text Message Spam

Aaaaargh! I’m sure you’ve experience this at some point. The thrill of hearing your own special little tone, or perhaps buzz from the quickly spinning weighted motor…who could it be? Your friend? Your lover? NO! It’s a damned service letting you know you can subscribe to get a horoscope or  some such other nonsense for a measly $9.99 a month! Act fast! Of course, they claim sending STOP will make sure you are never bothered again, but DON’T BE FOOLED.

Continue reading Text Message Spam