GAM 200 Club. How to Game Engine GAM 200 Club Zachary Nawar.

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

Project M.AI.S. Multi-threaded AI system Per Erskjäns game engineer.
Chapter 16 Java Virtual Machine. To compile a java program in Simple.java, enter javac Simple.java javac outputs Simple.class, a file that contains bytecode.
The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
Constructor. 2 constructor The main use of constructors is to initialize objects. A constructor is a special member function, whose name is same as class.
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Review What is a virtual function? What can be achieved with virtual functions? How to define a pure virtual function? What is an abstract class? Can a.
Dynamic Allocation Eric Roberts CS 106B February 4, 2013.
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
PolymorphismCS-2303, C-Term Polymorphism Hugh C. Lauer Adjunct Professor (Slides include materials from The C Programming Language, 2 nd edition,
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
OOP Languages: Java vs C++
Games Development 2 Entity / Architecture Review CO3301 Week
CSE 381 – Advanced Game Programming 3D Game Architecture.
Programming Languages and Paradigms Object-Oriented Programming.
Object Oriented Programming using C++. Overview Problem Solving Features of an OOL Basic Syntax Programming Paradigms.
LECTURE LECTURE 17 More on Templates 20 An abstract recipe for producing concrete code.
TerraForm3D Plasma Works 3D Engine & USGS Terrain Modeler Heather Jeffcott Craig Post Deborah Lee.
Polymorphism. Introduction ‘one name multiple forms’ Implemented using overloaded functions and operators Early binding or static binding or static linking.
COP 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00-6:00 PM.
Overview of Previous Lesson(s) Over View  OOP  A class is a data type that you define to suit customized application requirements.  A class can be.
1 I-Logix Professional Services Specialist Rhapsody IDF (Interrupt Driven Framework) CPU External Code RTOS OXF Framework Rhapsody Generated.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Introduction to Processes CS Intoduction to Operating Systems.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
CS 450: COMPUTER GRAPHICS PORTRAIT OF AN OPENGL PROGRAM SPRING 2015 DR. MICHAEL J. REALE.
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
Computer Science and Software Engineering University of Wisconsin - Platteville 2. Pointer Yan Shi CS/SE2630 Lecture Notes.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Pointers OVERVIEW.
More on Drawable Objects, Hierarchical Objects Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, January.
Programming Video Games
Introduction to C#. Why C#? Develop on the Following Platforms ASP.NET Native Windows Windows 8 / 8.1 Windows Phone WPF Android (Xamarin) iOS (Xamarin)
Game Programming Patterns Event Queue From the book by Robert Nystrom
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
Chapter 3.6 Game Architecture. 2 Overall Architecture The code for modern games is highly complex (can easily exceed 1M LOC) The larger your program,
Object Oriented Analysis & Design Game Patterns. Contents  What patterns are  Delegation  Game Loop  Scene Graph  Double Buffering  Component 
OOP using C Abstract data types How to accomplish the task??? Requirements Details Input, output, process Specify each task in terms of input.
OOP in C++ CS 124. Program Structure C++ Program: collection of files Source (.cpp) files be compiled separately to be linked into an executable Files.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
PHY 107 – Programming For Science. Today’s Goal  Learn how arrays normally used in real programs  Why a function returning an array causes bugs  How.
GameDevClub CODE CHEAT SHEET NOTE: ALL OF THE CODE IS CASE-SENSITIVE AND THE SYNTAX IS STRICT SO A LOT OF YOUR ERRORS WILL PROBABLY COME FROM TYPOS If.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
Exception Handling in C + + Introduction Overview of C++ Exception Handling Designing With Exceptions Exception Handling Philosophies Conclusion.
Polymorphism and Virtual Functions One name many shapes behaviour Unit - 07.
PLUS FACTORIES ENTITY COMPONENT SYSTEMS. ECS OVERVIEW My Inspiration is Unity's GameObject architecture.
Winter 2006CISC121 - Prof. McLeod1 Stuff Solution to midterm is posted. Marking has just started… Lab for this week is not posted (yet?). Final exam (full.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
Build your own 2D Game Engine and Create Great Web Games using HTML5, JavaScript, and WebGL. Sung, Pavleas, Arnez, and Pace, Chapter 4 Implementing.
CMSC 202 Computer Science II for Majors. CMSC 202UMBC Topics Templates Linked Lists.
Abstract classes only used as base class from which other classes can be inherit cannot be used to instantiate any objects are incomplete Classes that.
V0.02 The ROOT Collection Classes. V Collection Classes Group of related objects TObjects or descendants from TObject Abstract base class TCollection.
UMBC GDC Programming Tutorial
Values vs. References Lecture 13.
Game Architecture Rabin is a good overview of everything to do with Games A lot of these slides come from the 1st edition CS 4455.
By Muhammad Waris Zargar
The Basics: HTML5, Drawing, and Source Code Organization
TerraForm3D Plasma Works 3D Engine & USGS Terrain Modeler
Array Lists Chapter 6 Section 6.1 to 6.3
Memory Allocation CS 217.
CS179G, Project In Computer Science
Polymorphism Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
2.3. Architectural Design I
Games Development 2 Entity / Architecture Review
Presentation transcript:

GAM 200 Club

How to Game Engine GAM 200 Club Zachary Nawar

DISCLAIMER There are many methods and ways of going about and creating a Game Engine, this is a very simple yet useful method for starting to build your engine

Step 1: Object Architecture Inheritance based VS Component based Very generic base object Each object inherits Tons of abstract objects Simple and easy UE3 is a great example One object class Components add logic Faster iteration More complicated to do

Step 2: Object Management Decide on what method to use for object management: > Single Game Space Each object exists in the same “space” or collection of objects > Multiple Game Spaces Multiple “spaces” which contain their own sets of objects

Now to build our Engine I build from small to large

When declaring and defining your functions imagine what you want the end user (Your team) to experience when they try to do things in your engine

Engine / Game Space / Game Object

Step 3: The (Base) Component Base Component has very basic stuff! Constructor / Destructor Initialize / Update / Remove functions ptr to the owning Space (optional) ptr to the owning Object TypeID (enum, int, const char*, you choose!) Keep it simple, clean, and virtual Real components inherit from this

Step 4: The Game Object What put inside? Constructor / Destructor Initialize / AddComponent / GetComponent / Update / Remove functions Array of Component pointers Global ID (?) More complicated things* Object Parenting info Archetype names

Step 5: The Game Space Think of it as an object manager Constructor / Destructor Update function Array of Objects pointers Other helper functions Cleanup, Clear, AddObject

Step 6: The Engine Core The core of your entire engine Home to your Init, AddSystem, Loop, Shutdown No need to implement these just yet Stores all of your Game Spaces Array of pre-allocated spaces? Array of pointers? Pointer to additional Systems Make a global pointer to your Core

We have now achieved our desired structure

Step 7: The “Object Factory” We need a way to make Objects! Our “Object Factory” does exactly this Could be a class full of static functions Just have the first parameter take a GameSpace* CreateObject() Allocates space for an object Adds object to game space Returns the new object

Step 7.1: Serialization The Factory is a great place to load objects Allocate object Load file File says what components to add to object File says what to set variables in components to Add object to game space Return the object (No need to really) Data driven! yay! CS225 should cover JSON serialization Also could be covered in future presentation

Making Objects in C++

Step 8: Engine Systems Currently all we have is an object engine We should add features to our engine! Graphics, Physics, Audio, GameLogic I call these “Systems” or “Modules” Expand and provide functionality to the engine Makes our Game Engine capable of running games

Step 8.1: Base Engine System This is the base/generic system Constructor / Destructor Init / Update / Shutdown functions Name (optional) Remember to keep it virtual Every system we add (Graphics, Physics…) inherits from this basic system

Step 8 Example Graphics System SetTransform(MATRIX33 m) // Sets matrix to use when drawing SetDrawMode(DMODE_ENUM dm) // Sets draw mode SetTexture(D3DTexture tex) // Sets the texture to draw DrawSprite() // Draws a sprite using transform, drawmode, texture StartFrame() // Starts a frame EndFrame() // Ends the current frame, swaps buffers Update() // Iterate through spaces/objects/components call Draw if we can?

Step 9: Back to the Engine Core Implement those engine functions! AddSystems Initialize Loop

Step 9.1: AddSystem void Core::AddSystem(ISystem* sys) Responsible for adding a system pointer into the Engine Core list of systems Push pointer into back of system pointer array/vector

Step 9.2: Init void Core::Init(void) Responsible for Initializing all engine systems Iterate through each System in array of Systems Call Init function

Step 9.3: Loop / MainLoop / Update void Core::Loop(void) Responsible for keeping the game running, the game loop ●While RUNNING ○ If Framerate controller says go ■ Iterate through systems in systems list ●Call Update function

Something that’s missing: GameLogic GameLogic can/should be a system too Iterates through all game spaces Update Game Space Iterate through all Objects Update Object Iterate through all Components Update Component This method is simple and works

Invoking our Engine 1.Create Engine Core 2.Create and add engine systems 3.Initialize Engine Core 4.Load a game level or something 5.Call Loop function 6.Call Shutdown function 7.Exit program

Things to work on next: Handle manager Messaging (Hooks, Events, ect.) Cache friendly memory management Archetypes Saving and Loading levels Introspection and Serialization Scripting languages