The Project I Care About: Rancher’s Delight

Code Projects — Tags: , , , — Ardekantur @ 10:37 pm

I made a lot of progress this weekend on the project I brought to the forefront once I put aside all the other projects I realized I wasn’t that interested in.

Rancher’s Delight, if you don’t know, is a game engine I’m making based on the SNES classic Harvest Moon. Its primary goal is to faithfully recreate the underlying engine for the original game. Once that is done, I will extend it to allow for a programmable system that will enable anybody to create any kind of Harvest Moon-like game they wish.

What I accomplished this weekend:

  • removed the old code that dealt with resizing the viewed area to make sprites and locations larger. If I need this again it can easily be rewritten, but it has to fit into the new underlying framework.
  • wrote different functions to take into account the character moving versus the world scrolling under him. The former is used when there’s no more location to scroll in that direction, and coming away from the edge of a map where he’s not in the center yet. The latter is used for everything else.
  • added in-game objects, and ensured that they are stationary with the background when the character moves.
  • added a prototype of the messaging system, using font rendering for the messages and a surface with the original dialogue box on it. It can fit a bit more content than the old fixed-length one, but the content needs to be hand-checked to ensure it doesn’t spill over the edge of the box. It may be worth it to enforce a cut-off just in case.
  • started enforcing cardinality in a character’s facing direction, along with slowly putting together sprite sheets.
  • started playing around with, then polished off, cycling sprites for movement.
  • completely refactored everything up to this point, making everything a lot cleaner. There’s now a sort of God object, the Camera, which takes care of all kinds of relationships between things. Already a lot more relationships can be refactored out, but I can’t see the most effective ways to do so until the whole thing gets a lot more complicated. Primarily I’m starting to see the difference between an object doing something, and the user seeing what it does.
  • introduced a frame length to cycled sprites, which I’ll need to tweak along with the movement speed to get the best recreation of how Jack moves in Harvest Moon. This is really important to get right, as a the timing of the game and how people play it rely on the movement of the main character for precise schedules.
  • stitched together the exterior of the farm, where all the magic happens.
  • created a tool to replace the soon-to-be game objects in a location (such as the stumps and weeds in the exterior farm) with random ground tiles. Fairly simple and effective.

So, yeah. A decent amount of work. You can keep track of the progress on the GitHub feed of commits for the project, as well as test and try it out yourself by cloning my repository:

git clone git://github.com/ardekantur/ranchers_delight.git

In the meantime, here’s a pre-release screenshot :-) It’s Jack spending some alone time on the church roof.

Jack contemplates jumping off the church roof.

Fall Cleanup

Code Projects, Metadiscourse — Ardekantur @ 10:09 pm

In an effort to focus, and more importantly, focus on the projects that I really want to work on, and would benefit from personally, I’ve removed the following projects from GitHub:

  • my fork of rest-client
  • bulletin
  • wondercroc
  • uproar
  • clementine
  • flint
  • quandry
  • ioaxiom
  • taskforce

If you had any interest in any of these projects, let me know and I could provide you the source, or any guidance for what I had planned for them. As it stands, this leaves me with Taskomaly, which I’m slowly waning interest in since my move to Things, and Rancher’s Delight, which, as a game and a very large undertaking, probably won’t see a lot of progress. This leaves me with a virtually clean slate with which to start thinking about problems I’m interested in solving.

SUUIDs

Observations — Tags: , , , — Ardekantur @ 6:26 pm

Mostly this is just farting around but I thought I’d post about it because it’s an interesting idea, at least in theory.

GUIDs are good but I wanted to do one better. So I created SUUIDs. Super Universally Unique IDs. The format of the current version, v2.0, is thus:

2/xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxx

Where x is a case-sensitive alphanumeric character. This gives us somewhere in the area of 3.35×10^64 possible combinations, and a lot of interesting characteristics.

  • For example, if the address space of a given ID is all hexadecimal, and the last four characters are IPv6, this functions just as well as an IPv6 address format. Thus, The IPv6 address 2001:0db8:0000:0000:0000:0000:1428:57ab is notated as 2/20010db8-00000000-00000000-142857ab-IPv6. If a field contains all the same character, you can replace the ending hyphen with a comma and the field with a single instance of that character, so that IP address could also be 2/20010db8-0,0,142857ab-IPv6.
  • In the same token, the same rules apply to a message that ends in 0MD5 — that’s an MD5 checksum as well as a unique address.

