tailieunhanh - Object oriented Game Development -P6

Object oriented Game Development -P6: There’s a better than 50% chance that you have picked this title off the shelf in a bookshop and are wondering if it’s going to be another one of those ‘secrets of the inner circle’ type of titles. You know, the ones that promise to tell you unspoken truths on how to write really cool games but in reality offer up a rehash of a manual you may already have for free anyway. | 136 Object-oriented game development - for example line-of-sight calculations might refer to the portals the graphics system uses to prune visible data. Now what that means in practice is that I cannot use one part of the game engine - the NPC AI - without taking another - the environmental system. Now what s the betting that the environment system comes with strings too Perhaps the rendering API Too bad that our game already has a renderer. This is our dependency demon from previous chapters rearing its ugly horned head again. This time it s busy gobbling precious RAM and making life more complex than it needs to be. This is illustrated beautifully in Figure . This isn t just a matter of losing memory though. If the engine gains ownership of system hardware then your objects can be locked out. And the reverse is true of course the game engine may fail because you have allocated a resource that it needs even if that resource is in a part of the engine you do not use. If you have the luxury of being able to modify engine code then you may be able to fix this problem. However this is frequently not the case. For these reasons it is really very difficult to write a game engine to please most of the people most of the time. The best engines are limited in scope firstperson shooter engines extreme sports engines and so on. Which is fine if your company is continually churning out the same sort of game over the course of several years but the moment you diversify it s back to the drawing board for a new game engine. The alternative We really really really want to take a big hammer to the idea of an engine and break down the monolith into a series of components. The ideal is to turn the relationships in Figure into those shown in Figure . The first big change is as promised that we ve hit the engine with our hammer and broken it down into two packages one for rendering one for AI. There is no logical or physical connection between these packages and why .