Archive for the 'Programming' Category



Thieves Tavern Beta

Published on October 23, 2008

Its been a few months since I announced I was going to try to write a PHP based Mafia game and in that time I’ve learned a decent amount.

First off, if you want a project done, you can’t be getting distracted. Since I’ve started Thieves Tavern I’ve also fallen in love with motorcycles and started gun smithing. Both of those have stolen major programming time away from this project. Its only through the weather being downright cold lately, and parts for the gun being on back order that I’ve had the time to get gung ho on this project again.

Secondly, when dealing with databases, its really easy to tailor the database so that the game works. In fact, that’s the whole point of editing the database: To test this bit, or that bit… but not the overall product. Earlier this week I’d reached a point where I thought I could push my code live, and invite some friends to beta test it. I figured, at the time that clearing out my database would make stuff work better, get rid of all the random edge cases I’d built up along the way. Well, after clearing out the database, nothing worked. I couldn’t start games, I couldn’t chat, nada. This is when I learned that it doesn’t get easier after removing test data, only harder. It took another two days of testing, clearing, testing some more, as well as cleaning up my code, before I got it back to the ‘working’ beta state. Thankfully, now I know its working as intended (minus the obvious beta bugs, of course).

So now its off to beta test Thieves Tavern. I’m kind of excited to be playing this, I had loads of fun while playing myself in local tests, and I can imagine it being even better taking out friends online. If you’d like to help test, get ahold of me (in real life, I’ll ask for signups for a public beta later on) and I’ll send you an invite.

(And in the 10 minutes it took to write this I already have a laundry list of fixes/stuff I just plumb forgot)


New LJ Crossposting script

Published on September 26, 2008

I nabbed a plugin to fix my borked LJ Crossposting script… mine was not behaving nicely. So this is mainly a test to see if/how it works.
Test.
Test 2…
Big Test
Now we’re testing an edit, and adding in a link to the plugin’s home.


Head First…. Mechanics and Gun smithing?

Published on September 10, 2008

Its been a long time since I’ve written anything, I’ve kept busy at work and at play. On the work side I’m going to look into what it will take for me to actually run Three Planets as a real company, mainly for tax purposes and my own sanity. On the play side, there’s been a LOT more developments.

I just picked up a motorcycle about two months back since one thing I love to do while stuck on some code is drive. Naturally I figured that riding would be an even better escape. It turns out it is, but I’m concentrating too much on the riding to be able to head-code. The upside is, this is probably the most fun activity I’ve ever found. So, meet Kari:

I realized on Sunday that I’ve put 1000 miles on her in the month and the week since I got my license, not too shabby considering I probably spent on the low side of $100 of gas for that entire time! Since she’s an older bike, I’m doing as much of the maintenance as I can, so that I’ll only need a mechanic for major operations. More on that later.

I also (very, very recently) decided to get into Gun smithing. To that end, I’m going to be making an AR-15 over the next month(s), and keeping track of my progress here.

So, what do the two new activities have in common? Both of them stem at least partially from an interest to be reliant upon only myself for work. This comes from the programming I do, where I have chided others for not thinking outside of the box, and really doing anything they want with the code. It finally dawned on me that that goes in all walks of life, and you can even approach it in the same way.

Lets take the Gun smithing, for example. I’m approaching this from a design perspective first. I laid out what I want to use the gun for, then set my constraints (money), and planned out the parts. This is exactly the same method I take for programming: First I’ll plan out how I want it to look/act, figure out what corners I have to cut to keep it within my memory/CPU/bandwidth bounds, then start with the functions.

In this case I decided I want something for (eventually) match target shooting, for medium ranges (100-600 yards). My constraints were that I wanted to build it all myself, short of fabricating the parts, and that i didn’t want to spend more than $700 on the total cost. So far I’ve decided on the following:

  • DPMS Lower Receiver, stripped (already purchased)
  • DPMS Lower Receiver parts (already purchased)
  • Advanced Technology 6-position collapsible stock
  • Ergonomic pistol grip
  • 20″ chrome lined barrel (not sure of manufacturer yet)
  • Flat top upper receiver with rails
  • Generic bolt/bolt carrier, stripped

It should be a really fun project, I look forward to learning a new machine and how it all works. This will also mean that from now on my firearms will be like my computers, completely unique, and I’ll have an intimate working knowledge of each and every part.

