Select your entertainment

> Make your own comic

Strip Editor | GTA online | 3D Pinball | 3D Printer | Carputer | Software | Films | Features

3D pinball

What is it?
A physics enabled 3D pinball simulation with a easy to use editor, so that anyone can make their very own pinball machine.

I've been interested in Microsoft's WPF technologies ever since I saw a very impressive demonstration at Flash on the Beach 2006, although I've not had a good reason to use this new technology of anything else I was currently using.

After I saw Chris Cavanagh's work integrating WPF with a Bullet Physics library I was very impressed! I knew that I wanted to develop something new and existing. Then I had it, a WPF 3D physics enabled pinball simulation!

That is how things started, now let's see where we go from here...

26th August 2007: The learning can start

The book is finally released

You've gotta learn stuff from somewhere, I hope this book will be my learning tomb.

3D programming for Windows
Getting started with WPF 3D has reminded how that it's been a while since I've learned a new language. I think the last language I got started with from scratch was C#, which has about five years ago. Since my main language before that was VB it was a bit of a change.

WPF 3D isn't so much a new language, but it's certainly lots of brand new concepts, classes and methods which seem very unfamilar right now. I think that anyone can learn to program, it's just a question of sticking with it until your sub-consious takes over.

I've tried to learn 3D graphics before, from OpenGL to managed DirectX (which is kinda what WPF 3D is) but with OpenGL it meant learning C++. Which out a real reason to learn C++ it made learning OpenGL difficult.

At work I've had a reason to learn JavaScript, ActionScript, C# and other languages because I needed them to do my job. WPF 3D hasn't quite made it onto my required reading list at work, but I'm hoping that once I get familiar with it I'll see some oppotunities to use it.

Once I've had a good read of this book I'm hoping I'll be in a good position to start writing some code to make this project come to life. Also I'm planning on using this knowledge in my 3D printer project to allow me to feed in 3D models into the software to then feed data to the printer to create the model in real life!

21th July 2007: Pinball building blocks

Pinball parts

Thanks again to Ian Ball Blenders skills

I've zipped up all the XAML for these pinball parts: Pinball XAML - 25KB

Blender is your friend
I took on the challenge of building a 3D pinball simulation as a coding challenge, something that would allow me to learn WPF 3D whilst also allowing me to produce something that would entertainment and educate others.

However what I didn't think about was that creating such an application would resource assets, 3D art assets. Thankfully Blender allows the creation of 3D models that can be exported to XAML for use in WPF 3D projects. Also I'm luckly enough to work with Ian Ball who has used Blender for a good few years. He's been good enough to create the 3D pinball objects you see in the picture to the left.

Now that I've got these 3D pinball components I can construct a simple board in Blender and then put it all together as a WPF 3D application. Then next stage after that will be to apply physics and drop a ball in, if all goes to plan it'll roll down the board bouncing off the objects.

Then finally I can start to progam in some intelligence, so that when the ball hits a bumper it gets throw in another direction with a little force. Also I can put in the code so that the flipper move about and throw the ball back up the pinball table. Then I'll have all the piecs in place so I can start to fine tune all the systems that make up a pinball table :)

19th July 2007: 3D means modeling

Thanks to Ian Ball for his drone model

You'll need the .NET version 3.0 framework installed in order to see the 3D model

From Blender to XAML
After Alexander Strauss very kindly sent me a copy of his modified Blender to XAML, Python export script I was very excited about using it. But here's a tip, you'll need to first install the Python runtime first, otherwise the export script may not work.

As you'll hopefully see to the left, we've got a textured WPF 3D model created in Blender and then exported into XAML. I've added a rotation animation to make it slowly and automatically spin round to show off all the angles. If you've got .NET version 3.0 installed (which comes as standard in Vista) then you'll be able to see the model.

One downside of XAML is that it produces very large files! That's really the downside of having plain text information instead of a binary file, which can be made smaller by not having to be human readable and being compressable.

The ease of being able to model pinball components in Blender, plus being able to texture them in there and then export them as XAML will make the creation of the pinball system much easier! Also it'll allow other people to create their own custom 3D pinball components as XAML and import them into the pinball editing system. It's going to be very extendable! =)

18th July 2007: Better tools for the job

Blender Blender
When I first started reading up on WPF 3D I figured I'd create the 3D objects by writing code. I generally try and write systems that create everything in the code because it makes things easier to change, extend and tweak. But have you tried creating a 3D object in code?

I'm not even talking about writing XAML by hand (which can be tricky) I mean writing C# to create a 3D object, it's not easy!

Thankfully I've moved towards using Blender for creating 3D objects. It's an open source 3D modeling and rendering application which has been growing stronger and more powerful with each release. A friend of mine from work has used it to create a series of animations for the police.

By creating individual objects in Blender, they can then be exported directly to XAML using an export script written by Daniel Lehenbauer

Unfortunately I've had a really hard time finding the script for download, as a lot of WPF resources have disappeared. Thankfully Alexander Strauss has come to the rescue by building upon the work Daniel Lehenbauer started with his XAML export script. Below is a copy of the script which is designed to work with the 4.43 version of Blender. Thank you Dan and Alex for both your hard work!

