Elite: "The game that couldn't be written"

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's go back to 1984 in the UK in a few short years home computers have gone from practically non-existent to commonplace almost every child in the country has access to a BBC micro computer at school and the ZX spectrum is topping out Christmas wish lists and despite a crashing the video games Market in the USA games are still flying off the shelves here while there's plenty Choice almost every game available to play at home is some variation of the same thing a 10-minute tops arcade style run at a high score longer form strategy and adventure games do exist largely in the form of text Adventures sometimes with accompanying imagery but not with realtime graphics and certainly not in an open world home computers are more popular than consoles in the UK and let's be honest many of the games on these look well take a look for yourself as for 3D Graphics the choices are even more limited every 3D game on the market is either not actually 3D or is not really a game there are a few flight simulators technically impressive for the day but not exactly immersive subl loic's FS1 flight simulator was arguably the First full 3D game created for the home and it looks like this doesn't this gameplay look fun and the frame rate let's just say it has a frame rate Microsoft Flight Simulator 2 has just released but that requires a $5,000 ibmc to play and no one had one of those outside the office arcade cabinets with more specialized Hardware have taken a step into 3D gaming but I can't find a single example of a true 3D game that isn't a flight simulator prior to 1984 battle zones a competitor but movement and object tracking is restricted to two axes a sort of pseudo 3D game and there are a few other on Rails Shooters Limited in scope and always a slave to the high score the bestselling games at the moment are Pac-Man and Space Invaders you probably remember them looking like this problem is those are the arcade versions if you wanted to play them at home on your Atari 2600 this is what they looked like then Elite was released Elite looked like [Music] this Elite changed gaming in Europe overnight it was an open Universe game no high score no restrictions and full true 3D Graphics a procedurally generated Universe a back story in the form of a Nolla Pirates trading asteroid mining an economy and you could play it at home or at school non-european viewers are unlikely to be familiar with the impact Elite had on gaming and Computing as a whole but here in the UK the 20th of September 1984 was the day computer games became a serious [Music] business this is a story I've been obsessed with since I was a teenager it shaped my life personally and there is a direct path between some of the Innovations made by Elites creators and my professional work today this may come as a surprise to some subscribers but I previously worked in the computer games industry not for very long but my first role as a data scientist after quitting engineering was for a UK based games developer in Dundee I even learned unity and coded up a couple of games myself during this period of course I wouldn't use Unity now after recent events the story of Elite's creation is already told on YouTube however I'm not going to focus too much on the history and the individuals instead I'd like to dive into some of the technical details on how the game was even possible and how some of its major challenges were tackled and I prom promise absolutely zero programming knowledge is necessary to understand what I'll be discussing before we get into the full story I'd like to make a quick political disclaimer if you will Elite is very much a British success story it was a rare case of government industry the academic sector and even state-funded media inadvertently working together to produce something amazing the government at the time however was one of the most contentious in UK history the Thatcher government now I try to adopt a policy on this channel of not getting bogged down in politics but also not skirting around them I don't see it as my role to tell viewers what to think politically so let's just say that sometimes bad governments do good things and sometimes good governments do bad things and it's up to you to decide if that applies here let's take a look at the machine Elite was originally coded on and created for this is the BBC micro this video was a good excuse for me to finally get one of course I got a hold of a broken one to bring back to life when dealing with technology that's older than me I always feel to be worthy I have to fix it first I'll overlay some footage of the restoration here in fact mine came with a cassette recorder with a copy of elite ready to go yes I could have just bought an SD card reader but loading a game from a cassette tape was one of those little things I just had to experience in the late 1970s the UK was staring a disaster in the face over in the US the development of cheap microcontrollers had in the space of a couple of years transformed computer computers from cabinet siiz mainframes that cost tens or even hundreds of thousands of dollars to the likes of the Apple 2 the trs8 and the Commodore pet government and businesses in the US and in Japan and even other Western European countries were quickly embracing the change in a small but dedicated portion of their population were becoming proficient in Computing be at home or in the workplace the UK was emerging from a financial crisis when isn't the UK in a financial crisis traditional manufacturing Industries such as mining steel workking and ship building were either dying or dead no one was thinking about computers likewise the government was preoccupied with all of the above an unlikely Contender resolved to address the issue before it was too late the UK's state funded but not State controlled broadcast the BBC the BBC acted fast and they acted decisively the computer literacy project was to be a collection of TV and radio series intended to teach the nation that computers weren't scary obscure or just for nerds attender was put out for a computer model to be adopted by the BBC for these broadcasts and crucially it was to be adopted by schools too with the government subsidizing half of the cost of every computer purchased by a school by this point Clive Sinclair had released the zx81 this was an absolute barebones computer but it was cheap incredibly cheap and for that reason I'll never knock it as many others do these days for less than £200 in 2023 money a family could have a fully functioning 8bit computer at home Sinclair put it forward to the BBC for consideration but was rejected it didn't come close to their specifications in what seems like a rare case of due consideration the BBC required a surprisingly capable system with network capability full color graphics and expansion capability acon computers rushed out a prototype for the BBC in four days this resistor here that simulates an engineer's finger on the board the system wouldn't boot without it and no one really knows what purpose it serves to this day despite its Whirlwind conception aon's prototype was the only system that met the BBC specifications it exceeded some with blisteringly fast RAM for the day and a frankly wonderful potential for expansion the BBC micro model B used a moss 6502 CPU clocked at 2 GHz and it pushed it to its limits given the micro's io capability 32 Koby of ram was available along with an operating system that included a modified version of basic known as BBC basic basic was the programming language of the time in fact the micro boots straight into it uniquely assembly code can be inserted in line with basic commands if you're not familiar with assembly don't worry we'll get there soon Network capability was provided via aon's proprietary econet and the capability for a second co-processor was even provided via the tube interface this can even be used today to connect a Raspberry Pi something I will definitely be doing in the future the BBC micro isn't a looker but that large form factor makes it easy to add expansion boards just four screws to undo it and you're in there are plenty of empty ROM sockets for you to add more functionality and I have to mention the keyboard the micro has a really nice mechanical keyboard apparently that contributed significantly to the cost right okay this is me back again 3 weeks after saying that totally unscripted here by the way and I've just spent an hour tapping away on that keyboard um yeah it's very well built in that like a school child isn't going to destroy it it's a very slow keyboard though I don't know if I'd say it's a fantastic keyboard now right okay back to three weeks ago Alex and indeed the micro was not cheap about £1,600 in 2023 money though I will note that was about the same cost as a Commodore 64 which was probably the closest equivalent machine on the US market yet and this seems unbelievable today the government still agreed to subsidize this cost to schools by the end of the computer literacy project 85% of UK primary and almost every secondary school had at least one BBC micro almost every child in the country had free access to a good computer and free tuition via the BBC a project that seems almost too good to be true today and probably the reason why anyone born between about 1970 and 2000 in the UK seems to be perfectly proficient with a computer now let's look at the game itself Elite is an open world space exploration game we begin do at La station with 100 credits three missiles a pulse laser and a cobra Mark III spacecraft leaving the station we make a hyperspace jump to another system of our choice every system has a summary screen denoting the government type and syst system wealth and major industry until we can afford to better equip our ship novice players must now make a Mad Dash to the system planet where they'll find its respective space station time to dock this is notoriously difficult though I'm not really sure why here's how to do it just ignore the manual and go in at half speed every system has different commodity prices and we're able to make a profit by Trading ing between appropriate systems this is a surprisingly involved process so keep a notebook handy and probably don't trade anything illegal for now unless you want the galactic police on your case of course it's rarely this simple if you've warped into an anarchic system get ready to be constantly harassed by Pirates even in the safest systems it's rare to make a clean run to the home planet later in the game when we're better equipped we can make a profit by bounty hunting these Pirates but for now better get saving for that beam laser oh and there are thargoids too those are aliens with tough flying sourcers that spawn drones and they're equipped with electronic counter measures so they'll render your missiles useless and that's the essence of it really Elite was a complete step change in computer games in 1984 short of the flight simulators I mentioned earlier which as I said I would only Loosely Define as games there was nothing else with truth 3D Graphics available on an arcade machine let alone a home computer the universe of eight galaxies each consisting of 256 Stars along with their descriptions market prices and system characteristics was procedurally generated another first the closest the game has to a high score is the player ranking starting at harmless and eventually reaching Elite for only the most dedicated players you can be Trader a bounty hunter a pirate an asteroid Miner or some combination of all of these truly an open world game with infinite choice and potential Sophie Wilson called it the program that couldn't have been written and Steve Ferber said it had the BBC design team staggered who are Sophie Wilson and Steve Ferber oh they're just the pair that built the BBC micro prototype in 4 days in what's now regarded as is one of the greatest programming Feats of all time Elite was created over the course of two years by Ian Bell and David braan both met while studying at Cambridge though it seem almost unfathomable for such a complex game to be created by just two individuals this was actually unusual in UK development at the time almost every game published in the UK prior to Elite had been coded by Soul developers the UK games industry consisted almost exclusively of bedroom drom coders sending in cassettes to various small Publishers hopefully in exchange for a few hundred and some bragging rights when B approached acon soft the software wing of acon computers it was clear they' created something that had never been seen before Aon soft therefore not only agreed to publish but also decided to Stage the first major and highly publicized release of a game in the UK they ran TV adverts and hired out a theme park for the launch this seems trivial now but this was completely unheard of in 1984 as I showed in the intro Elite completely eclipsed any competition almost immediately it became a national sensation eventually selling over 100,000 copies for the BBC micro and 600,000 across all platforms bran and Bell became celebrities who effectively jumpstarted the UK gaming industry to build a universe in a 1980s computer we must first do a deep dive into the hardware available at the time trust me to understand the code it's necessary to understand the hardware first there are far more comprehensive sources available in the description so I'll keep it as brief as possible and by the end of this chapter you'll understand how a CPU works the BBC micro was similar in architecture to rival Machines of the time using the same processor as the Apple 2 Commodore 64 and the Atari 2600 that processor was the Moss 6502 a chip ubiquitous with the 1980s and the driving force between the home Computing Revolution the 6502 is able to receive and transmit eight bits of data in a single cycle data in this case may refer to actual data moving to or from the CPU or it may refer to commands each command the CPU is capable of carrying out is encodable as an 8bit string we'll see some examples later this 8 bit or one bite datab bus is why we refer to the 6502 as an 8bit processor in addition to the datab bus is a 16bit address bus this is used to address individual locations or addresses in memory let's simplify the layout and see how this is achieved to write a bite of data to memory the CPU sends the chosen 16bit address to the memory on the address bus the bite of data to be stored is then sent down the data bus and the memory ic's are configured to store that bite at the given location likewise sending an address down the bus results in the bite stored at that address being returned to the CPU now let's have a look at the memory in the BBC micro specifically if we imagine zooming in on it we can imagine every addressable bite being stored in sequence each address holds a single bite as addresses are 16 bits in length the maximum possible addresses is 2 to the^ of 16 which equals 65,536 bytes in total or 64 kiloby and indeed the micro had 64 KOB of memory available however 32 kilobytes of this is read only it contained the operating system itself and is therefore not writable the other 32 kiloby is the RAM and is the sum total space available to hold programs and any stored variables however not all of this is usable as such when I began studying the architecture one of the first questions I asked was but where is the video memory which sort of shows how clueless I was every time we send a frame to display on the screen that frame must be stored somewhere I hadn't anticipated that back in the 1980s this somewhere or frame buffer as we call it also lived in the main memory every location on the screen maps to a location in memory change the value of a bite in the frame buffer and the corresponding pixel or set of pixels on the screen will also change we'll go into more detail later but in the case of elite 7,936 bytes were reserved as the frame buffer used solely for storing the values for physical pixels to be drawn on screen this area of memory is read by a collection of chips referred to as the vidpro or video processor responsible for translating the bite value at each memory location to a physical pixel on screen we're still not done the first 3584 bytes of memory are allocated to workspaces which are Loosely speaking areas that may be used to store variables but not code let's take a closer look memory is actually split into 256 byte Pages the first is the zero page and may be used to store variables that require Fast Access by the CPU as zero page addresses can be defined in just eight bits the CPU is able to access them more quickly and they were used extensively in Elite source code next is the stack this is another temporary storage area for variables the stack operates on a first in first out basis pushing a bite to the stack means that bite will be the first retrieved when subsequently calling from the stack most of the remaining space here is Al at to other workspaces that can be used to store temporary variables however one kilobyte is available as the language workpace this isn't usable for code storage but it could be used to store text expressions and this was most certainly used by Bell and braan these expressions are persistent and defined in the source code so they very much form part of it the remaining 21,24 bytes of memory are available to store our program so this gives a total of 2,248 bytes of program memory and 1,24 bytes in the language workspace by my Reckoning that's a total of 22,27 2 bytes available reading around some other sources the actual memory available was actually 2,952 perhaps I missed a page somewhere either way that's less than than 22 kilobytes to fit an entire open world 3D universe and Elite fit within that 22 kiloby it's not very much to add some context if I go to PC part picker and look at a 1,600 PC which is about the cost of a BBC micro in today's money we come up with something with an AMD ryzen 7 CPU obviously Elite would fit into the main memory millions of times over but modern systems don't just use standard Ram CPUs incorporate relatively tiny amounts of extremely highed memory on the chip itself this is called the cache would 22 kiloby fit on a modern CPU cache the question is barely worth asking we have to zoom in to the individual compute cores the ryzen 7 has eight of them each has its own dedicated level two cache it's still not even worth asking asking the question at that point we have to go inside each core to the level one cache the fastest memory available in the system there's 64 kiloby per core so Elite would fit inside each core of a modern processor twice in fact it had also sit inside the level one cache of every compute module of the GPU and it had fit inside the controller chip for the SSD as well it's genuinely difficult to find a place Elite wouldn't fit so we get the point braan and Bell were severely constrained when it came to memory and that's probably the most disgusted limitation they were able to overcome but I'd argue they were similarly if not more limited when it came to compute just recall the frame rate on those early flight simulators let's take a look at how the 6502 worked we see our data and address busers I'm going to include the memory here obviously it wasn't inside the chip but showing it connected to the buses makes this section much easier to understand CPUs contain registers these are Simply Storage cells able to hold a single piece of data the 6502 has 11 16bit register the program counter this holds the address of the current bite in memory that's currently being read this may be thought of is the current position within the program being executed next to the index registers there are two of them referred to X and Y they're both eight bits in size in addition to holding a single bite value they can be incremented or decremented by one throughout the use of appropriate commands this makes these registers useful as Loop counters the accumulator is another 8bit register any AR arithmetic operations must be carried out using the value stored in the accumulator for this reason the accumulators connected directly to the arithmetic logic unit this is a collection of logic gates able to perform basic arithmetic operations the value from the accumulator is fed in along with a second value from the data bus and the ALU performs the required operation in the case of the 6502 the ALU is able to add and subtract two 8bit numbers along with a few bitwise operations specifically or and bit shifts and bit rotations that's it the 6502 is only able to perform very simple arithmetic and logical operations and remember we can only operate on eight bits it can only count up to 255 the result from these operations is stored back in the accumulator the status register is an 8bit register where each bit signifies a result from the last executed operation for example if an addition is performed and the resulting value is above 255 I.E not storable in the accumulator the eight least significant bits will still be stored in the accumulator and the carry flag will be set to high in addition to the carry flag the other bits flag zero value interrupt disable decimal mode break overflow and negative value we won't worry too much about these for now but know that they can be used to trigger branches in a program remember that second page of memory that formed the stack it's represented here the final register is the stack pointer which stores the address of the highest populated location in the stack we won't be directly referring to it again I've just included it to be complete and that's all we have to work with by today's standards incredibly simple but still a fully functioning CPU with less than 4,000 transistors there are three main families of commands that the 6502 is able to execute commands or instructions as they referred to more correctly are represented by threel operation codes physically each is just a bite sent down the address bus the first family is instructions that move data to or from the registers and memory let's see what happens when we run the store accumulator instruction this simply stores the value currently in the accumulator to memory first the desired address to store the value at is sent to memory via the address bus then the 8bit value in the accumulator is sent to memory via the data bus I'll leave it visible for now so we can imagine a bite of memory at a given address we could then load this value into the X register using the ldx instruction or load X the address is sent via the address bus and the value is copied to the X register with similar commands we can send data between all available registers and memory the next family are the arithmetic commands add with carry adds a value from memory to the current accumulator value here the memory address is sent via the address bus and the bite in memory is sent to the ALU the value currently in the accumulator is also sent to the ALU where the two are added the result is stored in the accumulator remember the carry flag if the resulting value is greater than 255 the carry flag is set to one but for now let's assume there's no carry so the flag remains at zero and that leads us to the final family of instructions branches and jumps the branch on carry clear causes a jump to a different location of our program if the carry flag is zero here's how it works the carry flag is checked and if it's zero the address to which we want to jump is passed into the program counter remember addresses are 16 bits so two separate bites must be passed down the data bus to achieve this this means the next address will be that of the jump location this is how we Implement if statements and finally a jump itself the jsr or jump to sub routine instruction is a direct instruction to jump somewhere else in the program when we execute it the current program address is pushed to the stack this allows us to subsequently return to the current location by pulling from the stack the new program location is then passed into the program counter via the data bus and that's everything we can move 8bit values do simple arithmetic on them and jump to different places in our code that is it let's have a look at my attempt to turn these simple instructions into something on screen The Three Families of operation codes discussed collectively form the 6502 Assembly Language almost all programming today is done with higher level languages where we don't need to worry about physical Hardware so much even in the 1980s most coding was done using the likes of basic C and Fortran however high level languages require considerably higher memory usage and they must be compiled to assembly resulting in less efficient use of the CPU and therefore slower running Elite therefore was programmed in assembly I decided the only way I could possibly do Elite Justice and make an actually informative video was to learn 6502 assembly and well let's just say my 10 years of programming experience were almost useless I set myself the challenge of creating anything in 3D on the micro but using assembly only I'm happy to say I managed to achieve this but it took longer than producing any other part of this video so enough tiptoeing around let's see the final result prepare to be underwhelmed so yeah that took me 5 days it uses lookup tables to plot the positions of the vertices in 3D space the tables are called from a sub routine which draws a single line the approp roate value from each table is retrieved by using the values in the Y register which increments every time a line's drawn it's tiny because I cheated and used an inbuilt line drawing routine from the operating system but that divides the screen into 1,200 by 1,200 points but we can only count to 256 with this 8bit system and I definitely wasn't going to go and get my head around dealing with that so I just made the whole thing 20 50x 250 units in size it flickers like mad too but that's true of elite as well so I don't feel too bad about that part okay now let's go and see how to code in 6502 assembly properly Elite was initially released on both tape and dis versions the tape version is the 22 kilobytes one as it had to fit entirely with within memory loading from a tape during gameplay is not really possible the dis version has a few more features like additional ships and you can only do asteroid mining in that version as these could be loaded in from the dis while the player was docked the code itself for the two versions is essentially the same the dis version just contains some more stored variables and in case you wondering a tape version was absolutely necessary if Aon soft wanted to actually sell any copies to the home Market back in 1984 a disc drive in the UK cost as much as the BBC micro itself although the memory constraints not as tight when loading from disc The Limited compute capability of the 6502 was still a huge challenge just recall the one frame per second flight simulator I showed earlier for every frame in Flight every vertex on screen needs calculating every line between them must be calculated and individual pixels inserted into screen memory the 6502 in the BBC micro operated at 2 mahz or 2 million cycles per second this sounds like a lot at first but as we go through some examples we'll get a taste of how many individual operations need to be carried out to draw a single frame bear in mind every assembly instruction requires two CPU Cycles at Absolute minimum the sub routine for just drawing a single Pixel requires 20 operations and that's after all the necessary calculations have been performed to decide where to even draw that pixel so for a full screen it's easy to see how Cycles are eaten up quickly the code for elite is essentially one large script of 6502 instructions trying to understand any of this is daunting at first but it becomes much more manageable when we understand that it consists of a main gameplay Loop depending on the current state of play this Loop calls upon individual sub routine as and when necessary each sub routine performs a simple task such as drawing a line or updating the player's kill count so the code is very much modular and understanding individual modules allows us to build up to something bigger the full source code for elite is available on GitHub when I set out to make this video I was going to go through the main flow of the code and broadly explain how the main features are implemented however it turns out someone's already done all the work for me Mark moxen annotated every line of the original code and has a frankly incredible website which breaks down every element of it it also includes many Deep dive articles on some of the technical details of the code this left me with a problem however I wasn't going to just regurgitate Mark's Herculean work here and try and take credit so instead this section of the video will walk through some Choice examples and show how the Code maps back to the 65 502 itself and I'll show some of my own visuals to make everything easier to understand remember how just under a quarter of the available memory was dedicated to storing pixel values to draw on the screen let's talk more about that drawing graphics on the BBC micro is typically done at a resolution of 320x 256 and eight colors are available so every pixel would require three bits of memory to store its color value that's because there are eight possible three bit numbers one for each color so to store a frame at this resolution we require 320 by 256 by 3 bits that comes to 30 kiloby just for the frame buffer essentially leaving no room for our program oh dear okay so we have two options to reduce the frame buffer the first is to reduce the number of bits per pixel let's just represent each pixel with a single bit one or zero that reduces our frame buffer to 10 kiloby not bad but with only a binary option for each pixel that means we're limited to just black and white the second option is to reduce the number of pixels to plot in the first place by reducing our resolution to 160 by 256 and using say four colors only we'd also reduce the frame buffer to about 10 kiloby so it looks like we'd have to choose between either high resolution or color we can't have both or can we look closer the combat viewing Elite has high resolution but no color the dashboard is in color but at low resolution this was Elite's first unique Innovation before any many pixels are plotted on an individual frame a timer is started we know the number of pixels to plot in high resolution and we know the rate at which these pixels are plotted to the screen it's 1 mahz for the BBC micro so a timer is set to trigger after all the highres pixels have been plotted the top half of the screen is drawn in the aforementioned high resolution the timer then triggers an interrupt which calls a sub routine to switch to the lower resolution mode this is achieved by switching registers in the video processing chip to convert it to low resolution for drawing the dashboard and that's achievable through some assembly commands as far as I can tell this was the first game ever to use this split screen configuration and it was definitely the first to do so on a BBC micro the end result is 7,936 bytes reserved for the frame buffer leaving just enough room for the actual program and a game that looked both sharp yet colorful something not seen on a home computer before now let's take a look at a more obvious feature the 3D Graphics themselves one reason they looked so good was that Elite was the first game playable at home to feature hidden line removal unlike earlier wireframe Graphics which themselves were barely existent in games at the time if an edge on an object is obscured it's not shown this was a tricky problem to solve at the time it still caused John karmac a headache nearly 10 years later when optimizing Doom in the case of elite the solution implemented was quite simple in concept but required some clever design to be executed and acceptable speed we start by looking at how objects are stored the final few pages of memory are used to store the ship's blueprints these are a series of lookup tables the first table is a number of basic attributes such as Max Speed and Laser power the second table for each ship is the vertices this defines the position of each vertex relative to the center of the ship I've seen it written before that blueprints contained only half a ship with the other half generated on the Fly however this is not true we see the full vertex count for every ship when we look at the source code next is a table of edges this is a list of plottable edges for the ship each defined by its starting and ending vertices and adjoining faces The Edge and vertex tables contain all the necessary data to plot a wireframe ship however in order to perform hidden line removal the positions of the faces need to somehow be characterized so the final table for each ship is a list of faces but how are these faces defined each one is characterized by what's called its normal Vector let me explain what this looks like imagine drawing a line from the ship's Center to the facing question now the aim here is to draw this line so that it intersects the face at a 90° angle looking at a thargoid ship as an example this is easy enough to do for this face but how about this one we can imagine extending the face until a solution is found these vectors are defined by three values the X Y and Zed distance from the origin to the point of intersection on this extended face Bell and braan pre-computed these XY Z distances and saved them in the face lookup table for every object in the game now let's put the players ship in our scene this face here should be visible to the player we know the position of the enemy ship relative to the player so let's add the vector in for that too finally the main flight Loop calculates the rotation of every object in the scene this is defined by three more vectors one for each axis let's add those too and with that we have everything we need to remove the hidden lines or I should say hidden faces rather than considering lines individually faces as a whole are checked first we need to know the line of sight to the face we can do that by summing the object's position vector and the face normal Vector visually vector addition works like this so we now have a line of sight Vector to our face every object in Elite was designed to be exclusively convex so if a Face's normal Vector is pointing away from us we know that face must be obscured or more formally the angle between the normal vector and line of sight Vector must be greater than 90° for a face to be hidden so we can perform this simple calculation this is known as the dot product between the two vectors dot products are used all the time in 3D computation because they're very simple to calculate indeed here's the sub routine Bell and braan wrote crucially a negative dot product denotes two vectors that are less than 90° apart and a positive one denotes two that are greater than 90° apart so we calculate this dot product for our faces and only plot edges associated with faces where the line of sight to the face normal dot product is less than one now there is one minor step I missed out in reality face normal vectors are relative to the orientation of the ship to be plotted so the player's XY Z coordinates need to be translated to the ship's local coordinate system this is done by modifying our line of sight Vector as shown here but the end results the same faces are only plotted when the dot product is negative see Mark moxon's Deep dive article for more details on this step if you need convincing why this is necessary these three numbers and this simple formula Define Elite's entire universe it's sometimes stated that the universe is randomly generated but it's a little bit more elegant than that it is in fact procedurally generated that means the same universe is created every time Elite wasn't the first game to feature procedural generation but it was the first to apply it on such a scale let's see how those three numbers Define a syst system these numbers are referred to as seeds each is expressed as a 16bit binary value now different bits within each form parameters for the system two entire byes Define the coordinates of the system in the Galaxy these two bits Define the system tech level and these two Define the prosperity level they're used to buy us a pseudo randomly generated number to decide the prices of Commodities at the system the these three Define the system's government type in a similar manner to the economic variables the value stored here increases or decreases the likelihood of encountering pirates at the system and these three Define the distance to the planet all other system attributes are similarly defined with the remaining bits the three numbers on screen Define the first system plotted then that deceptively simple formula is applied we add the three values append the result to our list and discard the first value and that gives us a three seed values for the next galaxy the process is repeated 255 times to give a galaxy of 256 Stars if the result is greater than 16 bits in length we just take the carry value and continue on and the process itself is repeated a further seven times to give a total of eight galaxies and that's all there is to it the final feature I'd like to go through is the radar this has an almost legendary status it was the final few lines of code written before Elite was released braan had to convince Aon soft to add it in last minute but it completely changes the nature of the combat sequences it's quite funny watching videos of novices playing and not even realizing the radar does there they hear the sound of being shot at but don't know where it's coming from and kind of flail around pitching and rolling randomly but once they realize the Radar's there and how it works it completely changes how they handle combat it's simple to use objects within range of the player are shown as sticks with a little flag at the end a stick behind the player represents an object behind them and one in front is an object in front of them likewise a stick extending upwards mean the object is above the player and downwards means it's below them so the radar provides a full representation of the 3D space around the player and can be understood at a glance genius I'll go into full depth for this one we've made it this far so let's go crazy and get my 6502 model on screen the scan sub routine performs this task let's figure out how it draws a single dot representing another ship in the correct position on screen every object within range of the player ship has a ship type variable for the current ship this variable along with the ship data is moved into the zero page workspace for fast access therefore saving clock Cycles we load that object's ID from the workspace and into the accumulator objects such as planets and suns are designed to have their most significant bits set to one in the ID and this sets the minus flag to one so a break if minus command causes us to return from the sub routine and not plot that object for plottable objects the hex representation of the plot color which is green for ships is loaded into the X register the color green is represented by FF in HEX this color variable is then stored in the workspace the ship data in the workspace contains X Y and Z coordinate values each is 2 bytes and represents the ship's position relative to the player we load the most significant bite of the x coordinate into the accumulator and perform a logical or on the respective byes from the Y and Zed coordinates one more logical and is performed on the result using the binary value 1 1 000000 0 0 if the result is zero the two most significant bits of all coordinate values are zero and the ship is in plotting range so branch on not zero a positive result here would return from the sub routine let's assume the ship is within plotting range to convert a ship's World X position to an x coordinate on screen I.E on the scanner we add 123 to the most significant bite of the X position we don't need to go through why that is here but let's just take it at face value assuming X is positive we simply load the ship's High X by into the accumulator and add 123 the resulting value is stored in location X1 in the zero page workspace a similar process is carried out for the y-coordinate saving it in location y1 in the zero page workspace finally an existing sub routine is called to draw a double length dot at the coordinates X1 y1 I definitely won't go into details of how this works but in summary it loads X1 and y1 into the accumulator and X register converts the coordinate values into the correct locations in screen memory and performs an exclusive aura operation on these locations if nothing was plotted there before the exclusive or operation populates the pixel at the correct memory location with the color value we previously stored actually let's take a second to think about that when writing pixel values to the frame buffer Elite source code always uses an exclusive or instead of just writing the value directly let's consider writing a single Pixel and see what would happen if we just wrote the new value directly the bottom row of this truth table is the important one here imagine us building up our frame we may first add in the object for the star but then adding all the lines for the spacecraft would just draw white lines in front of a white star rendering the spacecraft invisible here's the truth table for the exclusive or pixel right now a white onwhite pixel flips to Black so spacecraft are visible in front of white objects they look like this it doesn't even matter what order the objects are written to the frame buffer in or if only part of the object includes the star this will always work at the expense of a single instruction when writing pixel values braan and Bell never needed to worry about objects disappearing in front of stars it was all handled automatically even with me skipping over how y-coordinates are calculated how screen memory locations are determined and how the stick from the object on the scanner is drawn that was still a lot to go through just to get a single dot on screen but that's how the source code was built up in general by taking individual tasks breaking them down into simple problems and figuring out how to implement the Solutions in assembly each solution was translated into a sub routine and meticulously optimized to save memory and compute no single sub routine is particularly complex or difficult to understand but they combine to create an entire universe it's difficult to quantify the effects Elite had on the Computing sector as a whole every British software developer I've spoke to that went to school in the 1980s sites Elite as a reason they got into Computing being able to code the game on the same machine you could play it on probably had something to do with that though I was born tooo late for Elite's release we had a copy on our Aon aredes at home I liked it I was told it was a big deal but I didn't really understand why because I was eight a couple of years later I realized the game was nearly 15 years old which completely blew me away at the time in the Years following Elite success B gradually distanced himself from the gaming industry I've heard he grew to dislike the proliferation of violent video games something I can't really relate to since I grew up with the likes of Doom halflife and Bioshock his personal website is a quirky record of what the worldwide web looked like in the 1990s it also contains the source code for elite that did cause a bit of a legal kafuffle between himself and braan but I understand the two have been back on speaking terms for years now so that's nice braen on the other hand he used the success of elite to found frontier games which remains a major UK developer to this day in fact he only stepped down as CEO in 2022 in 2014 Frontier released a modern-day adaptation of elite elite dangerous backed by what was at the time the largest ever crowdfunding campaign in the UK and it's amazing a onetoone scale map of the Milky Way with 400 billion star systems to explore prior to the that in 2008 he became one of the co-founders of the Raspberry Pi Foundation who went on to completely revolutionize access to cheap compute hardware and spawned a new generation of hobbyists I'm one of them I pre-ordered my first Pi on the day they were announced I was on an oil rig at the time and though I'd been employed for less than a year I was already looking for a way out of that industry I learned how to navigate a Linux system run distributed compute and even how to containerize Applications thanks to the Raspberry Pi Elite was ported to every major platform it could viably run on of course making it accessible to cheaper systems such as the ZX spectrum and acon electron played a huge part in the game's record sales perhaps most astonishing is the NES Port that's right you could play Elite on the NES a machine designed entirely not for 3D vector graphics in fact I've done just that back when I was at University I owned an NES for retro gaming and I had a copy of elite to be honest it was the only game I used to play on the thing an upgraded version was also released for MS DOS known as Elite plus coded entirely by another legendary UK gaming figure Chris soer if you don't know that name just keep an eye out on the outro sequence Elite marked the end of the dominance of the arcade shooter less than one year after its release the NES was debuted in the US and Europe though most games for this platform didn't match Elite's level of complexity even relatively accessible titles such as Super Mario Brothers and Zelda provided a much richer experience than had been previously available in retrospect it really feels like Bell and braan opened the floodgates by demonstrating what was possible with 8bit Hardware though they had pushed that Hardware to its limits and we'd have to wait until the 1990s and the rise of 32-bit systems to see an explosion in 3D rendering technology by then most major games were no longer produced by solitary bedroom coders but by large Studios with large design and advertising budgets to match and by the end of the 1990s another Hardware wall was hit back in 1984 Elite required realtime calculation and plotting of several to dozens of polygons on screen at a given time but by now the polygon count that was demanded by designers was outpacing improvements in CPU speed a new approach was needed wouldn't it be nice to calculate the positions of all these polygons in parallel thus the GPU was born why use one very fast processor when you can use many slow ones at once about 10 years later something very unusual happened typically new technologies start out relatively expensive and are only used experimentally and then by commercial or government organizations before becoming cheap enough to sell to Consumers but the opposite happened with gpus a new field was rapidly growing in the late 2000s data science it was realized that the computations necessary to train neural networks are similar in principle to those used to calculate polygons for 3D rendering data scientists realized that in some cases cheap off-the-shelf gaming gpus outperformed supercomputers I first used a GPU to train up an algorithm in 2015 now it's something I do on a daily basis the algorithm that recommended this video to you was trained on a cluster of gpus the implications of large scale deployment of advanced machine learning algorithms are not yet fully understood and we would have got there without Elite but I think it's fair to say we'd have got there slower but back to Gaming UK gaming specifically Elite was our Breakout game if you will in the four decades that have followed the UK gaming industry has birthed some of the most influential and bestselling games of all time and they continue to do so and not just huge developers either with the rise of accessible gaming engines such as Unity unreal and now gdau it's again possible for small teams and even individuals to design write and publish great games B and braan set out to make a great game but they also fostered an entire [Music] industry [Applause] [Music] he [Music] he
Info
Channel: Alexander the ok
Views: 1,189,974
Rating: undefined out of 5
Keywords:
Id: lC4YLMLar5I
Channel Id: undefined
Length: 62min 3sec (3723 seconds)
Published: Thu Nov 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.