In this book we present the functional language F# for those who wish to learn it with a particular focus on fun applications such as simulations (physics, AI, etc.) and games. Of course F# is a general purpose programming language, and even if in this book all the samples are geared towards simulations nevertheless the techniques and constructs used are more than enough to tackle most other real-world problems. Also notice that until the last chapter we will not use any special gaming related libraries; rather we will limit ourselves to the standard F# libraries.
We will use a very hands-on approach to development: each chapter opens with a sample problem, such as simulating a bouncing ball, a rocket, an asteroid field, etc. The source code of the solution is given and then all the constructs used are discussed in depth in the rest of the chapter.
Most of the samples (not those found in the last chapter, which require XNA 4.0) work on Windows, MacOSX and Linux thanks to Mono.
The book is recommended for programmers who are already familiar with an imperative programming language; a little bit of knowledge of object-orientation may help in the latest chapters, but it is by no means required. The book may also be read by complete beginners to programming, but in that case the reader should expect to have to *study* the book and not just read it; studying the materials of the book though is not particularly unexpected, given their origin: both authors teach Computer Science with F# and games at Ca' Foscari University of Venice, and thanks to this we have already battle tested many of the examples and the general approach used in the book. Chapter 5 in particular should be of interested even for advanced (functional) programmers, given the in-depth treatment of computation expressions (monads) for creating small languages embedded inside F#.
We have tested all samples with F# 2.0 and XNA 4.0.
About Giulia Costantini
See more books from this Author
Published August 15, 2011
Computers & Technology.