Download Blender XAML export script (Place in your Blender scripts directory)

Sawdust The Twelve Days of WPF 3D
As a slowly learn more about WPF 3D and the new terminology and techniques slowly sink into my sub-conscious I'm gradually feeling more confident and comfortable.

Today I found a very well written series of articles on WPF written by Eric Sink. He's talks about various interesting aspects of WPF 3D he's come across as he's worked on his Sawdust application. As a talented writer he easily conveys the hard learnt knowledge he's obtained, which makes life easier for the rest of us :)

One final website I'd like to mention is which features some great little WPF 3D application that are perfect for picking apart to see how they work. I personally find it quite difficult to learn new skills by reading a dry text book, I find it much easier to pick apart a system for myself to understand how it works.

12th July 2007: A fresh perspective

C# code Compiling code
After a good nights sleep and a trip to IKEA to return a stool (I thought they were all the same size!) I've come back to my 3D WPF pinball project with a fresh mind.

I've now managed to get Chris Cavanagh’s 3D physics enabled source code to compile on my computer, yay :) Picking through the code I'm feeling quite overwhelmed by the quantity of new approaches and technologies being used. Basically it's all new!

I'm thinking now it may be easier to approach this project in a different way. Instead of attempting to jump straight to a 3D physics enabled pinball simulation, it may be easier to just start playing around with 3D in WPF first. Perhaps create a 3D graphing application.

Once I'm competent in using the 3D portion of the technology, then I can move to physics enabling it.

Visual Studio 2008 Visual Studio 2008: CTP
In order to make WPF as easy as possible to learn, I'm thinking of installing the community technology preview edition of Visual C# Express Edition. The next version of the Visual Studio family is designed around .NET 3 so it should be a great environment to learn the technology in.

I only really switched onto Microsoft free 'Express' edition of Visual Studio after attending the Designertopia event in early 2007. When I was there they showed many examples of websites and applications written using the Express tools.

It's makes sense, because otherwise I'd just get a dodgy copy of Visual Studio in order to learn Microsoft technologies - which I go on to use at work anyway. So kudos for making it non-illegal to help maintain the Microsoft monopoly :)

11th July 2007: Getting started

Although I've been doing 'work' on this project for a few days now, this is my first public post about it all. I thought that I'd put everything I've done so far up here to gather other peoples thoughts and to help focus my efforts.

WPF Unleashed Windows Presentation Foundation unleashed
I bought a copy of this book through work to help me learn about the new WPF technologies for work projects. Unfortunately things have been so busy at work in recent months I've had no chance to read the book or play about with these new technologies.
As I'm currently on holiday I'm using it as a chance to have a read of this book, specifically the chapter on 3D.

The problem I'm having is that although the book is a great book, it's left me a little unclear how to get going and actually start progamming something.

I've got C# Express Edition installed along with the .net version 3.0 extensions that enable code editing support. Unfortunately the express editions of Visual Studio don't allow the 'cider' WPF form editor to work, so everything needs to be done through code.

It seems that although WPF has been officially released, with a mature set of tools, development using the technology is troublesome. Also as it's early days, there isn't much a community or set of technical resourses online to help the beginner. In fact most of the examples I can find are early adopters playing around with the technology before the final release of the software was created. As such much of their examples no longer work!

3D pinball physics Other pinball developments
It seems that I'm not the only one who has thought to combine the Bullet Physics library with a pinball simulation. Although from looking at the wiki page there doesn't appear to be much information on the work this person has done. Perhaps they have given up? Or there have further information about the project else where on the internet. Brandon Marvenko if you read this, please get in touch :)

The good news about reading of this project and seeing the screenshot is that it shows how very possible it is to achieve the end result I want.

One of my main aims, alongside creating a physics enabled pinball simulation, is to make it as easy as possible for everyone to create their own pinball machine. By this I mean creating a background for the table, placing the lights and various pinball bumpers and bits, plus allowing a person to script the intelligence of the table through a very simple scripting language.

I've always believed that programmers, like myself, such bridge the gap between the power of machines and the potential of people. YouTube is a great example of this, as it allows people to focus on creating a video, without needing to know about video encoders, hosting or any of the other obstacles that would have traditionally gotten in the way.

Pinball construction kit Pinball construction kit
A good example of what I'll be creating is Bill Budge's Pinball Construction Set, from which many pinball tables were creating, many of which I played as a kid. Although in those days, without the internet, I had to wait for my Dad to bring home a 5.25" floppy disk with a collection of new pinball tables on, thanks Dad! :)

I remember one table created through this software that basically presented you with a blank screen! It was only when you hit the various bumpers and other elements that they lit up, letting you work out the layout of the table. To be honest, this got on my nerves, but I salute the spirit of experimentation!

It made me think, what if I created a similar dark table with my software, but attached a light to the pinball. This would light up parts of the table as the ball when round it! The system I'm creating will be as extendable as possible, so that a person’s imagination can run wild!
From this simple pinball creation systems many people let their imagination run wild, they could focus on playing about and many tables. This is the same drive to experiment and play that made Garrys mod such a success. People don't allows want rules and goals, sometimes they just want to play about and explore, like when we were kids.