Friday, February 12, 2016

Boxes not hugging the other boxes




What you see here is the introduction of a "corridor map", a network of navigation landmarks that the boxes use to find their way around obstacles. It's an improvement over yesterday's behavior of getting stuck on walls, in that the boxes are somewhat aware of the obstacles now. They can still get stuck, so there's room for being more aware of not making progress on a plan and bailing out to try something different.

Thursday, February 11, 2016

Boxes not overlapping


Adding to yesterday's demo, the boxes are now a couple different colors, still moving around. Now they bump into each other and use a simple constraint system to ensure that they don't overlap.

Also, I added some fixed boxes in the world that boxes might move around. Except they're not really smart enough to do that yet. Sometimes, they knock each other loose.

TODO: make stuff smarter.

Wednesday, February 10, 2016

Something a little different


This doesn't tie in to my previous posts, really. Just screwing around, getting a PyGame / OpenGL framework up and running.

There's a few boxes moving around the screen. So, that's something.

Friday, February 5, 2016

Spaceship Flying In Space

Back in college, before I knew much about anything, I gave a resume to a tiny little company called HDC Computer Corporation. That name kind of pegged them (constrained them?) to be a Microsoft Windows development house.

They managed to get some of their stuff bundled into Windows-286, if I recall correctly, including a little space shooter game called "HDC Rocks". Yes, it was about shooting rocks in space. Also, the title was a gag and tongue-in-cheek motto.

The Internet doesn't seem to remember that little nugget, but maybe it will now.


What you see here is the rebuilt version of as far as I had got on my "Space Rocks" demo - a little space ship moving around on the screen, rendering in OpenGL 2.1, with a window provided by SDL2.

Nothing's particularly exciting about it - the pathfinding, if you can call it that, is "move horizontally, then move vertically". There's no real obstacles. It doesn't have a lose condition.

But it's running again, OpenGL commands, as issued from my language, sent through a C shim to a vanilla OpenGL implementation.

As I mentioned in my previous post, I had lost a file (failed to check in my work) called gl_tools.c, which contained that layer, so the effort necessary to reproduce it was simply(?) a matter of exporting GL calls down into my library.

Sort of. The time management code is coming from SDL, so that took a little more attention. The initialization of an OpenGL context isn't quite as simple as I had recalled. I made use of Lazy Foo' Productions' SDL/OpenGL tutorial to figure out what bits I really had to rebuild inside my shim library.

And there you go, it's working again. And checked in, besides.

I even made myself a little convenience tool that launches the program, records frames of it rendering, then compresses that into an animated GIF all in one handy script. I could make it slightly cleverer, by forcing the window to open up at a particular point on the desktop, which would keep you from looking at my emacs window in the background. But maybe emacs makes you comfortable. I wouldn't want to deprive you of that.

The cursor, though, not so sure about that. I could easily suppress the cursor.


So. The demo is back up and running, and the thing I was running into back in July when I last checked stuff in (I don't remember this stuff, but GitHub does) was that I wanted to have a solid story about what I was doing with arrays of complex objects (like structs, say, like you might need to have for a bunch of asteroids floating across your screen). Would arrays have to be statically allocated? What's initialization like? Am I going to have pointers to these things? Python and Java don't have pointers, except that they do, but you don't see them. Is that what I want?

I want to avoid copying complex objects except by explicit deliberate action. It feels like there are a few other choices that can come as a result of that, but I haven't really meditated deeply enough to make it obvious how things ought to work. Perhaps the next step is to try some stuff, and be prepared to roll back if I don't like how things are working.

Wednesday, February 3, 2016

Setbacks, and starting not from scratch

So, it's been a while since I've posted about my compiler project. Projects being what they are, you don't always have steam for everything.

And then, a few months ago, the laptop where I had been doing my development was taken. I can curse the darkness, but it's not as bad as it might have been - I had most of the project checked in to two offsite locations. So, that's nice.

At the risk of Pollyanna, this is an opportunity to verify that I don't have hidden dependencies that I wasn't aware of. So, I'm starting on a new machine, and hopefully, I'll be back to productivity soon.


I've added a Prerequisites page to my development Wiki. (Is that external? I forget. Probably not, or I'd link here.) It's the stuff you'd expect:

  • LLVM 3.6
  • libedit-dev
  • enum34
  • llvmlite
  • PLY
  • emscripten
  • SDL

Ok, maybe not all of that is expected. I think llvmlite's dependencies could be tidied up. And maybe I don't need SDL for everything, but for the Pong sample app, I did.

Once I got stuff installed and cloned the repo down onto my machine, I built the pong demo as a local executable, and it worked great.

