Download presentation
Presentation is loading. Please wait.
Published byJeremy Noel Chambers Modified over 9 years ago
1
GAM531 DPS931 – Week 1 Introduction
2
Professors Joseph Hughes Info: scs.senecac.on.ca/~jp.hughes T2104 Jp.hughes@senecacollege.ca Roles: Primary Lecturer Modern API Wizard Chris Szalwinski Info: scs.senecac.on.ca/~chris.szalwinski T2093 chris.szalwinski@senecacollege.ca Roles: Mathematical Genius DPS931 Overlord
3
So what does this course teach you?
4
So we will be making 3D games?
5
What is an game engine? Think of a car… Game Logic HP = 10; DMG = 20; Player.attack(); LoadLevel(10); Enemy.Spawn(); RenderScene(); Game Engine glEnable(GL_BLEND); glBindBuffer(bufferID); glBindTexture(textureID); glDrawElements(size, data); Game Output And now for some code…
6
Some Examples… ???Engine Game Logic
7
How is an engine structured? Engine Core Client Interface Operating System API Device API
8
Separation of concepts HARDWARE FIRMWARE OS APIDEVICE API APPLICATION CPU GPU CHIPSET DRIVERS Window Creation Console Write Input detection Your Program Open GL 4.3 DirectX 11
9
Why do we need Device APIs? OS APIs are slow Indirect, limited functionality Unable to harness true potential of hardware Device APIs are fast! Give nearly direct control over the device Specialized to fit to fit programmer’s needs
10
What devices are we using? We will be making use of the Graphics Processing Units (GPU) GPUs are highly parallelized processing units made for graphical processing GPUs can come as discrete Graphics Cards or Integrated Chips with your mother board or CPU (APUs)
11
To recap… ApplicationDevice APIsFirmwareHardware // Set up the description of the static index buffer. indexBufferDesc.Usage = D3D11_USAGE_DEFAULT; indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount; indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; indexBufferDesc.CPUAccessFlags = 0; indexBufferDesc.MiscFlags = 0; indexBufferDesc.StructureByteStride = 0; // Give the subresource structure a pointer to the index data. indexData.pSysMem = indices; // Create the index buffer. result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer); // Set the depth buffer to be entirely cleared to 1.0 values. glClearDepth(1.0f); // Enable depth testing. glEnable(GL_DEPTH_TEST); // Set the polygon winding to front facing for the left handed system. glFrontFace(GL_CW); // Enable back face culling. glEnable(GL_CULL_FACE); glCullFace(GL_BACK); // Initialize the world/model matrix to the identity matrix. BuildIdentityMatrix(m_worldMatrix); The ultimate goal – To render a 3D world to the screen
12
Engine recap Engine Core Client Interface Operating System API Device API
13
Into the Emperor Engine Engine DX11 Device GL 4.3 Device ControllerManagerModel DX11 Object GL 4.3 Object DX 11 API GL 4.3 API DX 11 API GL 4.3 API 1 m 1 1 or 1 1 or 1 1 iEngine iController iModel
14
Stepping into the Engine iEngine.hpp namespace Emperor { class iEngine {…}; } Engine.hpp namespace Emperor { template class Engine : public iEngine, public Singleton > {…}; }
15
Reviewing Namespaces struct Foo { int a; }; namespace Bar { struct Foo { ::Foo a; }; namespace Derp { struct Foo { Bar::Foo a; }; } int main() { Foo a; Bar::Foo b; Bar::Derp::Foo c; } or using namespace Bar; int main() { ::Foo a; Bar::Foo b; Derp::Foo c; }
16
Reviewing Pure Virtual Classes (Interfaces) virtual void doStuff() = 0; Interface virtual void doStuff() {…} Derived Class void doStuff() {…} Most Derived Class class iThing { virtual void doStuff() = 0; }; class Thing : public iThing { virtual void doStuff() { std::cin << “Thing”; } }; class BigThing : pulic Thing { void doStuff() { std::cin << “BigThing”; } }; int main() { Thing* a = new Thing(); a->doStuff(); }; int main() { Thing* a = new BigThing(); a->doStuff(); }; int main() { //iThing* a = new iThing(); iThing* a = new BigThing(); a->doStuff(); };
17
The Engine Interface class iEngine { private: friend iEngine* createEngine(RenderSystem); friend void releaseEngine(iEngine*); protected: virtual ~iEngine() {} public: virtual void initialize() = 0; virtual void release() = 0; virtual void setFullScreen(bool) = 0; virtual bool isFullScreen() = 0; virtual void activateDevice(iWindow*) = 0; virtual iResourceController* getResourceController() = 0; virtual iSceneController* getSceneController() = 0; virtual void render() = 0; }; Create & Destroy Engine (Friends for Dynamic Linking) Retrieve Controllers Activates Device for rendering Render a Single Frame Initialize and Release Engine Assets
18
Back to the Engine iEngine.hpp namespace Emperor { class iEngine {…}; } Engine.hpp namespace Emperor { template class Engine : public iEngine, public Singleton > {…}; }
19
Template Review template class Foo { T a; public: Foo() {a = 0;} void doStuff(); }; int main() { } Foo a; Foo b; Foo c; class Foo_of_int { int a; public: Foo() {a = 0;} void doStuff() { std::cout << “Foo”; } }; class Foo_of_float { float a; public: Foo() {a = 0;} void doStuff() { std::cout << “Foo”; } }; template <> void Foo ::doStuff() { std::cout << “Char* Foo”; }; template void Foo ::doStuff() { std::cout << “Foo”; }; class Foo_of_char_ptr { char* a; public: Foo() {a = 0;} void doStuff() { std::cout << “Char* Foo”; } };
20
Template Specialization Review… template class Device{}; template <> class Device { private: IDXGISwapChain* swap; ID3D11Device* dev; ID3D11DeviceContext* con; … }; template<> class Device { private: HGLRC context; HDC hdc; … }; int main() { } Device a; Device b; Device c;
21
Template Misc. Review template class Foo { T a[N]; }; int main() { } Foo a; Foo b; Foo<> c; All three are the same! file.hpp template class Foo { T a; public: void doStuff(); }; file.cpp template void Foo ::doStuff() { std::cout << “Foo”; }; Compiler does nothing! Linker can’t find function! template class Foo ; Compiles for int and float, can only be bound to those!
22
Finishing Recap This course is all about engine development! An engine is framework that enables programmers to accomplish complex tasks with relative ease A system API is an interface that exposes a set of functions to provide programmers with control and functionality that would otherwise be out of grasp Device APIs like DirectX 11 and OpenGL 4.3 allow a more direct and more efficient method interfacing with the firmware controlling the hardware The GPU is a highly parallelized processing unit designed for 3D graphic rendering You got a glimpse of the Emperor Engine’s design
23
Course Breakdown Please read the course outline on the ICT website! Mark breakdown: Labs are worth 2% each, if a lab is not complete by the end of the day the highest mark achievable on the lab is ½. You are expected to know how to use git and Visual Studio 2013, there will be a review of them next class A laptop or desktop computer with a modern GPU is highly recommended Labs (10)20% Assignment (1)30% Mid-term20% Exam30%
24
To Do Install Visual Studio 2013 on your personal computers Install most recent DirectX SDK on your personal computers Update the graphics drivers of you personal computer (must support OpenGL 4.3) Create a BitBucket account if you don’t already have one
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.