 Rwy'n cael ei ddweud. Rwy'n cael ei ddweud o Bresgwyr, y 1980s 4GL a'r ysgrifennu'r ysgrifennu'r ysgrifennu'r ysgrifennu'r ysgrifennu'r ysgrifennu'r ysgrifennu. Rwy'n cael ei ddweud eich cyfnodd. Rwy'n cael ei ddweud eich cyfnodd. Rwy'n credu ymgyrch yn cael ei ddweud eich cyfnodd, y pwysig o'r gwaith gwaith ysgrifennu. Rwy'n cael ei ddweud eich cyfnodd wedi bod yn cael ei ddweud eich cyfnodd. It has lots of line numbers, much like basic and indeed go-to's and go-subs much like basic that they do exactly what you expect. exactly what you expect, and you also see the built-in database munging where column feels from a column on magically glued into global variables. There's no other cluster variables, everything's a global, and some hack put in to handle when IO fails, Rwy'n gweithio pan yn lluniaeth ar gael pobl. Rydyn ni'n gweithio ar gyfer gyrstafell maen nhw. Gweithio'r cyd-gweithio yn cael lyff mwy o'r cystadig. Mae'r cystradau o'r cyd-gweithio yn mynd i'r glwydd, a ysrif yn hynny, lle mae'r cyd-gweithio. in real life. This gets compiled to a byte code and then run by some ancient C code which does indeed still compile. Now one fun thing about the types is that we have dual vars. I don't know if this is the first existence of them. I have a kind of example which might be clearish there. So you can declare a column as a enumerative type and as a numeric context, I know it's to the number, in a string context it will magically become a string being the string representation of the enumeration which is either very nice or very alien and it does get used in practice. Now this code, we want to run it and parse it so we want to build a parser. So we have regates grammars. This is Simon Cousin's module for writing a parser. Let's see build a parser from recursive regular expressions. There's no need to write a separate lexor like you would if you're using lex and bison to write a parser. Dead simple. Not massively fast but as long as your code is not too big you're okay. Of course it's quite easy but if you don't know what the code seems to be supposed to do, you can go through it step by step and build up your parser to match what you have. So we do this and back to our example. So here I am looking at line 50, the code which we can explode out into a nice little pars tree like that. Take a closer look at that. Nice and simple for doing an assignment and then we have our grammar for doing this. So it's all regates all the way down. You start a statement set and operations, assignments, blah blah blah. And you end up building a parse tree which turns into a pearl data structure. So hash of hashes eventually and there you are. You get data. Now that code, that was the simplest line in the code. We have a worse one. Now hit a line like that which I've marked with the lightning strike there and it's horrible. How does it even work? You have a pearl style EQ there which just means equality operator, not assignment. Some random calculations, a line continuation, another arithmetic. And lots of questions from that. So you first start worrying about whether you can make regapse grammars handle the evaluation order correctly. So with the multiplication there, does that mean you're adding 3 to TPS num? Or does it mean add 1, then multiply the whole lot by 3? And there's not much you can do there apart from finding the old run time, run it and see what happens. Now turns out in practice everything's done in order. So 4GL doesn't really mean 4GL. Everything happens in exactly the order here. What it really is turns out a single register assembler for a single register virtual machine. So here you have on means whack number into accumulator, compare with accumulator, set accumulator again, add 1 to accumulator. All very neat. And regapse grammars lets you do that quite nicely. So you end up with a nice linear parse tree. And with that you can build your run time. You first pre-process all the lines. You parse the lines one by one. Regapse grammars doesn't give, it's a regapse so it matches or doesn't match. So easier to do it line by line and see where it fails because you get a good output. And then you flatten the resulting parse hash from regapse grammars. You make a big array and you execute it. In practice that looks like this. So you have your array of lines. You have the regapse which is dollars line parser. And there's this because it's pearl. There's a magic sigil. If it's dollars forward slash is a hash then you have data. A data basically looks like a deep pearl hash of hash of hashes. And there you are. In summary laziness has remained a virtue since the mid-80s. Next. So before I go into a game I'm going to show a demo using pearl as it turns out you can do this. So demos need harder to run on. And when I was fiddling around with these things, those were two nice bits of hardware you could write demos on. There's an acon kit, a Commodore kit. But of course all that's been and gone now. We now have openGL. That is the openGL rendering pipeline. You pop your objects in at the top and app falls at the bottom is your bitmap to display. And pearl lets you do that. It has bindings for SDL.PM. It does that openGL but they recommend you use openGL.PM which gives you most of the null version of openGL. I think we're on 1.6 now. But there's enough fun stuff in 1.2 to do some stuff. So I'll show you how that works. So making an object is actually pretty set forward. Top to top there is your use openGL. And it's neatly packaged in there. They're easy to play with. Now what we're doing here is we're defining a polygon with four corners. So a square that fills the entire viewport. We give each corner its own RGB value. And we make one of the corners make the blue value increase continually. So I can show you what it looks like. See it gradually changes colour. Now to make all that work you have to define shaders. Now which are the parts of the pipeline in openGL which you can define and add your own code to. Nowadays you can give it code in a C-like language and it will run it in a GPU and should go nice and fast. So first we have a vertex shader. This takes all the corners of your shape. So in our case four points of defining a square. And you can do stuff to them. This is a minimal example. It just passes the data straight through. And the more common one is the fragment shader which is a program which runs for every pixel in your output. And here we just take the colour coming in from the previous stage and the site of the output stage. That's simple. It doesn't do anything. And so you end up with flickering with our little square. Now you can do more interesting one. So you can combine Perl and openGL shaders quite nicely as you have your string processing capabilities up there. So I define a array containing a load of random points at the top whackable into a Perl string and just magically whack it into the shader source code. This is in the semi-C-like language. There's a uniform. I think uniform means constant roughly. A bit vague on this. And vector with three points. And then we have a program here which runs for every pixel. It goes through this list of points. Works out how far the pixels away from one of these points. We can commonly use the colour as we defined the colour to vary across our frame. It's a bit of a hack. And if a pixel is close to one of these points, we make it white. And as the colour changes, the points, the whole view point moves across. And so you magically get a star field. And if you look closely, there's stars moving across there. It's done in Perl. It's done in Perl but running in GPU. Worked better in a bit in a dark room. There's your classic demo effect from the 80s. Thanks to Perl. OK, that's the demo that's gone. Let's write some games. OK. So I saw some wearing a Pascal t-shirt. I'm glad we have more fans here. So Pascal was quite nice. I quite like it. Some people don't. So Pascal had an audit orientation. And the Windows version came with a very nice GUI library. I think it's rather was the foundation classes which weren't very nice either. It compiled us lovely. It does all your built-in range checking and all that stuff. It had the magic IDE. It compiles instantly on your 386. System library wasn't so good. But back from the 80s, 90s, I have a couple of games I wrote in it. And thought it would be nice to see if I could play them again. Excuse me. Now, Pascal nowadays. So we now have... To Pascal, I don't know if it's still being maintained by whoever who has it these days. There is free Pascal now. It's quite a nice compiler. It has loads of random options for rechecking a code. So making a buffer overrun is really hard. It's pretty rust and all that. Now, my code wasn't using a graphics library. And front page looks like that. So coffer at Borland, coffer at some guy. Who knows if it's good nowadays. So the solution is to replace it and stuff it out. So, not being great with Pascal, I've replaced it with whacking data to stun it out. So you have a little function to replace all your drawblongs and draw squares and draw circles and just whack it out, it's in to stud out. And you have a polar process on the other end to pick up the data. And you run it. It looks like that. You have a code. And it works. What did? Now, who like a game? Let's break my scheme for a minute. Okay, in theory. Who like a game? Anyone? Free player? Anything that works? You have to work out which colour you are. And hopefully, does it move? Is that happy? Do the buttons work? Ah, okay. I'll just try and plug and re-plug that maybe. See if that works. Run that again. Is that now happy? Yeah, that sucks. Okay, tell you what. Can I plug in three? Do you have maybe? No. Sorry, guys. Well, that worked last time I tried it. Thank you very much. Any questions? A blockbuster video library was to be the lay level project. Is that in any way related to blockbuster game bus? It probably was, yes. Why did they do this? I met an old friend a few months ago. He said he had a disk of these games on him. I tried them in wine and it broke. So I had to recover them. What I wish I could have shown you was a genuine mid-90s play bug in Tron. You might have noticed all the... You could cross all the colours and it would allow that. Which I pleased perfectly. I also did work recently on a 4GL with pearl. I just ended up putting some of it line by line from the 4GL to pearl. Your variant appeared to be particularly nasty. Generally it seems to be a faster cross between basic and Pascal. That looked more basic. My stuff looked more like Pascal. That looked awful. I think we've been blessed by the original author having been on a very tight deadline. Any advanced parsing was just well out. As little as possible to get a working thing. For this project we did originally try doing a line by line conversion of it. But found the bugs were just accumulating too quickly. There's lots of little nuances in a thing like that. There's a lot of code and it wasn't practical in the end. Thank you very much.