An implementation in Ruby:

	module SUUID
	  def self.gen
	   chars = ("a".."z").to_a + ("1".."9").to_a + ("A".."Z").to_a
	   x = [8, 8, 8, 8, 4]
	   x.map! {|i| i = Array.new(i, '').collect{chars[rand(chars.size)]}.join }
	   return "2/" + x.join('-')
	  end
	end

It’s not pretty, but it gets the job done. You could always throw a more random source of entropy at it, use the system date, time, whatever. Don’t particularly care about the implementation.

Here’s what a couple look like — to get used to the idea :-)

2/f9nuBgzm-HGTE4bSK-ZEfkfsRp-T3SXgpXA-5LNC
2/hoyOCd7o-V48NQGvv-OS5RBDIl-CG1FRNqG-Xd3j
2/sUZd6aGa-1J55rs9C-lxH1mvPA-I9PAvkOh-ZLVj

Additionally, you can omit the version number, which so far still allows for distinction between version 1 and version 2 (version 1 didn’t have lowercase letters). This means you have a nice set of directory names at your disposal.

mkdir /DOMejDTy-APESCioG-yyXpXBNL-lYAuQogL-Uep9
mkdir `curl -X POST http://example.com/suuid/provider`

I have no idea how checksums, hashes, verified randomness all fit into something like this. Just something fun and stupid to keep me occupied today.

Taskomaly 0.1.0 Released

Code Projects — Tags: , , — Ardekantur @ 9:08 pm

Taskomaly Logo

So, yeah. Taskomaly 0.1.0 (now 0.1.1 to deal with some things) is released, but I’m not too happy about it. It’s a very confining release. Here’s what you need to know, things that are implicit in the code, but not in the documentation.

  • Project names are converted into symbols for no real reason, but they lose their formatting in the process. “My IBM Project” will become :my_ibm_project, which will then get transformed into “My ibm project:” when the project name is formatted for a task file.
  • Comments are ignored and not parsed, and not brought into a formatted task file.

I think that’s it, but those are constricting things nonetheless. Tests pass, but only because I use special cases for these things. I know. I’m ashamed. I’m going to add better criteria for all the tests, and stick it out until the next release.

But basically anything that you want to do with papers, projects, and tasks is available for you. The README explains how to integrate it with Tasko.

Right. The whole thing needs an overhaul API wise. Already. I’m not sure if that’s a function of my using TDD naively, or if I’m just a bad programmer. Let’s say a little bit of both.

In any event, what there is, is well-documented. On top of that, if you have any issues or test cases you want to provide, throw them to me at my Lighthouse project for Taskomaly. Things like that would be wonderfully appreciated, since this is the sort of project that builds itself based on the most common habits of the people who use it.

Enjoy!

$ gem sources -a http://gems.github.com
$ sudo gem install ardekantur-taskomaly

If you get any version from GitHub that’s not 0.1.1, wait a couple minutes and try again. GitHub says it takes up to ten minutes to propagate a gem change, and I haven’t been keeping track of time.

Generating Multiple RSpec Files from a Design Document

Ruby, Software Tweaking, Test Driven Development, YAML — Tags: , , , , — Ardekantur @ 10:55 pm

Taking queues from Adam Wiggin’s first commit to his Rush project, simply a design document and some specs, and Err the Blog’s post about BDD and generating specs from YAML, I’ve written a small Rake task that will take a single file design document in YAML and separate it out into the components you specify. For example:

spec/design.yml

Website Integration:
    - should be able to log in from the front page and land at your profile
 
OpenID module:
    - should accept an OpenID URL
    - should return an error message if the URL cannot be reached
 
User:
    - should have a valid user name
    - should return an error if creating a duplicate user name is attempted

And then:

rake design

Takes the section headers, and flattens them as the filenames. So this particular design creates three different files, website_integration_spec.rb, openid_module_spec.rb, and user_spec.rb. They’ll look like this:

spec/user_spec.rb

require File.dirname(__FILE__) + '/spec_helper'
 
describe 'User' do
 
  it 'should have a valid user name'
  it 'should return an error if creating a duplicate user name is attempted'
 
end

And just like that, you have your specs, ready to go!

Here it is:

Please note that it will destroy those files if they already exist, replacing them! I really don’t care if you lose your existing specs! Back them up if you want to try this! You have been warned! This is more of a technique for a brand new project, anyway.

Also, please note that I’ve embedded the rake task as a GitHub Gist paste, so feel free to fork it and modify it. I’d be interested in seeing cleaner, more interesting implementations of my 30-second hack. Additionally, please choose view raw if you want to copy it, seeing as how GitHub seems to bork on a newline character in the code snippet.

Next Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2008 Ardekantur | powered by WordPress with Barecity