   A generic application framework for DirectX possible?
  Hello all,I am writing a paper on DirectX 8 and, in particular, DirectX Graphics for a course in Software Paradigms. An important part of my paper is analyzing the common files framework that the SDK provides for us.I realize that the framework is nowhere near what a game engine would be, but do you think that a generic framework can be made for a DirectX application, with a programmer could use when making a game engine or any directX application?Thanks,Rizwan Sattar  
  Hmm... What exactly is wrong with the framework, apart from the fact that it has limited error checking and performance?  ;  I think the previous poster asumed that you have VC++. When you dowload the DXSDK, it comes with a plug in that allows you to create a framework for directx applications. Its actualy very good if you take the time to go through it line by line. Find someone with VC++ and take a look.  ;  good question. you need to consider two types of programmers here:- amature programmers (myself included). if you threw a gigantic framework that did everything i ever wanted to, i''d probably be confused if it didn''t have extensive docs (sort of like mfc). many of us want to know how things are done, and the prospect of using someone''s library that does everything for me without understanding it isn''t all that great. many programmers write their own framework before using pre-made ones because they learn how a framework works.- professional programmers working for a game company. suppose you spent lots of time and money and created such powerful framework; would you be happy to give it to your competition? probably not, even if they offered you some cash.the common files are the "lowest common denominator" and in my opinion represent a good compromise between efficiency and readability. part of trouble of making a generic framework is that it ends up being tied to your engine design; thus a different engine might require a different framework.now we need to clarify what you mean by a framework. is it just windows init code? or does it also encompass things like display mode enumeration, input buffering, mouse handling? if it''s the latter, then framework actually becomes a "base engine". and if you look at the common files again, you can say that it is an already working small engine. is it possible to have a generic game engine? i don''t think so.  ;  DXSDK comes with a couple of files that act as a simple "framework" for D3D apps. The skeleton app initializes graphics objects, performs the render loop, and handles events all in a neat extensible class. Look for d3dapp.cpp.;  As mentioned above there is a "basic" framework, but as for an all-encompassing framework I do not see it happening.  In business applications, you generally have a bottleneck somewhere other than your application... network traffic, hard drive access, database access, whatever.  So you can abstract things through object oriented design.  Although you (theoretically) lose some performance you gain scalability and the performance loss is rarely actually realized because of the bottlenecks mentioned above.Now we come to game development.  The name of the game (no pun intended) in game development is efficiency.  You must squeeze every ounce of performance out of the end user''s machine.  If you abstract everything out too far via a framework it may work, but it works using techniques that were designed with a "make this work for everything that could ever potentially be thrown at it" mentality.   An experienced developer will look at the features that will be implemented, the types of models used, etc.  He/she may give up a level of complexity for a part of their scene that is rarely looked at so that they can add an additional lighting effect to a central piece of the game such as the main character''s weapon.  I think there will always be a low-level framework shipped with any major graphics library such as DirectX or OpenGL.  And I believe that most game authors will extend that framework into a larger proprietary framework.  But I would venture to say that when that same author gets ready to write his/her next creation they will copy that code and optimize if for their new game''s needs rather than abstract new classes.    Larry Johnson - Head flunky in charge of diddly-squat.www.sillisoft.com;  Hello all,thanks for the replies, they are truly insightful. Here are some responses to the posts, particularly towards niyaw:Amateur Programmers - I can understand how daunting it can be to learn a new framework. I tried learning MFC and couldnt'' get around it, and eventually gave up! But after encountering Java''s Swing API and JFC, I feel that a framework, while initially scary, can be a powerful tool for programming.Professional Programmers - I totally agree with the idea that if you are going to work hard to make something (like a framework or base engine), then you shouldn''t just give it away if you feel that it is bad for competition. However, what if Microsoft were to create the framework? After all, DirectX IS their''s, right?I think that it is possible to create a "base engine" which encompasses most, if not all the DirectX components, and contains convenience functions for doing many things (a sort of D3DX and Common files mixture, but on steroids!). Coming from a non game programming point of view, I also believe that a framework for directX can be created which is more object based and still be efficient. Perhaps this IS what professional game programmers do, but I''m not sure.I''d appreciate any comments you guys haveregards,Riz  ;  The problem with microsoft making a framework is that not only is nobody obligated to use it, there are people who like to do things a lot differently than everyone else. I have a framework that I''ve made that I use for nearly every DirectX project I do, whether it''s 2D or 3D. It handles all mouse, keyboard, and joystick input. It also can switch from full screen to windowed mode at anytime you like at the touch of a button. At the same time, it will reload all of the resources that it needs to in order to make that switch possible.There is a bitmap font engine that can be used in either 2D or 3D games, and a debugging class that I can use when in full screen mode to display any data I want on the screen and it just scrolls off the screen when it''s done.It''s possible to make one, but it takes a lot of work to do correctly. As someone else mentioned, if I wanted to write a game in OpenGL, I''d have to rip out all of the D3D initializations. That would get ugly.I''m not a big fan of the way that Microsoft does a lot of their code. It''s readable, but I don''t care for it. So, if they came out with a framework at this point, I would probably just keep my own.    Looking for an honest video game publisher? Visit www.gamethoughts.com;  Thanks for the reply mtaber,I was wondering if programmers were out there were making their own personalized frameworks for game development. I think that''s something that''s not often mentioned on game programming books and articles. I think a great topic for an article would be discussing "put it all together" in an object oriented fashion. For the framework that you made, did you base it on the Common files framework, and if not, how similar is your framework to that, architecturally speaking?Thanks for your insights,riz  