Forty-Two
On gaming, programming, everything!-
Moving a Rails app from MySQL 5 to Postgres 9
Posted on October 16th, 2011 No commentsAt Bloomfire we recently decided to do a full migration over from MySQL 5 to Postgresql 9. There are a number of reasons for this, including scalability, better feature sets (such as Psql’s full text search engine) and getting away from Oracle before we are forced to move. For the sake of this post, detailed reasons aren’t important.
What I’ve put together here are the few issues we ran into and changes we had to make to get the application working under Postgres. Overall the code changes are minimal as we mostly use ActiveRecord code for communication, and in the places we write SQL directly it was mostly standards compliant. That said here’s what we did have to change.
-
Component / Entity Systems
Posted on March 17th, 2011 No commentsNote: I’ve put this work on hold and am going another direction with this project. The C++ code is found in the ogre branch. I’ll have a new post about what I’m putting together soon!
If you’ve done any sort of game development in the past 5 years you’ve most likely heard of “Component Systems” or “Entity Systems” for doing object and scene management over an OOP hierarchy. Object Hierarchies may start out clean, but over the course of the development of a game, become a very difficult to work with. Components — very succinctly built self-contained clusters of data and logic that can be added to, or taken away from, anything — are the answer.
There is a ton written about these kinds of systems. A quick Google search of either of the terms in the title will get you to many of the most popular posts describing the why of Component systems, so I’m not going to dive into that myself. Instead, this post will be explaining how I’m implementing Components in Project Slartibartfast, why I’ve made the decisions I’ve made, and how I plan on continuing development with this system.
As an avid supporter of Open Source software, it’s been annoying reading so much about this radically different methodology and find very little code, or code examples that don’t solve the issue I’m trying to solve, concerning Components. Now that I’ve sat down and actually turned an idea in a working system, I realize that these systems really do end up being very specific in their implementation to the product at hand, be it a game, an engine, or something not game related at all. So this isn’t per-say a “this is how you implement Components and Entities” but an exposé of how I’ve decided to implement this in my game.
As an aside, because these arguments come up so often, my personal view of software development and design is that pragmatism beats idealism every single time. As long as you have a good reason for your decisions, build something that works, don’t fret that it’s not a “best practice.”
That said, lets dive into the Component system of Project Slartibartfast.
-
Project Slartibartfast – Introduction
Posted on March 9th, 2011 No commentsIt’s been some time since I last wrote (a little over a year, yikes!) and with a new year I’ve decided to finally take on some projects that I’ve been putting off for far too long, as well as getting back into writing and keeping a log of what I’m working on and why. I’ve spent so many years, and so many hours researching, reading, and consuming writings and code related to game design and graphics techniques that it’s time for me to give back to the community what I’ve learned over the years, and what I’ll be learning as I progress through this next project of mine.
I’ve been a gamer since I got my hands on my family’s first computer back in the early 90s. Running Windows 3.1, I was immediately enthralled with the device, and when I discovered things like Minesweeper and Solitaire, that was fun, but the game that hooked me was Treasure Mountain! If it wasn’t for my parents constantly yelling at me to get off and give my sisters time to play I would have sat there forever. Thinking back, it is a good thing that my parents got on my case about playing games, as I’ve learned to pace myself, but they were never able to dull that need to play something. Then I discovered programming.
I attribute my love of programming to Texas Instruments and their graphing calculators. I had messed around with QuikBasic (Nibbles!) but it didn’t click until I was teaching myself TI-BASIC on the TI-83. From there I was able to teach myself C to build apps for the TI-89 using TIGCC, and with these tools at hand, I was making my own games!
From then on I knew I was going to be a programmer, and initially wanted to get into the games industry, though for plenty of reasons that are a post in and of itself, I ended up choosing to stay out of that realm. I spent plenty of time tinkering, researching, and just keeping up with game development, but I never really sat down and made a game, or spent enough time on one to consider it “finished”. This year it’s time for that to change.
And thus was born Project Slartibartfast.
-
How Rice Works
Posted on February 23rd, 2010 No commentsRice is one impressive piece of software. I highly doubt I could have written this from scratch (and for that I give Paul Brannan huge accolades for his work) but after working with and on this library for at least a year I probably could. Now that lead maintainership has been passed on to me, I’d like to take some time to explain exactly how Rice works, how one can dive in and help develop this library, and what my plans are for the near future as I work to make Rice and the rb++ suite; a full and proper replacement for SWIG when wrapping C++ libraries into Ruby (if you’re wrapping a pure C library, I highly recommend Ruby-FFI, though Rice will work).
So with that, I’m putting together this post to help clarify exactly how the various parts of Rice work together, how the entire process flows and more importantly helping anyone who’s wanting to learn and work on Rice with a solid starting point (or at least officially crooked). After reading this, anyone should be able to understand the various classes in Rice, and have an idea on where certain functionality lives when looking to add features, or address any bugs. So with that, we’ll start at the top.
-
Modern Christianity and Evolution
Posted on October 4th, 2009 1 commentI read a very disturbing statistic recently: 39% of Americans believe in Evolution. I found this surprisingly low number in a recent article about a new movie on Charles Darwin’s struggle with his life, his faith, and his Origin of Species here:
The article does make some very good points. In America, religion rules. This can be seen especially today with the massive political upheaval of the recent elections, where we’ve got the “religious right” (mainly Christian, which I’m most familiar with) against the “secular left” fighting it out to the bitter end. What I have been trying to understand is why do less than half of all Americans believe in Evolution and how can we solve this? Is there a glaring and unrecoverable conflict between Evolution and Christianity? Is there any scientific evidence supporting either side? Is this an irrational, fearful reaction in the face of the unexpected and the new? And more importantly, why is it most Americans are so against Evolution while almost everyone else in the world has happily accepted the theory?
-
Game design lessons learned from World of Warcraft – Part 3: PvP and PvE
Posted on June 22nd, 2009 No commentsSo I’ll be honest. I’ve had a huge rant building up for some time now on how Blizzard has royally screwed up WoW, and continues to do so, because they have a flawed look at how to balance PvP and PvE gameplay together.
I’m not going to write it because frankly, I’d never want to read it. So I’ve condensed my point into three simple words:
BALANCE
PVP
FIRST
You simply cannot have a PvE game and add PvP on top of it. PvP is player skill, PvE is just numbers. One could go to the extreme and say that they can’t co-exist, but I’m not quite convinced this is true. Close, but not quite.
-
Adobe Flash 9 & 10 Security Requirements
Posted on June 3rd, 2009 No commentsFor those of us messing and working in Flash, the transition from Flash 8 through to Flash 10 have been rife with some major changes in the security model that allows a local Flash application to communicate with the outside world. Adobe, knowing that these are big changes, had its developers write pages, pages, and pages of documentation describing the where what how and why of these updates.
Problem is, it’s very hard to find the simple How-Tos for common situations in all this text. I spent many days scouring and tinkering to figure out the security solution to my application: a flash-based video viewer that would connect into a server and display Motion-JPEG frames that get streamed in.
Hopefully I’ll help save someone else the same hours of research and playing with this problem. My solution is such:
You first need up a simple service on the server you want to connect into that serves the crossdomain.xml content that defines your security policies.
I use a modified version of the service found here: http://www.lightsphere.com/dev/articles/flash_socket_policy.html. It’s updated to be a full Daemon process, so you need Proc::Daemon and Proc::PID::File installed.
Please note:
<site-control permitted-cross-domain-policies=”all”/>
is the required addition to make this script work with Flash 10. Also, if you are worried about corporate firewalls blocking ports < 1000, simply change $port to something bigger, and add the following to your Flash client:
And you're good to go!
-
The GOP is precisely that…
Posted on May 27th, 2009 No comments… Grandiose and Old.
I have to say, I’m impressed. I was appalled at the atrocities perpetrated by the Bush administration, especially now as more information gets leaked out, but what’s going on now is mind-boggling at best, and at worst will decimate our country to where we’ll never recover.
I refer, of course, to the constant Republican QQ-ing and stonewalling about the choices the Obama administration is making.
Ever time I hear a prominent Republican talk on TV, on the radio, or read something on the Internet, I hear nothing but “waaah waaah I’m not getting my way anymore so I’m going to make life difficult for everyone who doesn’t see things my way, waaah waaah!” Ironic, this, as it’s the old-folks that are acting like 8 year olds who aren’t getting their way.
Aparently, some of these people need a refresher for what THEY had a hand in for the past EIGHT YEARS:
- DOUBLING our National Debt from ~$5 trillion to > $10 trillion
- TWO wars, one justified one not
- The justified war in Afghanistan has been under-manned and assumed to be a “quick romp” to clear out the Taliban. Guess who’s back in power and even stronger?
- The unjustified war in Iraq has destroyed the friendships we had with many countries around the world and has made even MORE people angry at America, leading to MORE terrorists. Iraq will fall into civil war between Sunni and Shiite as soon as we leave, just you watch.
- Decimation of personal liberties through acts like the Patriot Act and the Digital Millennium Copyright Act (What did Benjamin Franklin say about safety and liberty?)
- Secret prison camps. Torture guidelines, Guantanamo Bay, Detention without Trial
- … and who knows what else we’ll find out about in the coming years
You guys have done a TERRIBLE job at running the country. Why should we trust, or even listen to, anything you guys have to say? You complain about lack of bi-partisanship, but then you don’t ever budge on your stances on bills. You guys are going to fight the new Supreme Court nominee (well, you’re probably still pissed that the exiting justice, David Souter, made you guys look like idiots, but I digress), only because it’s Obama’s choice, not one from your party.
You guys might mostly disagree with Limbaugh, but come on, you are all working towards Limbaugh’s ultimate hope, the “failure” of Barack Obama.
Do you care about this country? Or do you only care about your personal “values” that get thrown out of the window anyway once you’re in power?
Congratulations on losing most of the young vote (like myself), that’s really going to help you get back into power in the future. Oh and grats on alienating the Hispanic vote, and most of the Black vote too. In fact, the women vote is going to the Democrats as well (thank you Limbaugh!)! If anything, the self-inflicted implosion of the GOP has been very entertaining to watch, but the delusion that the party is still as relevant now as it was 20 years ago is causing far more damage than good.
That said, there is a simple solution to this problem:
Grow Up.
-
Game design lessons learned from World of Warcraft – Part 2
Posted on May 1st, 2009 No commentsWhile Part 1 touched on abstract decisions affecting game design (and admittedly turned into a rant by the end, I’m kind of bad at that), part 2 here will focus on a few of Blizzard’s design decisions for WoW that we can learn from, and in Part 3 I’m going to touch on my ideas and observations on the game’s PvP and PvE.
Now of course I can’t list, or even think about, most of the design decisions that have helped towards making WoW the massive success that it is, but there are a few decisions, both good and bad, that have hit close to home for me, decisions that I have to work with or around every time I play. Were I to be on the WoW dev team, these are some of the things I’d be recommending.
-
Embedding IRB into your Ruby application
Posted on April 2nd, 2009 1 commentA feature I realized would be very helpful to have in rb++ is a debugging console. Basically, I wanted the ability to drop into an irb session and have available to me the internals of rb++ and rbgccxml, all set up for the sources I’ve specified for the given extension.
Turns out, this is a lot harder to figure out than it would initially seem. The irb code is quite complex and nothing there is documented in any way shape or form. Also, searches around the Internet came back with results that were some six years old, and while helpful, did not pertain to my particular case.
Then I remembered that ruby-debug does exactly what I’m looking for. A quick glance in that code got me the code snippet I needed.
require 'irb' module IRB # :nodoc: def self.start_session(binding) unless @__initialized args = ARGV ARGV.replace(ARGV.dup) IRB.setup(nil) ARGV.replace(args) @__initialized = true end workspace = WorkSpace.new(binding) irb = Irb.new(workspace) @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC] @CONF[:MAIN_CONTEXT] = irb.context catch(:IRB_EXIT) do irb.eval_input end end end
And it’s use is quite simple. When you want to drop into an irb session, you simply do
IRB.start_session(binding)
and you will have a code prompt with all data available at your finger-tips.
You use this feature in rb++ as follows:
ruby your_extension_file.rb console
From there, start playing around with the parsed source tree using either @parser or self.namespace to get started.