I haven't yet rebuilt the web version, but you can play it here, if you like: http://bigdicegames.com/BDGRT/Pong/pong.html - I just link it because I keep forgetting where it is, so this is a bookmark for my own purposes. Also, I notice that that doesn't play nicely with my (current) version of the Chrome browser, but it does in Firefox.

Looking back through my checkin log, I see that I had been doing work on my Asteroids tribute sample, but when I try to build it, it looks like gl_tools.c never got checked in, so I get to rewrite that. How hard can that be? Just wrapping stuff like gl_begin and gl_color3f. I should be able to knock that out in short order, maybe tonight.

I'm also noticing that building emscripten targets (like the web version of Pong) is failing, probably due to not having installed certain bits of emscripten.

But, I'm delighted to say that my little test programs for computing factorial and Fibonacci stuff worked just fine.




Wednesday, December 30, 2015

I've got a lot of books here.



Over the past week or so, I've taken 5 boxes of books to Half Price Books and just now filled another box to go out the next time I'm headed in that direction.

I like books. I like reading books. I like collecting books. I have maybe too many books. I have books that have perhaps been a fire hazard, making easy escape from my house a difficulty in case of an emergency. I have more than once bought a duplicate of a book, either because I've bought it already and forgot, or I just couldn't find the original.

Years ago, I thought it'd be good to organize my books by Dewey Decimal, oh, or maybe Library of Congress. Or maybe some sort of hierarchical tag-based scheme that I never got around to fully exploring. Now, I'm just happy if I can keep track of my books. 

I have a Google Drive Sheets spreadsheet, which is super handy - I can check it while I'm at a bookstore and see if the book I see in front of me is also waiting for me at home. This has already been a benefit.

But it's kind of ponderous - it's just a big list of stuff, and there's not a good way of identifying where a book actually is. (Organization.) I might also like to have a list of all my GURPS books, or when I get a new Kakuro puzzle book (I shouldn't be buying more of those), it might be nice to put it near the other ones of its ilk.

Also, barcode lookup might be nice to support.

So, I've been writing a tool.

Starting with web.py, and using MySQL (for now?), I started manually pulling individual lines from my spreadsheet in. The database knows that authors and ISBNs exist, but the web app has no way to display or edit them. But there's enough to start pulling one line at a time over from my spreadsheet.

Some(!) of my books are in boxes, and each box has its own ID. Each room in my house has its own ID. My house has an ID. So, there's a chain of containment there - such and so book might be in such and so box, which is in such and so room which is in my house. There are container links up from each item, and the web app is smart enough to do a select if I want to know what the contents of a specific box are. I've started printing out listings for the contents of boxes as I do my inventory - easy, just click the "contents" link off the box listing, and hit "print".

The web app does allow for me to use my fancy barcode scanner, storing UPC data for whatever items I feel like tagging. So far, it does nothing with that UPC ID, but I'm planning on doing an automated fetch from isbndb.org and making that data available.

I just now put in a facility where I can search for title substrings. So, if I ask for "gurps", it lists all the GURPS books I've entered so far (only 14, I'm just getting started). And when I ask for "apple", I get 21 hits, all for early '80s stuff. 6502 only hits 5 titles so far.

One thing that this should do is reach back to the Google Drive Sheets spreadsheet and mark which items in my spreadsheet have been added to the web app. And if I add a thing to the web app, it'd be nice if the spreadsheet reflected that without having to enter it twice. And maybe, it'd be nice to import from the spreadsheet, but if that's a lot of work, I'm OK with doing a manual inventory anyway, since my spreadsheet doesn't have a lot of UPC data, which I kind of want to collect at some point.

If you look carefully at the screenshot at the top, you'll see 4 digit IDs. That's not because I've catalogged more than 1000 items (well, actually, I have, but that's not why). It's because I had some idea that I'd use the thousands place to denote the type of object - allowing me to have enumerated categories for furniture, rooms, boxes, books, games, and other things. That categorization scheme has sort of fallen apart, but I might go back and rebuild it later, now that it's easier for a bit of code to enforce that sort of thing. Or I might ignore it, now that I've got code that makes it easier to filter and search.

Once I've got it reaching out and writing back to my spreadsheet, the next logical thing to do would be to reach out and write to a BoardgameGeek list, so my games would be listed there. But just games. Again, software is smart enough to mostly get that right, probably.

Also, maybe I could go back to my LibraryThing account and update my booklist there. 

Sunday, December 13, 2015

Clerics & Codenames, v0.0.2



Back in late October, I played a game of Codenames by Vlaada Chvátil. I was impressed with how much fun it is, how challenging, how much the words stuck in my head afterward, and how simple a game it seemed.

