The story so far
- Saturday: Suddenly realize it is the week of the 7drl challenge.
- Sunday: Never made a game before. No detailed plans. Decide to try anyway. Start coding at around 11:30 PM…
- Use the tutorial at Coding Cookies to get a foundation. Strip out stuff I don’t need like inventory and experience.
- Start on gameplay idea based loosely on card games. You randomly draw a hand of cards (prayers, spells, whatever). You can only ‘play’ so many per turn/level/whatever. Not straying too far from the basic roguelike formula as I’m expecting a lot of effort just to make a game that works.
- Got an @ walking around in a dungeon.
- Tuesday: I need a theme. Anything but goblins. I dunno, lobsterfolk? Sure. Sounds good. Ooh, and they can have an Atlantissy dungeon. And the player’s god and abilities can be sea themed. Okay, this works.
- Add a few lobsterfolk enemies and start working on abilities system.
- Wednesday: Didn’t have a lot of time today. Implement a few abilities.
- Thursday: Implement more abilities.
- Today: Still need a title. Probably going with Chitinous Crooks.
To do in the next 3 days
- A few more abilities.
- Some less boring enemies.
- Rewrite most of the ability names.
- Win condition
- Victory Screen
- Failure Screen
- Graphics (Optional)
What’s behind each panel? Is it an original hand drawn ASCII robot for each day until Christmas? Take a look and find out at asciibotics.org or follow @asciibotics on Twitter for updates.
If you have ASCII art that needs to be programmatically manipulated, but you want to store it in a data file without mangling it too much with weird character escapes, quoting, or unwanted line-breaks, YAML is great.
Here’s an excerpt of the raw YAML data from asciibots.js. (This is later transformed into JSON during the build process.)
| o o |
| b d |
This uses YAML’s literal block format, indicated with the “
Inside literal scalars, all (indented) characters are considered to be content, including white space characters. Note that all line break characters are normalized. In addition, empty lines are not folded, though final line breaks and trailing empty lines are chomped.
There is no way to escape characters inside literal scalars. This restricts them to printable characters. In addition, there is no way to break a long literal line.
No escape characters! Perfect! It pretty much just works but there are few small considerations.
- Unless your ASCII art is perfectly left-aligned, you have to manually specify an indentation indicator. If you don’t, automatic indentation detection will fail and you’ll get errors when trying to parse your YAML. Here I use a “
1” (1 space) but you can use any value you prefer. You also need to indent your ASCII art to the appropriate level relative to the rest of the document.
- You also have to consider whether or not you want to include the trailing line break in your data. In this case I use the “
-” chomping indicator to request ‘stripping’ of the final line break.
So that’s what that “
The YAML documentation actually has it’s own ASCII art example but it uses a sample that doesn’t require the indentation indicator, so it can be a bit confusing when you just try to drop something else into the example and get parsing errors. Yes my first attempt went like that. Now you don’t have to make the same mistake I did.
Before we had Game Boys, my cousin and I had a collection of Tomy Pocket Games. There was Copter Fight, Caterpillar, Pass The Puck, the race car one, and more. They were simple but fun, and they kept us busy and out of my parents’ and grandparents’ hair on long car trips.
One that I really enjoyed was called Robot Factory. It wasn’t even really a game, just a little slot machine that had different robot heads and parts. You were supposed to get the parts that “matched” for the most points, but lots of times I would just spin to see what came up.
I was thinking about this project recently. I found the code still on my hard drive and decided to put it into a readable and maintainable format. I couldn’t stop messing with it. I added 6 more robots for a total of 16 so they could be addressed with hexadecimal digits because I though maybe they would be fun as little identicon-like avatars or something. And then I decided the faces were too samey so I added two optional digits for changing the eyes and mouth. It’s only a few characters but the faces give the robots a lot of their personality so I think it really improved the variety. It’s dumb nostalgia, but I made these face decorations optional mostly because I wanted the classic three digit IDs to still work. Anyway, I’ll probably keep tinkering with it from time to time but asciibots.js is up on GitHub now and a demo site is here.