So why now? Why am I trying to learn all this new stuff once I get out of college, and not while I was in it? The answer here stems from some conversations I’ve had about why I enjoy firearms, and thoughts I’ve had after them. The short answer is: “I’d rather learn how to shoot now, when I don’t need to, than later when I need to, but don’t know how.” I don’t think carrying rifles in public is necessary, though I am a vocal defender of the 2nd amendment, however I do think it is very short-sighted to assume you’ll never need to use a firearm, and therefor write them off. Didn’t you learn how to change a tire, even though you may never need to, perform CPR in gym class, or how to balance an equation in science (or for the scientist, write in plain English, or not blow up the world)? Sure, all of those will be needed a whole lot more than shooting, but other than CPR shooting might be the most important to know if any of those situations came up.

Now, I considered myself set once I learned safety, and how to aim properly. But lately I’ve been thinking that its really short-sighted of me to assume the rifle will work perfectly all the time. More importantly, I don’t know when its not working at 100%, because I don’t understand it all. Just like the sorority girls whose computers I’d clean up at the end of the school year, I might not realize all the junk that is building up inside my gun. So, I’ve decided that I need to know at least basic gun smithing, just in case. Knowing this will keep me, and those around me when I shoot, a whole lot safer in the long run, plus save me money!

The motorcycle is the same story. I have no idea what’s going on, and if you read up on an inline-4 engine, there’s really no excuse for that. So again, I’m teaching myself basic mechanics in order to keep my machines running as smoothly and safely as possible.

And if you think about it, these skills of checking the usual fail points, oiling the squeaky parts, and throwing your own custom parts in, are the same across many fields, not just mechanics, gun smithing, and programming. So get out there, and get yourself head first into a new field today!


Thieves Tavern - Where all the cool kids play

Published on June 28, 2008

For about two weeks now I’ve been working on a PHP version of the game Mafia. If you don’t know it, mayhaps you know the name Werewolf, or Assassin (not Assassin’s Creed, like I had some people guess…. there’s no way I could port that to PHP). If you’re still in the dark, check the [...]


Dungeon Runners Character Sheet Library

Published on March 15, 2008

I took the past week off work for a final Spring Break, since I graduated early. When the friends visiting me left a day early I decided to use Friday to catch up on my programming. My goal was to finally create a library for people wishing to create character sheets for Dungeon Runners (that popular MMO I’ve been playing about once a month). The result is DRCSL, the Dungeon Runners Character Sheet Library, which gives web site owners an easy way to create character sheets or just pull random character data quickly. I used the DRCSL this morning to create a quick MediaWiki extension that spits out a pre-formatted character sheet. Lets discuss:

DRCSL
DRCSL is a php library written using PHP 5 and PHP objects. At its core it is currently just one file, Character.php, that upon its creation fetches the character XML from NCSoft’s servers, and stores all the data. Once the data is stored, the Character can spit out its information with just a few commands. What’s required to use this library is a web server with PHP 5 on it, along with wget to fetch the XML. A default Linux PHP install works just fine, though if your host blocks exec() callouts you’re out of luck. I’m on my first release, so the paths are hard coded for Linux delimiters which will be fixed in the future (of course, the Windows host will still need wget installed).

An example:


<?php
//Include this file to have it include everything ya need.
include "drcsl.php";
//Create a new Character
$billy = new Character("Segfault");
//Store the character's name
$name = $billy->get_char_info("Name");
//Store the character's title
$title = $billy->get_char_info("Title");
//Display some info
echo "$name is a $title\\n";
?>

This would print something to the effect of:
“Segfault is a Coordinated Practiced Poison Ranger”

MediaWiki Extension
The MWE became real easy after I created the DRCSL. Rather than include a ton of the code from my Character Viewer into the Extension, now all I had to do was include drcsl.php and come up with a default view. It looks something like this, by the way. In all it took about an hour from the time I woke up this morning and decided to finally create one to having a test version out for TheTownstons to test.

To use the MWE one just creates a page and includes the drcsl function.