I appreciate that when somebody is really good at their art, they can make stuff that looks simple, even if it takes a lot of work, so to say that it seems like a simple game isn't meant to diminish it - it's elegant.

I also wondered how much work it'd be to make a playable set of expansion cards. I had a bunch of questions - should you go for simple words? Just nouns? Would choosing words from a theme make sense? (Star Wars? Computers? Geek Life?) Or would that narrow the range of possible connections too much?

I poked around, looking for word lists of common words (inspired by Randall Munroe's Thing Explainer, which also inspired Space Weird Thing, which is awesome, but is only super loosely connected to the game I was talking about), but couldn't find a list I liked, so I set things aside for a bit.

Then, last week, somehow the idea of taking a bunch of words from fantasy role playing games might be a place to start. I went back to a couple of the works that made an impression on me at an early age, the Holmes edition of the Dungeons & Dragons ruleset and B2 - The Keep on the Borderlands. Skimming through there (and paying particular attention to glossaries), I came up with many words that were burned into my brain first through Dungeons & Dragons.

Those words went into a Google Docs Spreadsheet (er, a Google Spreadsheet as hosted on Google Drive?), which I then exported as a CSV file.

Using Reportlab and PIL (actually Pillow), I made a PDF, which I printed out on cardstock:


I invited a few of my coworkers to sit down and see if a strongly-themed cardset would actually be fun, and I was surprised first by how enthusiastic people were, and then I was surprised that it played really well.

Some of the feedback included:

  • randomize the cards, because we had a bunch of 'h' words, followed by a bunch of 'c' words. Shuffling home-printed cardstock cards is challenging.
  • wouldn't it be awesome for the red and blue 'cover' cards from the Codenames set were also themed?
  • remove words that are too close in meaning. e.g. 'cave' and 'cavern', 'vial' and 'phial'.
  • rework the script so that the fontsize is consistent from card to card
  • I would totally buy this on DriveThruCards
  • Maybe this should be posted on Board Game Geek 



So, stuff I've done today:

Script rework. I reworked my Python script to generate either letter (print and play) or mini-card (Drive Thru Cards) page sizes. Reportlab's canvas object defaults to letter, but you can pass in a pagesize argument.

I pulled the UniversalisADFStd-Regular.otf file into fontforge and exported it as a TTF. This made Reportlab happier with the file, as the outlines were in a format that it liked. (Known issue, they're in no hurry to support Postscript outlines, or something.

In my 1st printing, I had worked around the OTF limitations by using Pillow to create an image just large enough to hold the text, rendering the text to an in-memory image, then using Reportlab to insert that image into my PDF. Now that Reportlab can render the text directly, I can skip Pillow for this, which fixes the odd sizing artifacts that I was seeing - for some words (ones with descenders, I think), the images were sizing differently from others. Now, since I'm not using images, the font sizes don't have that step to cause strange behaviors.

Randomized the cards. For the first image (above), I wanted to make sure I could easily find "dungeon" and "dragon", so I sorted the words. This led to a whole bunch of the same first letter. This will be solved, in time, when I get better printed cards. Until then, I might as well shuffle the words before creating the PDF.

Custom Red & Blue cards. I've made some solid color cards, as well as some temporary placeholder themed cards using copyrighted content that I cannot distribute. Red and Blue line up nicely with that particular content, though.

Word curation. I got rid of 'cave'. I added 'sepulchre'. I should probably spell that the way any good United States citizen spells it. Oops. Also forgot to remove 'phial'.

Printed out a new playable set:


I haven't got my print settings set up right - the cards aren't lining up front-and-back the way I had intended. Not a huge thing, totally playable as-is, but if I wanted to distribute this as print-and-play, I'd want to make sure that it's possible to line up the cards.

Board Game Geek posting. I have had an account on BGG for years, mostly using it to read reviews. I found the link to create a new listing for a new game, which itself depends on a BGG page for designer and publisher, so I created new listings for myself and for Big Dice Games. It's like I'm a real boy!

All of the above are under review. I think that's a good policy. If it were faster, I'd include a link here to my listings.

DriveThruCards listing. As much to test out the process (is the PDF I generated from ReportLab the right flavor of PDF that DTC is expecting?) as anything, I made a listing of this on DriveThruCards. This required setting my account up as a publisher account (whee). It also required a cover image, which I made by cropping the above photo. Good enough for a work-in-progress.

Apparently, it passed the simple checks to get to the point where I could order a proof, so I have. I'm eager to see if it prints without errors, and if it gets to me before I'm on vacation.


Feels like a lot, and this is for a trivial little expansion to somebody else's game. But it's fun to play, and it's been fun to go through the process.