Using Fuzzy Logic to Control a Videogame Defenseman


Fuzzy Logic Primer

Fuzzifying Hockey

FFLL API and Spark!

Rule Generation

Final Results


Contact Me


So what is this all about? As the title suggests, the next few pages describe how I used fuzzy logic to control the behaviour of a videogame defenseman. This work was done as a project for an algorithmic animation course I took in the Department of Computer Science at the University of British Columbia.

I must warn you that I do not claim that my work is elegant or complete. I was under some tight deadlines, so you must excuse the rough edges. With that out of the way, let me explain the motivation behind my work. One of the very first grad courses I took was one that covered fuzzy logic control. This course was offered by the Department of Mechanical Engineering, so the applications described were for mainly process and plant control. I did see, however, that fuzzy logic could be used to control many other things, video game related things. I had visions of monsters, racing cars, and eventually hockey players, all being controlled by fuzzy logic. For the course project, I settled on using fuzzy logic to control the position of a videogame defenseman. Back then though, I neither had the confidence nor the technical skills to produce a satisfactory demo. I wound up using the fuzzy logic toolbox in Matlab to complete the project. It was all very ugly.

Fast forward to the fall of 2004 and I found myself in CPSC 526, an animation course in the Department of Computer Science. The course project called for investigating novel ways of controlling animation or the behaviour of characters. With the fuzzy logic project of the past still in my mind, I thought I might be able to use fuzzy logic again. This time around though, I had the power of OpenGL, GLUT, and a fuzzy logic API on my side. I thought of a completely new control scheme and went much further than my previous project.

I invite you to explore the next few pages and try out my demo. If you've ever wondered how fuzzy logic can be used in video games, I will try my best to explain my approach here.