{{ #drcsl: Segfault }}

Further Reading
More details on both of these projects can be found at the DRCSL website. I was going to write more but there’s something bugging in my Code Highlighter plugin (hence why the code looks like non-highlighted junk) and I’m fighting the urge to go fix it.


Dungeon Runners Website on Linux

Published on December 23, 2007

For those that use Linux, read my post yesterday, and decided to check out the website for Dungeon Runners, I apologize. I should have pointed out that their site is very, very unusable on Linux (ok, to be exact, I haven’t gotten it to work with any version of Ubuntu, and Firefox). That changed today when I cooked up a small GreaseMonkey script which hides their Flash “movie” that plays in the background. Its not really a movie, its actually just a static image, but its loaded as a Flash movie. Anyways, its quite easy, go install GreaseMonkey, then the following script:

// ==UserScript==
// @name           Dungeon Runners Linux Compliant
// @namespace      http://thesnarky.com
// @description    This removes the flash "movie" which blocks the main site for Dungeon Runners
// @include        http://dungeonrunners.com/*
// @include        http://boards.dungeonrunners.com/*
// ==/UserScript==

var objects = document.getElementsByTagName("object");
for(i=0; i

Can download it by clicking here: http://thesnarky.com/wp-admin/dungeonrunnerslinuxniceuser.js

This finds the one Flash object named bg_chars (which is the offender in this case) and tells him to go quietly sit in the corner. And such, all is right in the world, I don’t need to boot into Windows to troll the forums (just to play the game).


Dungeon Runners

Published on December 22, 2007

I’ve taken to playin Dungeon Runners as of late, trying to scratch that itch that leaving WoW created. Actually, I’m quite happy to be done with WoW, and Dungeon Runners is casual enough that I can play and not get pressured into sticking on for long hours for “Just one more Ony raid”. In addition, Dungeon Runners is free, so long as you put up with ads you barely even notice!

As always I get distracted from playing games by writing stuff for them and DR is no different. They just released a service where you can nab an XML version of a player’s data and though it has some bugs its quite a yummy service. I spent the day hacking up a viewer for it, and this is what I came up with:

http://threeplanetssoftware.com/software/dr/

Its fairly empty right now, but the character stuff works as well as NCSoft will allow. In fact better, as I’ve solved an issue the other developers of these viewers hasn’t, the fact that some icons have the wrong name. So, anywho if you want to see it work, you could check my stats: the character’s name is Segfault.

Oh and just to satisfy the geeks out there: This is built in PHP, using simplexml to chew though the data. Pretty URLs are (obviously) done with mod_rewrite and javascript on the form. Tooltips are made using the Walter Zorn tooltip library.


I can has vote pictures!

Published on December 3, 2007

You may recall I like cute cat pictures with captions. I’ve been really into viewing the voting pages lately because there’s LOTS more pictures every day that you don’t get to see otherwise. Unfortunately these pictures don’t have individual links given with them so I couldn’t paste into relevant conversations, and lets face it, every conversation can be relevant to a cute cat so I hit this problem daily. That is, until now. Have a go at this page. Ugly as heck, but leads to cuteness.

To use it, lets say you’re browsing the voting page when you find something adorable. To get its link, right-click on the picture, and copy the image’s location. Paste that link into the URL field on the vote_link page, then hit ‘Find’. At the top you’ll be given the first link you gave (to make sure it’s working), and the link I generate to its individual page. Click on the second ‘here’ and there’s your link!


Bluetooth Device Lookup

Published on November 22, 2007

Happy Thanksgiving! I’m spending the break catching back up on the state of Bluetooth security because, hey, I love the subject. Everyone has a phone with Bluetooth, just about, and many overlook it as a security hole because they feel there’s nothing insidious that can be done with just replacing wires with some radio broadcasts. I’ll give a quick rundown on how to get Bluetooth working under Linux, then the software I use, and finally give a tool I wrote watching the Dallas Game to speed up identification of Bluetooth devices.


SVN - It’s the Law

Published on July 15, 2007

For the past few weeks I’ve been working for Harkins, specifically for NearbyGamers, to build a Facebook application. Work was going nicely, and this afternoon I finally got close enough to being done to set a release date for myself: Friday afternoon. Now, if that went as planned, would I be writing this post? I left my SSH session open, grabbed some dinner, and sat down to play Chez Geek with a friend. I wandered back about an hour later to find my SSH session hung. This happens often, not sure why, so I thought nothing of it, closed the terminal and logged back in. But when I got to the file I’d been working on, it appeared to hang again. Maybe the file was getting too big to load in a quick manner? 10 seconds later and vi still showed no data. Then, to my horror, I realized it was because the file was empty. A quick ls -al showed the following: