ParaToxic Posted February 11, 2012 Share Posted February 11, 2012 Hello Guys,I have a question about the current Engine Designs. I try to write a little DirectX 11 Engine(only for HLSL learning) and want to make a good Design for the programming. My first idea was to make a Header named engine.h with the includings for following classes. And create a new class named Direct3DInit ,where the device,swapchain,context....are defined(initialize). Than I can add the other classes with (Direct3DInit : public Direct3DTriangle,public Direct3DModel ...) But the problem was ,that I need the device in the other classes ,so I won't work. My 2nd idea was to make a file engine.h ,where all commands are defined in "Containers" and for each Segment of commands I include the cpp file for make the functions.For example: /////////////////Renderer//////////////////// void Render(); void ..... include "Renderer.cpp" //In that file are the functions for Render()... But so I haven't got classes and I think it's not a good design or "framework" I would like to write something like IEngine Engine = Initialize(); Can somebody present me a Engine Design or Framework Design ?? Thanks Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 11, 2012 Share Posted February 11, 2012 ..what kind of engine is that in terms of rendering design, deferred or forward renderer? Quote Link to comment Share on other sites More sharing options...
ParaToxic Posted February 11, 2012 Author Share Posted February 11, 2012 I don't know I think it's deferred rendering.The point ist how to design the classes or the context of the classes ,that I can't expand it. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 11, 2012 Share Posted February 11, 2012 ..okay..if you interested i could share some experience since im near to complete my very own engine (not entirely as i use some parts of Phyre library)..but before any serious attempt, I highly recommend some straight to the point tutorials and provided documentation. So here is extremely helpful informations, with source code and everything you need to get it up and running, and I found it very helpful. http://www.garrywill...erred-rendering Also, here is complete deferred renderer written in C# (XNA) and it can compile on PC and XBOX 360 (tested/builted myself for sake of learning things). Full step by step building, with descriptions, etc etc. I do not have exact link anymore so i have uploaded PDF file for you and i hope it will help. I know it did 'miracles' for me. Its fully functional, and it works , and you will have all understanding over expansion if you need it. You may not be happy with language (C#) or platform (XNA), but you will learn for sure how everything works and how it has to be structured. Enjoy, I know i did . http://www.crocko.co...4E/F17D6d01.pdf Quote Link to comment Share on other sites More sharing options...
ParaToxic Posted February 11, 2012 Author Share Posted February 11, 2012 Good documentation.So I made a little overview of the design. Tell me if it's good Quote Link to comment Share on other sites More sharing options...
Josh Posted February 11, 2012 Share Posted February 11, 2012 I make a GraphicsDriver class, and there is a global "current" instance: GraphicsDriver::GetCurrent() All created objects store the current graphics driver at the time they are created, in their constructor: Material::Material() { this->graphicsdriver = GraphicsDriver::GetCurrent(); } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ParaToxic Posted February 11, 2012 Author Share Posted February 11, 2012 So I make only one file ,where all classes and objects are included and for example define in all classes the device and get it with Direct3DInit::GetDevice() or something like that? Quote Link to comment Share on other sites More sharing options...
Brent Taylor Posted February 11, 2012 Share Posted February 11, 2012 I'm going to give the best advice ever. Make games, not engines. No matter how much planning you put into this, until you have a number of games under your belt you just simply won't have the experience necessary to design an extensible engine for practical use. You just won't know what you need from an engine. Also, I'd highly recommend brushing up on design patterns an OO Design. Right now it looks like you're still in your "C with Classes" stage of learning C++. I'd recommend these two books: Code Complete Design Patterns And for good measure, The Pragmatic Programmer Recommended reading for ANY developer. Rockstar or beginner. Quote There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?" Let's make things happen. Link to comment Share on other sites More sharing options...
ParaToxic Posted February 11, 2012 Author Share Posted February 11, 2012 Thanks a good advice:D I made a few little games for learning but the point is that I want to work in a company with an engine which is written in DirectX and I want to collect experiences with that stuff. My idea is not to make a engine ,more a little framework to work with shaders and so stuff.I want it in classesn,because I saw a few engines like irrlicht and soone ,which are made with classes ,OO. I think the OO design is the most important for a good functionality.Just one moree question:D When I have lots of classes for the shader,materials.... and they need for example sometimes the created device,swapchain,context,buffers.. from d3d.How can I create them global? The best way would be to have a class like direct3dinit or something like that with the device,swapchain... in it ,but that all classes could use that.Is that possible? (Very good books ,thanks ) Quote Link to comment Share on other sites More sharing options...
Brent Taylor Posted February 11, 2012 Share Posted February 11, 2012 When I have lots of classes for the shader,materials.... and they need for example sometimes the created device,swapchain,context,buffers.. from d3d.How can I create them global? The best way would be to have a class like direct3dinit or something like that with the device,swapchain... in it ,but that all classes could use that.Is that possible? Again, I'd look into design patterns an OO Design. I'm not sure you're really grasping the difference between an object (class) and a function or a method. In addition, as I said before, make games not engines. It's pretty clear you don't know what you need yet. I understand you're trying to get a job working with DirectX. You don't need to write a game engine to do that. In fact the chances of you actually working at that low a level are extremely slim. As a developer, all of that will be abstracted away from you. If you still want the experience, make a game with DirectX, not an engine. You'll get the same experience, except you might actually learn something and finish a project. There are no shortcuts when it comes to game development, only setbacks. Quote There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?" Let's make things happen. Link to comment Share on other sites More sharing options...
ParaToxic Posted February 11, 2012 Author Share Posted February 11, 2012 In addition, as I said before, make games not engines I wont First I am just 15 years old ,and 2nd I don't want to make an engine.I will learn something about directX 11 and the current techniques,for example make first a simple application to include shaders and work with shaders to learn more about HLSL. The point is that I made a kind of engine before,but with DirectX 9 because I had a very good german book about it Thanks for the links I going to read it,but my english knowledges don't make it easier EDIT: I spoke about the book for DirectX 9 Game programming.In this book is a engine included(developed each chapter) and I see that this engine is made with OOP and I saw in few files,that it use Singleton for getting Device,... In the Direct3D class is an instance : "static tbDirect3D& Instance();" and the function for example "PDIRECT3DDEVICE9 GetDevice() {return m_pD3DDevice;}" . In the other files you type (here the class named tbDirect3D) ...tbDirect3D::Instance().GetDevice(). I think I will make it the same way Thanks for the support Quote Link to comment Share on other sites More sharing options...
LordHippo Posted February 12, 2012 Share Posted February 12, 2012 If you just want to experiment with shaders, I highly recommend FX Composer or RenderMonkey. Also if you want to do more DirectX work, you can use something like Ogre which is a good render engine to test your ideas on. Quote Ali Salehi | Programmer Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64 LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17 Link to comment Share on other sites More sharing options...
ParaToxic Posted February 12, 2012 Author Share Posted February 12, 2012 One question about singleton.I have one singleton class where I create the device the vertex/index buffer,swapchain.... and a other class named CShader.In CShader I need a pointer to the VertexBuffer and the InputLayout(for vertex shader). When I write &CDirect3D::Instance().GetVertexBuffer it tell me that it isn't a Ivalue ,so I made it like that: ID3D11Buffer* VertexBuffer = CDirect3D::Instance().GetVertexBuffer(); And than in the function &VertexBuffer Is there a risk for data lost or something like that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.