We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Python Gamedev MLG

00:00

Formal Metadata

Title
Python Gamedev MLG
Title of Series
Part Number
121
Number of Parts
173
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language
Production PlaceBilbao, Euskadi, Spain

Content Metadata

Subject Area
Genre
Abstract
Alejandro Garcia - Python Gamedev MLG An overview of the currently available Python game development libraries and frameworks and how is Python currently being used in the videogame industry. Presentation of Kobra, a modern open source Python game development framework with ECS (Entity Component System) architecture and C++ bindings.
Keywords
51
68
Thumbnail
39:40
108
Thumbnail
29:48
Chi-squared distributionGame theoryVideo gameTwitterGame theoryEmailSoftware developerVideo gameContent (media)Software frameworkAreaMultiplication signCASE <Informatik>Confidence intervalComputer animation
Video gameCodeSystem callInterpreter (computing)Loop (music)Game theoryPort scannerLevel (video gaming)Video gameBuildingSocial classView (database)Parameter (computer programming)Sampling (statistics)Cartesian coordinate systemSoftware testingLikelihood functionInferenceArithmetic meanGame theoryCondition numberLengthWordForcing (mathematics)Interpreter (computing)Formal languageExtension (kinesiology)Slide ruleLoop (music)Software frameworkCopyright infringementWeb 2.0Key (cryptography)Pattern languageGoodness of fitComputer programmingBitKeyboard shortcut1 (number)Software development kitEndliche ModelltheorieCodeStability theoryLibrary (computing)Vector potentialComputer animation
Open setVideo gameReal numberGame theoryPhysical systemMathematicsSoftware maintenanceGame theoryVideo gameReal numberConnectivity (graph theory)Open sourcePhysical systemSoftware frameworkDynamical systemLink (knot theory)Extension (kinesiology)Information privacyDomain nameNetwork topologyError messageRight angleSummierbarkeitGraph coloringMathematicsPrice indexCellular automatonComputer animation
Physical systemGame theoryElectronic mailing listMessage passingPort scannerKnotCodeNP-hardSystem programmingMathematical singularityVector potentialCore dumpMultiplicationMathematicsCore dumpGame controllerFirst-person shooterConnectivity (graph theory)Game theoryDifferent (Kate Ryan album)Moment (mathematics)Student's t-testCodeNP-hardTelecommunicationMessage passingPhysical systemElectronic mailing list1 (number)MultiplicationKeyboard shortcutSparse matrixActive contour modelComputer virusExistenceDistanceMatrix (mathematics)Enumerated typeBitSymbol tableSoftware testingPhase transitionSatelliteMassThread (computing)MereologyProxy serverSystem callLink (knot theory)Computer animationProgram flowchart
Dot productImplementationInterpreter (computing)Image resolutionInsertion lossElectronic mailing listQuicksortXMLComputer animation
Game theorySystem programmingPhysical systemCore dumpSoftware frameworkGame theoryPhysical systemConnectivity (graph theory)Loop (music)Core dumpThread (computing)Frame problemSequenceReading (process)Computer animation
Tabu searchMetropolitan area networkStorage area networkMessage passingoutputNewton's law of universal gravitationSigma-algebraSystem callGamma functionDifferent (Kate Ryan album)Maxima and minimaGame theoryModul <Datentyp>Data Encryption StandardBeta functionDemosceneText editorDemo (music)Value-added networkProjective planeDemosceneCASE <Informatik>Open sourceComputer fileMessage passingSpacetimeTransformation (genetics)Parameter (computer programming)TouchscreenConnectivity (graph theory)CubeSet (mathematics)Variable (mathematics)RotationoutputGame theoryPosition operatorPhysicalism1 (number)Function (mathematics)Observational studyKeyboard shortcutCuboidGame controllerPolygon meshCollisionEndliche ModelltheoriePhysical systemVolumenvisualisierungConfiguration spaceImage resolutionKey (cryptography)ResultantDifferent (Kate Ryan album)MappingCartesian coordinate systemOpen setUser interfaceParticle systemBeta functionQueue (abstract data type)Text editorPlanningLibrary (computing)Functional (mathematics)Ocean currentArtistic renderingGroup actionMultiplication signArithmetic meanWeightCovering spaceSingle-precision floating-point formatSummierbarkeitLatent heatOrder (biology)TheoryFormal languageCondition numberAreaQuicksortHierarchyActive contour modelView (database)MereologyMedical imagingMathematicsDistanceGrass (card game)Proof theoryDecision theorySoftware developerExecution unitSoftware testingContext awarenessSystem callInformation securityRight angleCore dumpAxiom of choiceFile formatDigital signalInformation technology consultingReading (process)Error messageComputer animation
Maxima and minimaMultiplication signVisualization (computer graphics)Arithmetic meanComputer animationSource code
Inclusion mapMetropolitan area networkInformation systemsCodeLink (knot theory)CuboidSpacetimeAreaKey (cryptography)Game theoryMessage passingMereologyComplex numberInformation securitySpeciesSource codeComputer animation
Physical systemOpen sourceEmailMoment (mathematics)Message passingVolumenvisualisierungMereologyAndroid (robot)BitMobile WebSoftware developerSoftware frameworkShader <Informatik>Right anglePolygon meshConnectivity (graph theory)Set (mathematics)FreewareSource codeClient (computing)Web pageServer (computing)CodeArtistic renderingWritingVideo gameComputing platformGame theoryTransformation (genetics)WindowDistanceParameter (computer programming)CodeObservational studyMatching (graph theory)System callSoftware testingMathematicsError messagePhysical lawArithmetic meanSocial classPlanningUniverse (mathematics)QuicksortResultantLocal area networkCartesian coordinate systemComputer animationXML
Transcript: English(auto-generated)
Hello everyone, my name is Alejandro Garcia and I'm going to talk about Python game development. Here you have my Twitter and email, so if you have any questions or something to ask me or whatever you want just feel free to send me an email or whatever, okay?
So the contents of this talk is first I'm going to talk about how Python is being used currently in video games and I'm going to show you my own game framework that I call it Cobra Okay, so how Python is currently used in video games and there are two ways of using Python in video games
okay, the first one is using Python as a secondary language for scripting and here the main game is Program in another language like C++ for example, and the Python interpreter is indeed inside the application, okay
so the application calls that Python code for centering actions such as what happens when two actors collide or so on but Well, this waste is Python potential. We don't use Python as much as we should and Python is designed to be extended not in bit
Okay, so and some examples of game that use Python this way as a secondary language for scripting is seen my stabilization for a mountain blade and The other way of using Python for video games is using it as a primary language
Here the pattern interpreter runs the main game loop Okay, and some bindings for improving performance can be used such as C++ or so on we have a Little slower than the previous example so Some examples of game that use Python as a primary language
are if online and making to Next these are the most used Python libraries As a Python for primary language we have by game that is very easy and very popular
you may know about it and we have Cocos2d that is a bit more complex than pygame, but It has more features for 3d. We have Blender 3d that as you may know, it's a 3d modeling tool But it also has a game engine. Okay But the downside that Blender 3d has is that it's GPL so we can make commercial games from it
and we have Panda 3d that is a business creation framework that was used for their games such as Pirates of Cali event, so so Okay
Developing games with Python. Python is very good language such as C sharp or JavaScript, okay but The only problem is that there are very few game frameworks C sharp is used for unity that is very popular Challenge kit is used for web games, but Python is not now not currently used not because it's it's not good
it's because There aren't any game frameworks and some of these frameworks are a bit limited or have another key to show I'm going to explain Cobra. That is My game engine
It's an open source 3d game video game framework Okay, and it's three things dynamic efficient and easy Okay, so why is it dynamic? It is dynamic Because it uses an ECS architecture. I'm going to explain later what this ECS architecture is
Okay, so it's designed for real-world game development as you may know in the real game game development teams the game changes a lot because mainly of designers, okay, and So this architecture helps us to change the game
more easily and this makes Our game easily adaptable and extendable so You may ask now, what is this entity component system? Well, this is stands for empty component system. Okay, so I'm going to show you an example
Here is For example, let's think that we are working for EA and we are developing Star Wars the new Star Wars Battlefront, so we have our game entity And from then we extend our ships
and that ship can be either enemy ships or prior ships and These enemy ships can either be enemy x-wing or y-wing and the same with the players We are very happy our game runs very well suddenly our dear game designer
Come and say hey What's up programmer? We have to change the game. So now we want a lead ship and then Well, we just have to rethink and I know the architecture we have to rewrite a lot of things This is the new architecture that again. We have with an AC
AC and so on It's very probable that Our game our game designer will come again and change our game over and over So I wonder is there a better way? Well, I have the pleasure to introduce you to the entity component system
it is used in modern game engines such as unity 3d or Unreal Engine 4 and the basic concept is that the game entities that Goes our game are just a list containing components that make up that entity. Nothing more is just a list
Okay, so our previous example our Enemy x-wing will be a game entity that has an enemy control because it's controlled by the enemy It has a mission shooter because it should missiles Beside of sorry and it has a thruster movement because he moves forward. So a
This component communicate with each other via messages. So here for example our Component a control wants to move forward So the messages are sent to our entity components and then are consumed if needed so the mission shooter
Receiving forward but because he doesn't need to know if it's moving forward then it ignores it But our student movement says, okay, so you want to move forward? I'll do it and Our x-wing will move forward so a our architecture of of our previous example
We look like this here. We have our enemy x-wing That is a game entity that has a control mission shooter at the moment as explained before and the only difference From the y-wing is that the mission shooter is replaced with blast shooter So making this with components we can
just Reuse These components in different entities. I'm here for example The prior x-wing and the enemy y-wing and the only difference is that is controlled with an a And the player is controlled with keyboard control and the same goes with with y-wing
So what do we achieve with this entity component system? The enemy a doesn't need to know anything about the entity weapon or even if it has one He has sent the message and if there is something like a missile or blast or whatever it will it will show for example
If there is nothing it will be nothing so we can quickly switch the blast with missile with the changing anything of a code making the code much more flexible to changes and Our friends the designers won't hurt us as much as They usually do so I talk about
Entities I talk about components now. I'm going to talk about the systems okay, so Components don't do the hard work instead. They send commands to the systems and These commands are acute. Okay, and then later on they are
We don't have to because each system does a separate thing we don't have to worry about Interlocks at all. So Core is efficient. Why is it efficient because it has a C++ core. Okay, and it's multi core. So
Here Here's Cobra uses Python and Python Communicates with C++ that has components and system You can also program your own components in Python or C++ and your systems on C++ or Python
and you may ask now what about the deal and Who doesn't know what the deal is Who doesn't Okay The deal stands for global interpreter lock. It's a implementation feature of C Python that a
Doesn't allow us to run on more than one core, okay so How do we solve this? Well, Cora is within C++ mostly so This is how the main Game loop goes. Okay for each entity in Python. We update it
Components we enqueue commands to a systems and then when everything is done. We update the systems okay, and For the update we will go to C++ and spawn a thread for each core of the system After that, we update that system And we join and we can go back to Python without breaking anything of the deal
this runs over and over on the game, so Cora is easy. I tried to I was inspired by Django. Okay to make this framework. So I'm going to explain now
a little example of how to make a simple project with Cobra so This is a our this is a simple Cobra project, okay, we have five files We have behaviors controller entities scenes and settings
In the entity file we define its entity and the components you will have here For example, I'm making a queue that it has three components it has a Cartesian transform this allows to this entity to be placed in the world of the scene and Mesh renderer that allows us to draw a 3d model in this example. I'm
Throwing up a cube mesh and a behavior that makes the cube to rotate so These are the most important components that Cora has
Sorry Okay for a space transform We have a Cartesian transform that allows to as explained before it allows that entity to be placed in our world For a transform that is just the same but instead of using a Cartesian transform is use a polar transform from the region or
a screen transform that is a transformation in the screen space and this can be used for a user interface things so These are the rendering. Okay. Sorry for this and We have mesh renderer that is for rendering meshes
We have a mesh animator that I mean, it's with the mesh and we have build or render that Will render a billboard and a billboard is just a plane that always faces to apply. Okay, so For physics have read body
Somebody and box collides for collides for defining what kind of collisions we will have and for audio we have audio source That is from where the audio is being played and the listener that In most the case it will be our player and there are much more components that you can use in Cobra. So
Behaviors in the behavior file we define the behaviors Behaviors are components we predefine messages the most important ones are start sorry update an input in the studies
it calls when When the entity is created update it calls in each tick of the game and input is when input in the game happens, so a With cobras and the messages is very easy. We just call set of components now the name of the message and here we put which
Variables for output we want from that component and here in the keyword arguments. We we put the Input variables. I want to explain now, okay Here's our last example rotating behavior That just makes that that entity to rotate so here in the update that runs on each tick
I'm Sending a message to get the current rotation. And as you can see here, I'm creating a dick That will be the output for that message. And now I will have here my rotation and with a speed with that speed
I'm going to update it. So And now I send this message said said transform with our new rotation It is also possible if you don't like To send messages to get a specific component and call a specific function on it
so you can just get the transform and Call get rotation to get the current rotation and here update it. Just the same way as before Sorry, okay
Controllers we define mapping for different device inputs Here, I'm getting the keyword and an Xbox controller and here I define What will be our game controller or game controller?
we have a fire button and x-axis and here we make the Mappings saying that if this fire button is going to be a digital input that will will map to the key from the keyboard and the
It will turn to the Xbox controller So this way we will just check if the fire button is pressed and we don't have to worry if it was from the keyboard from the Xbox controller Key make or whatever you want and the same goes with x-axis
This is an output to the input. It was just the same And the same file we define the game scenes, okay, so Here I'm making oh, sorry the scenes have two important methods First the start that is called when the entity is created and then update that is called in each tick of the game
Here I'm creating The previous cube. Okay, and I'm calling its components to set the transform to the position 000 and in each update of the scene, I'm displaying the current FPS of the game
And settings that P that it's very important It contains the game configuration and the system modules that we want to use. I want to spend that later Here we set the game name in this case my name and the Resolution that our game will run here. For example this result among other settings
The one thing about this file is that here we we can set which systems will the entity component system use Here I'm using OpenGL open. I'll I'll sorry bullet and my own input from Cobra
so If even I don't want to use physics I just comment this and my game won't have physics. I don't want to use bullet. I want to use another physics library I change it for for everything and The rendering the same if I want to use direct text
the same so as you can see Cobra is very extendable and you can just it's very Pluggable Well And the other Okay, the current status of Cobra is still in development. Okay, the
beta will be available on December and If you want to help me with this, I will be glad ready to To want to work with you And my future walls are to implement a particle system In editor and we can support we can support
Do you know Vulcan anyone? What is? Vulcan is the new graphics appy that chronos group will will release that will replace open GL in Short time so I want to support it as well. And now I'm going to show you a simple Cora demo, okay
So don't blame me. Okay. Sorry. I love Python tools for
Visual Studio don't blame me. Okay, I
Will just run it See if it works. Well, it didn't work Let's see This is a Game like Angry Birds, okay but in 3d we have this link shot our box and
In this example is very see we just hold this space bar When we release it Okay, and you can see here that I'm getting a score for the seats that are going outside
And Let's check the code the code is very easy You can see here the entities That I have I have a direct box That has a partisan transform to be placed in the world Yes rigidbody
collider and And a scorebox to behavior this behavior the only thing that it does is to Check if it has gone outside the the Don't know how to say it outside there
There The area. Yes. Thank you. Thank you Outside the area we just Add the score and we print our score. You can see is very easy Here we have the player. That's just the same but it has a player behavior and this behavior the only thing that it does is check if the
Space key is being pressed. If so, it starts up and moves backwards and Then if it's released we Send a message to Apply that in close to forward you can see is very and it is all
So Thank you for your attention, I hope you enjoy it and questions
Yes Do you have oculus rich support or you planning in adding it? I don't have a clue support them. Well the idea
To it it works as well. You can just use a car transform But only moving around the X or Y axis You can use just the screen transform
if you want Any more questions? Yeah So your message passing part is all in C, but then it's calling back into Python to execute the Methods so what is the what for what is it just for the message passing that the gill is released?
Or do you have like a lot of components written in C? The components are written in C. Yes, but you can also write components in Python if you want the systems are
Systems and the components can be Programming in C or Python If I understand your question You're asking if the if all the messages are passed to all the entities Sorry to all the components
Performance just yeah, so if you are so you're not getting you're not getting any performance benefits if your components are written in Python You only get them if you're writing them in C. Is that right? Well there with all the performances that the renderer just
runs in C and that's the OpenGL calls that are the most expensive Right. So it's basically the rendering that is Everything you can just say make make a system in Python or in C just as you want Each system as I as I explained you can just
In the settings it will just work Any more questions, yes How does a framework approach the transport like problem For example, you have a delay between client and server if I fire a bullet from client and I have a leg
So is it possible with a framework to somehow approach that problem Yes, well the components are a bit bound to the to the systems Okay, so you have also to write the components for your system if they are not compatible
Any more questions? I have one. Do you support Python 3? In the future I get a promise
Okay, do we have any more questions? Thanks for the talk. Where can I find the source code? The source code I will Upload it into my my github. I'm going to also make a web page
It will be available on December if you want to or or You and you can Tell me your email and I will send to you if you want, but it's it's still in development There are some things that That need a bit of work, but if you're interested I I can send to you with with the source
You want how do you see the future of?
Python game development keeping in mind that There are a lot of high quality free engines out there. Well, I see it complicated that's why I wanted to help Python to
To be a thing in video game with this framework But I just I see a bit complicated in the future So we saw code to render a mesh with what kind of shaders is that running? And is it like a kind of deferred?
rendering engine or Customize the shaders that rendering pipeline. It's deeper rendering. Yes And can you customize the rendering pipeline? Yes, any more questions?
Okay, so I'll ask what platforms do you support Well, I didn't try but it's it's open source so it can compile to Any platform I'm using boost boost Python for the for the living things of C++ and
And Well, I have the system is used their own DLL so on but a It's a bit complicated to to port right now, but it works for Windows for a moment
So no Android for example. Oh For mobile, I'm not planning for for being able to make games for Mobile for a moment. Okay, does anybody else have a question?
Alright, thank you