Skip to Content
Our misssion: to make the life easier for the researcher of free ebooks.

Functional Programming and 3D Games

The computer gaming industry began in the 1970s with Pong, and has grown with the progress of computing technology into a billion-dollar industry. Todays commercial games are sophisticated pieces of software and may be written in hundreds of thousands of lines of code. Most commercial games require one to three years to develop in contrast to the development cycle typical of games in past. Most of the development cycle involves initial programming and then lengthy testing and changes to the initial code.

Many game developers are concerned with the length of game development cycles, as longer game development cycles mean higher costs and a longer period before there is a return on investment.

Recent advances in computing have seen functional languages lead to better productivity in many industries. Ericsson have used a home-grown FPL, Erlang Language to build large telecom systems. In certain tests, they claimed to have measured improvements in productivity between 9 and 25 times greater.

It is plausible the video and computer gaming industry may also benefit from the use of functional languages. Functional programming languages offer many advantages compared with the imperative languages that are widely used in this industry.

Functional programs are much more concise when compared with imperative programs. They allow for the use of powerful abstractions which can be used to improve structure and modularity of code. Functional languages also allow for polymorphism which promotes the reuse of code and less redundancy in programs.

An important aspect of game development is the gameplay. In simple terms gameplay means how a game is played. Many games fail to sell well because the way they were designed to be played does not appeal to the consumer. The prototyping of a game is vital when trying to get a third party to fund or distribute a game before it is completed.

Game developers have to verify whether their ideas are viable through the playtesting of the prototype before they continue to code the game. Unfortunately this may be time consuming. With functional languages, an executable specification for a game may be written and playtesting can be completed in less time.

The potential benefits of functional languages when applied to game development form the motivation of this thesis project. It is hoped that this research will help in reducing the problems that game developers currently face and increase productivity.

Contents
1 Introduction

    1.1 Goals
    1.2 Overview

2 Background

    2.1 DSLs
      2.1.2 Functional Reactive programming

    2.2 Games Implemented in FRP
    2.3 Non FRP Implementations of Games
    2.4 Yampa

3 Design and Implementation

    3.1 Programming the main loop
    3.2 Game facilities
      3.2.1 Messaging
      3.2.2 Collision Detection
      3.2.3 Visibility Testing
      3.2.4 Updating the Collection of Game Objects

    3.3 Implementation of objects in Yampa

      3.3.1 Gravity
      3.3.2 Jumping, Falling and Landing
      3.3.3 Projectiles
      3.3.4 Player
      3.3.5 Adversarial AI

    3.4 Animating Signal Functions
    3.5 Graphics and Animations

      3.5.1 BSP
      3.5.2 MD3
      3.5.3 Textures

4 Benchmarks

    4.1 Benchmark 1
    4.2 BenchMark 2
    4.3 Comments

5 Discussion

    5.1 Yampa
    5.2 Haskell

6 Conclusion
Future Work
Bibliography
Glossary
Listings
Download
Functional Programming and 3D Games