

All we need to do is run through our list of faces and draw a line between each transformed vertex listed as being part of that face. Now we can start thinking about drawing the model to the screen. To get our wireframe onto the screen, we need to convert all our 3D coordinates into flat 2D coordinates using the perspectiveTransform() function. We then transform each coordinate so that it’s rotated correctly in our scene using the viewTransform() function. With some use of cos and sin calculations, we can derive a set of multipliers for all our coordinates. These parameters are known as the radial distance (rho), the azimuthal angle (theta), the polar angle (phi), and finally, d, the distance from the viewer. We pass this function the parameters that make up the way the whole scene is displayed. The first part of this transformation is to set up the scene variables with a function called initViewTransform(). Our re-creation of the original Elite title screen. To draw the 3D model to the screen, we need to convert these 3D coordinates into 2D screen coordinates. These points are then joined up by faces, which is a list of the vertices that make up the face. There are three coordinates for each vertex – x, y, and z – so that a point can be plotted in 3D space. We’re in luck, as the data for the Cobra Mk III can be found here. The first thing we’ll need is a set of coordinates which make up the lines of our wireframe model. You can find the types of calculations I’ve used in several places on the internet, but I learned these techniques from a book called Advanced Programming Techniques for the BBC Micro by Jim McGregor and Alan Watt. Some of the maths may seem complicated, but it’s all fairly straightforward trigonometry.

We’re using Pygame Zero and some pretty nuts and bolts calculations to create the wireframe ship without a 3D library. If you want to play an emulated version of the BBC game, you can find an online version at .uk.įor this sample, we’re going to remake the title screen from the BBC B version, which features a spinning wireframe Cobra Mk III ship. Elite featured 3D wireframe graphics and enabled players to command a variety of spaceships and travel across thousands of star systems. For those who are unaware, though, Elite was a pioneering space trading sim released in 1984 by Acornsoft for BBC B and Electron computers. Players took the role of Commander Jameson and started their adventure in a Cobra Mk III.įor many gamers, Elite (and more recently Elite Dangerous) needs little introduction.
