Getting Circular With SDL Audio
home // page // Tips
Technical Tips

Getting Circular With SDL Audio

(Image Wikipedia Commons) Recently I’ve been having a lot of fun following along with Casey Muratori’s Handmade Hero project. As far as I know this is the first time a seasoned game industry vet like Casey has graciously decided to share the step-by-step creation of a professional-quality game. Amazingly, he’s also been including videos detailing every line of code and every major architectural decision. However, following along with the code examples can be tough if you’re not on a Windows…

Technical Tips

C++: Storing A shared_ptr As Lua Userdata

Recently I’ve been working on a game engine in C++. I’ve always wanted to participate in a Ludum Dare compo, and this work is in preparation for the December 1st compo. A big piece of the design of my engine is using Lua for scripting and providing novel Lua objects from C++ for this purpose. Yesterday I was attempting to embed provide a C++ object to Lua scripts. This object’s lifetime and ownership were managed using a reference counted shared_ptr,…

Ben Laposky, Oscilon
Technical Tips

Simple Software Verification, Part 3: Karnaugh Maps

(Image by Ben Laposky) Series Parts Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps Welcome to the third and final article in this mini-series on software validation. In this article we’re going to discuss state machines, what desirable properties they should possess, and then I’ll demonstrate a simple tool for verifying them called Karnaugh Maps. Identifying State Machines As a general rule of thumb, you can identify a program that is a potential…

Technical Tips

Simple Software Verification, Part 2: Trace Tables

(Image by Leonardo Solaas) Series Parts Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps Welcome back! In the previous article I explained why you might be interested in software verification techniques and then showed you how to use Execution Tables to verify your software for specific cases. In this article, we’ll generalize Execution Tables into a format that will allows us to create simple inductive proofs about our loops. Trace Tables To demonstrate this…

Technical Tips

Simple Software Verification, Part 1: Execution Tables

Series Parts Part 1 – Execution Tables Part 2 – Trace Tables Part 3 – Karnaugh Maps (Image by Manfred Mohr) Introduction If you’re a software developer, and you work somewhere even remotely sane, then chances are good you employ some form of automated testing in your day-to-day practice. Automated testing is a wonderful and extremely valuable tool, but there is nevertheless something slightly fanatical and suspicious about the claims of those who prescribe it as the strategy for managing software quality. Namely, experience teaches us that…

Technical Tips

Monitor Celery Queue Consumption Speed

A lot of times when using the python Celery library it’s useful to be able to monitor how fast the queue is being consumed. This is useful if you need to do a back of the envelope to see how long  a queue will take to chew through, or just to see how the current status of the queue to make sure there aren’t any blockages. So I decided to whip up a simple script to do just that. While this…

genetic algorithms
Technical Tips

Implementing Genetic Algorithms In Scheme

I’ve been learning a lot of Scheme programming recently, and while learning is great, it’s nothing if you can’t cut your teeth on a project of your own every once in a while. I needed a project. It had to be something not dictated by SICP, something fairly challenging, and also something of decent size. When I first tried reading SICP in college, I’d tried implementing genetic algorithms in it and failed horribly. To see if I’d made any progress I…

Technical Tips

Python Tip: Convert XML Tree To A Dictionary

I was doing a simple XML integration with SOAP service today and it really struck me that a lot of the data manipulation would be easier if the data was a dictionary. In addition, the XML returned was guaranteed to be fairly small and have only a handful of schemas – so a full-blown SAX parser wasn’t really necessary as there was no risk of overflowing memory with the raw XML data. So I decided to write a simple recursive…

Technical Tips

Trying To Recreate An SICP Example In Python

This morning I was playing around and decided to try and recreate an example from Structure and Interpretation of Computer Programs (SICP). Along the way I discovered some unexpected gotchas with how Python scopes closures. The example I was trying to reproduce was the following one: (define (make-account balance) (define (withdraw amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) “Insufficient funds”)) (define (deposit amount) (set! balance (+ balance amount)) balance) (define (dispatch m) (cond ((eq? m ‘withdraw) withdraw)…

Technical Tips

Better Emacs Rainbow Delimiters Color Scheme

I’ve recently gotten into doing a lot of lisp programming in emacs, and rainbow-delimiters-mode is a huge help in terms of visually finding your way around. What I wasn’t  thrilled with, however, was the default color scheme which is rather bland. So I decided to spice it up. So here’s some better defaults for rainbow delimiters mode: (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;;…