Placeholder Image

Subtitles section Play video

  • Hello.

  • I'd like to introduce the one lone Koda pixel gay mentioned not long after starting this channel.

  • I created ahead of file called the OLC Consul Game engine.

  • And this was a little utility file that allowed me to harness the Windows Command prompt in such a way that we could display graphics and accept user input.

  • And I used it to create many game demos on algorithm demos.

  • And I think the response to this game engine has been really quite fantastic.

  • There's quite a lot of people using it on.

  • I think the simplicity of using it really appeals.

  • There's very little boilerplate to do.

  • You just include the head of file and you start writing the code that matters.

  • That's my YouTube channel has evolved that the demands I've been putting on the console game engine have been growing and growing on.

  • It has been a little bit of a competition in some way to see just what can I do next with the command prompt.

  • The recent code it yourself three D graphics engine, Siri's, has highlighted some of the limitations that I'm facing with the console.

  • Primarily it doesn't do graphics, and instead we've had to resort to approximating graphics in interesting ways.

  • We saw in the Web camera the council video on subsequently some of the community's efforts to make that even better, that you can approximate graphics quite realistically.

  • But on the whole, the performance begins to really slow down.

  • And in the texting part of the three D graphics engine Siri's, we began to see performance issues due to how the windows subsystem renders the council.

  • There are a lot more interesting algorithms I'd like to display on this channel, but I do need some sort of higher Fidelity graphics in order to do so.

  • I guess they will be predominantly graphical algorithms, but I'm a little bit conscious of the fact that the videos of becoming about how do we do graphics in the council rather than focusing on the algorithms underneath.

  • And so I decided to create the woman code, a pixel game engine, the pixel game engine, like the council game engine.

  • Before it is a single head of file solution on, I've decided to create my own license to use it.

  • Oh L C.

  • Three.

  • It's a variation off the BSD three license.

  • Fundamentally, it's the same But it does insist that you give me a little bit of a nod.

  • If you use the code in something public now, I want to get this clear straight away.

  • I'm not going to stop using the council game engine.

  • It's still appropriate for a lot of things that I want to do.

  • If my applications have predominantly text based, I'll use the council.

  • Gay mentioned.

  • If the predominantly graphic space I'll use the pixel gay mentioned and one of the things that I've tried to do, mainly due to the success of the council game injured is emulators much functionality of the council game engine as possible.

  • So it's a very, very similar experience for the user.

  • In fact, you can take most of my existing code import.

  • It's over, very trivially on.

  • We'll see some examples of that later on.

  • One of the things I've tried to get right from the start this time.

  • And remember when I started this YouTube channel, I never really expected it to gain any kind of subscriber base it all, so compiling on other platforms wasn't a priority.

  • However, this head of file has been compiled in Lenox first, and I took this approach to really try and ensure the maximum compatibility we can have with his many users and operating systems as possible.

  • I've also tried to rely on libraries, which are effectively standard with any development in stall.

  • And so compiling code that uses the pixel game engine should be quite simple.

  • I've also made an effort to support code blocks on Windows.

  • Now I appreciate not.

  • Everybody has access to visual studio on Windows on one of the most frequent comment is How do I get your code to work on code blocks?

  • So I guess there are parts of the world where code blocks is still quite popular, so the pixel game engine should compile on code blocks to in the standard Windows environment.

  • You no longer have to do anything at all to get the project to run.

  • It will self load the library's on visual studio in code blocks.

  • You need to add four libraries, but it's quite clearly highlighted which for they are and you will have them in your default code box installation.

  • I've also worked on quite a bit to get it to be a character type agnostic, so it doesn't really matter whether you're using Unicode or not.

  • Now, the first major change is all of the pixel game engine code exists in an O.

  • L C name space, and I've adopted this approach to allow me to wear extensions later on that can exist within this name space without contaminating the rest of the programs instead of characters.

  • The fundamental unit you operate upon is the pixel, which is a 32 bit full color, well, pixel.

  • And so, yes, the pixel game engine supports transparency.

  • In the console game engine, we had something called an ol sea sprite.

  • Well, we have a no well see sprite again.

  • This time it's just called Sprite on DIT loads a PNG file.

  • So the pixel game engine works with P and G files fundamentally underneath.

  • I will walk us through a little demonstration later on, but I just want to highlight some of the features of the head of file.

  • So you'll see.

  • There's a lot of familiarity with the council game engine.

  • You first need to construct on instance off the pixel game engine and you give it a width and a height instead of this time giving it a font width and a height.

  • You give it a pixel width and height.

  • So this means that pixels in the pixel game engine don't necessarily have to have a want a one relationship with screen pixels on.

  • This will allow us to have this retro blocky effect, which I quite like, but we don't have to have a retro blocky effect.

  • In fact, we can have very high definition algorithms to next.

  • We see two very familiar functions to the council game.

  • Engine on user, create on on user update.

  • These function exactly the same as they did before.

  • If you didn't know the consul game agent also has on user destroyed, but I don't think I've used it in any videos.

  • The nature of interacting with user input is exactly the same.

  • We can check if the window is focused.

  • We can get this state of a key, and we can get this state of a mouse.

  • We can interrogate the primary display of the pixel game engine exactly the same as with the council game engine, with the functions, screen wit and screen height through a few more now, which we may go into detail in in later videos And if you have any familiarity with counsel game engine, you'll recognize a lot of these functions straight away.

  • We can draw single pixels, draw lines, draw circle, outlines, Phil circles.

  • I've now I did a draw, a rectangle function and a film rectangle function.

  • We've got the drawer triangle and Phil Triangle, which have exploited a lot of recently and draw spite on draw partial Sprite.

  • So hopefully you can see that very little has changed from how they use it interacts with the pixel game engine.

  • Ironically, one of the more complicated things to do now is actually draw text, but I have provided a drawstring function.

  • We may look at the implementation of that later, too.

  • As we stroll down the aisle C pixel game engine, head of file, we discover a gap.

  • Everything above this gap has been the declarations and everything.

  • Below it has been the definitions, so this means we can create the object oriented programming alternatives to the pixel game engine very trivially.

  • Now I think I'll do a separate video some point in the future on the actual mechanics behind how the pixel game engine works.

  • But it's very, very similar to the console game engine.

  • The only difference this time is it needs to create Windows for the platforms that it supports.

  • When I introduce the council game engine, I created a very quick demonstration to display noise on the screen.

  • It's just kind of the council game engine Hello, world equivalent.

  • So I'll do the same with a pixel game engine, starting with a blank source file in a blank project.

  • I'm going to include the pixel game engine, head of file.

  • Now we need to create a class that derives from the pixel game engine.

  • So I called the class example, which inherits publicly from a well see pixel game engine.

  • Now remember, the OLC is a separate name space.

  • Now, when we create a new class, it's typical to override the constructor.

  • So we'll do just this.

  • And as with counsel game agent, you have the opportunity to name your application.

  • Typically, they're two functions we always want to override.

  • The first is on user create.

  • In this instance, we don't need to create any resources, so I'm just going to return.

  • True to say that this function successfully completed the main function where all of the guts of the game engine Lies is on user update, which takes in a floating point variable called F Elapsed Time Again, we'll make it return.

  • True to say, Please don't terminate the application with those two basic functions now declared will implement the main function.

  • So the first thing is to create an instance of our class now, before we used to call a function called Construct Counsel in exactly the same way.

  • This time we just call a construct function, and we're going to give us the screen width, the screen height that we want and three dimensions per pixel.

  • In this case, I'm going to choose four and four.

  • So a pixel in the pixel game engine is represented by four screen pixels on your display.

  • If the construction returns successfully, then we want to start the application, so hopefully you can see already that it's exactly the same is how we did things with the council game engine before we had any body toe on use update.

  • Let's just run it and see.

  • And so, as before, with the council game engine, you can see the name of your application on the frame rate appearing in the title bar.

  • So here we are not needing to do any updates to the display.

  • By default, the engine is clicking over on my machine at about five and 1/2 1000 frames per second.

  • Let's make it display all of the pixels as random colors, so I'm going to go through all of the pixels in turn, by using 24 loops.

  • Individual pixels could be drawn to using the drawer function exactly the same as the council game engine.

  • So specify the location of the pixel on dhe.

  • This is worth things change a little bit.

  • Previously, we would have used a character on a color.

  • So if we wanted to display their pixel as the letter A, for example, in the council game engine, we could do that here.

  • That's no longer an option, because the pixel is now purely a graphical thing.

  • There is no text associated with it, and so we have a variety of ways of specifying the look off a pixel built into the head of file our loads of constant colors already, so he wanted to display everything green.

  • We could just use the name space and find the constant green, but If we want to set the pixel values directly well, just quickly use the stroke, and we can construct an instance of pixel by passing.

  • It's the RG and be values.

  • Colors in the pixel game engine are represented, with RGB being between zero and 255 It's a 32 bit color system.

  • We'll worry about Alfa later on.

  • So I wanted to pick a random number between zero and 255 for the red pixel.

  • I'm cutting paste for the green pixel.

  • Couldn't pace for the blue pixel I'm with Don.

  • Just fix this little error appear.

  • Let's take a look.

  • So there we have a screen full of noisy pixels, and it's quite pleasing because the pixels have a certain sites.

  • Now.

  • As I said in the previous video, when I was introducing the council game engine, I reckoned the YouTube encryption algorithm has completely collapsed.

  • At this point, we could make things look a little bit more Pixley.

  • So let's say, for example, I choose the screen size of just 64 by 64 very small, but I choose a pixel size of 16 by 16 much bigger pixels.

  • So hopefully here I've demonstrated that the way that you use the pixel game engine is exactly the same as the way they use the council game engine.

  • You just got to think in terms of pixel values instead of characters.

  • Now I've pulled in one of the programs I used.

  • When I first created the council game engine to demonstrate it, it was generating mazes.

  • Let's take a quick look just to refresh our memories.

  • As we can see, it uses a search out with them to create a maze of any size.

  • So I feel it's only appropriate that we try and convert this over to the pixel game engine just to see how trivial it is.

  • So the first thing is to change over the head of file to pixel game engine, and we'll need to inherit from a slightly different class.

  • Fortunately, visual studio will show you all the places where things don't quite add up.

  • So this M s app name Variable has now simply changed to s app name and we don't really care about it.

  • Being in Unicode anymore will leave all of the functioning maze code exactly the same.

  • So it's only when we get to the drawing stuff.

  • Do we need to think about things a little differently?

  • So the clear the screen we used to draw filled rectangle.

  • We now use the Phil Recht function for this, and this shows you how long ago this video waas we didn't even use screen, width and screen height back then so will change those.

  • And since we're clearing the screen previously, we would draw space instead.

  • Now what we're going to do is draw a black pixel again.

  • The next error exists where we're drawing something.

  • So here we were drawing a solid white pixel well, by default, the drill function will draw a solid white pixel.

  • But let's just be explicit white, and this one looks like a blue pixel in the main function.

  • Ah, last remaining era is the construct consul function that doesn't exist anymore.

  • It's just called construct, so we've really only made a handful of little cosmetic changes.

  • Let's take a look and you can see it performs in exactly the same way.

  • If not a little bit faster, I'm going to do the same again.

  • But now, with the final episode off the Cody Self Graphics engine series, where we looked at texture.

  • So I'm going to load up the spiral, the dragon level on displays in the pixel game engine.

  • Fundamentally, the code has been changed.

  • The only difference is aware.

  • We've been drawing and getting user input.

  • So who's Aaron put it?

  • We haven't looked at yet.

  • Instead of specifying now a particular key code native to the operating system, you specify an ol see key code, but functionally, it's exactly the same.

  • Whereas we used to specify W S A N D.

  • As characters we now use them is Constance from the engine.

  • All of the mechanics code of actually rendering the three D graphics is exactly the same before launch it one quick thing that we now work with PNG graphics instead of the SP R file.

  • So let's take a look.

  • And here we see it's the spiral level exactly the same as it was before, but now looks a lot more detail.

  • Yes, the artifacts and glitches are still.

  • Please look at that video for an explanation, but we can see the performance is quite nice about 240 ish frames per second, depending on what it's looking at now that we have fewer limitations on what we can do with screens.

  • We can increase the resolution of things.

  • So I'm going to set the Spiro to be technically high death, 12 80 by 7 20 in this instance, I've set the pixel width and height toe one so that matches screen, pixel width and height.

  • So even though it's called the pixel game engine in this instance is not necessarily deliberately rendering pixels.

  • But, as you can see, that looks pretty crispy and performs quite acceptably, too.

  • In a way, I hope that this further justify said from the graphics engine Siri's.

  • Even though things looked a little bit rough and ready around the edges, the underlying principles were sound, and all we had was a restriction on how we rendered things.

  • I'll just quickly show one last thing, and that is how to enable transparency per pixel, because I know some of you will want to just get stuck in straight away.

  • So when you want transparency enabled, you can specify the pixel mode to be Alfa.

  • Don't worry, this is all documented in the head of file on what this does, and then I'm going to draw a Sprite of the location of the mouse coordinates.

  • The PNG file contains Alfa Information already have chosen to specify the pixel mode separately, because performing Alfa blending calculations is a little more costly.

  • Not much, but it is more so.

  • In most cases you don't need it, but where you do need it, you can enable it explicitly.

  • Let's take a look.

  • So here I've got following the mouse cursor, the one lone code a logo and you can see it's got some transparent elements to it, and it overlays nicely with scenery in the background.

  • This should make making games very simple indeed, because he can use any art package that can output PNG files to create assets for the game.

  • They will see pixel game Engine exists in a new report on my get hub and at the moment doesn't contain very much other than the head of fire itself.

  • On a couple of little example programs to get you going, all ADM.

  • Or as time permits, I'll try and convert over as many of my existing video programs as possible.

  • What I will try and remind you is that there is a wicky tab on the pixel game engine on.

  • This is where I'm going to be placing more accurate documentation.

  • Traditionally, with all new projects of the moment they go nowhere.

  • But I think most of you will be able to get something out of this engine without much help.

  • Now, I don't have limits natively on my machine, But I do have ah version of Debbie in running in virtual box on.

  • I just wanted to show that I've taken exactly the same CPP file that we've created.

  • This is the one you've just seen in Visual Studio on.

  • I'm going to compile it using a very simple compile string.

  • This is also included in the head of file.

  • We might get a warning about String Street.

  • May l fix that?

  • That's actually nothing to do with the head of file.

  • That's to do with the texture.

  • Demo man.

  • Let's run that.

  • You see, it's it behaves exactly the same.

  • The frame rate is significantly less because it's a virtual machine running on my machine.

  • And I'm also recording all of this using O.

  • B s.

  • But nonetheless you can see, performs and behaves exactly the same way on because, yes, there are some masochists out there that enjoy using code blocks.

  • Everything should be compatible with that too.

  • So here I've loaded up the code.

  • I do apologize for your family's being burned out of their sockets right now.

  • It's just how it is.

  • S O compiled it on.

  • We'll run it.

  • And it's exactly the same.

  • Encode blocks, too.

  • Answer.

  • They have it.

  • The OLC pixel game engine, head of file.

  • It's available on the get hope, and I'm hoping that people will adopt it and start doing interesting projects with it, too.

  • I'll be using it to create some videos in the future, but I'm still going to work with the council game engine as well.

  • I'm not abandoning it all, since this is a new project that will likely be some bugs and glitches that need dining out.

  • So I'm hoping that the community might find some of these on that.

  • You let me know about them so I can do something about it anyway.

  • Quick little video.

  • You've enjoyed it.

  • Give me a big thumbs up.

  • Ever think about subscribing?

  • Could have a chat on the discord and I can't wait to see all of the pixel game injured games.

Hello.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it