Today: Inheritance and types of objects So we have have different behaviour Let's think about base classes and such a minute An example: What do an NPC, a floor, a health pack, and a bush have in common? They have to be drawn in a location Can we walk through the bush? How about an invisible item? Kinda uncommon We could override draw with a method that doesn't draw Or have an invisible flag So what's common enough to be in the base class? draw list of instance locations init procedure We should be able to publish instructions for object authors Make it easy for people to make games with our engine Some semesters I've ended up too complicated Inheritance diamond problem Usually because this wasn't thought out enough Better this year? Usually we've included model-less objects and custom shaders I'd like to support non-generic shaders At the same time, a flexible default shader would be nice Object recycling: Do we really need to load multiple copies of models, textures, etc? Not really But what if we apply an input scale? As long as we agree on loading parameters, we're ok We can map filenames to OpenGL identifiers Fail to load: It'll save us a lot of time over the semester if we get this right If a resource fails to load: Print out an appropriate message Stop trying to load things and shut the engine down Organization detail #2: Files! We need a "main" header Might want headers for specific objects .cpp for the main part of the engine (loops, callbacks, etc) New game objects are either a .h and .cpp, or just a .h Depends on complexity These must be added to the build process! How about on Visual Studio? Alright, let's see if we can do it: A floor Some objects on the floor Lab: If we get there, a hole in the floor Static floor height Jumping