3D Engine architecture

Started by
8 comments, last by Radikalizm 11 years, 8 months ago
Hey ya, this is my first post here and I have a question.

I'am building a 3D Engine with DirectX in C++ and made some designs the last days, so I started to create some classes and Init the whole Engine in Visual Studio.

Now I have a question.Are there books or articles for some information about the modern game engine architecture like CryEngine 3 or something else ??? I mean things like , how to create Modules like the Renderer,Data Manager.... and how to make a good class design for all that you can make a OO design ( I know things like Singleton and that pattern stuff ) and soone.

My second question is ,how to pack the Gameengine into a DLL.Yesterday I made this Solution in Visual Studio and made the first modules and a global Engine Manager which contains all that stuff and includes all Modules, and has also a macro with __declspec(dllexport) to add this to all classes and soone to be included in the DLL.So I made a Frame class for the mainwindow and compiled all that stuff,created a testing solution and everything works fine, but my question is what options I have to export the Engine.

I could make it in 1 DLL for all the Engine , I think the easiest way.Or I make for each Module a DLL like in the CryEngine (I think this is good when you for example don't need physics it doesn't load all the stuff and you have more performance)

.....

Would be nice when somebody could help me.Just for the guys who write that I can't write an Engine--> This is just a try to get some experiences in this area and my target now is to make a Renderer and a model class to load models/meshes (maybe with hardware skinned animations ;)) and learn to implement a shader pipeline for postprocessing effects. That's becaus I want to work in Crytek ;)

Thanks
Advertisement
Yes, me too, i want to make my own game engine.Mine will be with SDL and OpenGL in C.Now, if i want, i can use them to draw nice 3D/2D graphics but i still haven't got enough knowledge about them for advanced drawing so i must learn things more than them.At the moment, i am working on sound system.So far i tried a function to load and play a sound file(.wav) from a folder.I am very happy now becuse it played !
When it comes to engine programming there's one simple rule to follow: If you have to ask someone how to build an engine, you're absolutely not ready to build one

Engines are really complex beasts, you're even making a reference to CryEngine 3 which I hope you realize was developed over the course of a few years by a team of industry professionals with years of experience

You'll barely gain any experience from writing an engine, saying that you want to tackle a huge project like an engine just because you want to learn is like saying that you're going to learn architecture by designing and building a skyscraper somewhere, it just doesn't work.

If you really want to end up with an engine you should write games, and a lot of them. You'll be able to distill reusable parts from each game you write which will eventually give you a nice set of tools which can function as an engine.

I gets all your texture budgets!

Thanks for the answers ;)
Look my question was only the package of the engine, so how to pack it (in 1 DLL or for each Module one).
I made some games with a Engine (I'am working on a community project with around 20 people ).
I isn't very right what you say, because I have a architecture planed for the engine and looked to some open source engines before .... so my Question is that one with the DLLs

Okey it wasn't really good to make references to the CryEngine ,but I don't know how to explain it with an other way smile.png

PS: Look my idea was to learn a little bit more about DirectX and build some Modules for Worlds,models,shders,...... so I make a "3D Engine" (just call it so) to pack that stuff together.Maybe I can make a little "Engine" for some test (mainly for shaders and post processing,thats what I wan't to make)

Thanks
There's probably not a "better" way. It really depends on your needs. (I know that answer doesn't help). So, let's take some very well known examples.

Most games from Id Software: Engine - EXE Game Code - DLL
Source last time I looked: Engine - Many many DLLs (engine dll + many library dlls it uses) Game Code - Another DLL (exe ties it all together) or an EXE
Many successful indie games: Engine - EXE Game Code - Also in the EXE

As you can see there's no better way in a generic sense. Each had their reasons for doing it their way.

So for your first go at this, honestly, it'd probably be better to put your game in an exe and put your generic code (engine) in a dll. And even this would only be to force you to think of them separately to encourage reuse. As long as they're separated, repackaging in various forms won't be hard.

[size=2](Yes - I know the common advice is "just make your game" and then when you make your next game, pull out reusable stuff. IMHO that makes it harder because you probably did not design it to be reusable and it can sometimes be a huge refactoring task. Better to just design them this way from the beginning, because it forces you to think of things in a way that also makes all your code that much more maintainable and understandable).
Thank you.
Well, there are obviously books about the subject, one in particular sharing the same title as your post. But, think of what a program is. It is functions and variables (or at least in a procedural language) being constantly manipulated and defined. A game will take data such as geometry and UV coordinates, audio data, input, network packets, miscellaneous files, and a TON of other things and combine them into your familiar game in a few milliseconds. Figure out how to do that and you are set to go (that was sarcastic, I'm not an idiot).

EDIT: Also, don't go with C++ and DX. That is definitely pushing it for a person who is doing it alone, not getting help with it, and has no experience. Try C and OpenGL, as there is a shallower learning curve and also less required brain power (I am NOT calling you stupid, by the way, but C++ and especially DX will give you migraines and internal neuro-bleeding)

C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.


Well, there are obviously books about the subject, one in particular sharing the same title as your post. But, think of what a program is. It is functions and variables (or at least in a procedural language) being constantly manipulated and defined. A game will take data such as geometry and UV coordinates, audio data, input, network packets, miscellaneous files, and a TON of other things and combine them into your familiar game in a few milliseconds. Figure out how to do that and you are set to go (that was sarcastic, I'm not an idiot).

EDIT: Also, don't go with C++ and DX. That is definitely pushing it for a person who is doing it alone, not getting help with it, and has no experience. Try C and OpenGL, as there is a shallower learning curve and also less required brain power (I am NOT calling you stupid, by the way, but C++ and especially DX will give you migraines and internal neuro-bleeding)


You're obviously biased.
There are enough programmers who prefer DirectX over OpenGL, and the latest iterations of DX (being 10 and 11) have a very clean and straightforward API with a robust set of features.
Please try to keep the information you provide objective, nobody will benefit from horribly biased posts.

I gets all your texture budgets!

There are enough programmers who prefer DirectX over OpenGL, and the latest iterations of DX (being 10 and 11) have a very clean and straightforward API with a robust set of features.

I must say that MrJoshL does have a point, the DirectX API pretends to be C++, but in fact is more like C with classes. It's not const correct, bloated with unneeded pointers and uses global functions where C++ APIs would use static class functions. If you call that a clean API, I'm afraid your own post is kind of biased as well.

However, when choosing a third party API, it's not always possible to pick a clean API, as not always one is available that meets the requirements. In the case of DirectX or OpenGL, the choice is between a C++ API that uses classes in an bad way, or a C API that doesn't use classes at all. So if you want to use clean object oriented classes in your engine, you have to make your own wrapper, or use a higher level API that abstracts DirectX or OpenGL. So in that perspective, it doesn't really matter. I just strongly recommend against using DirectX if you are new to C++, because if you learn C++ by working with dirty APIs, you learn it the wrong way.

[quote name='Radikalizm' timestamp='1344677865' post='4968363']There are enough programmers who prefer DirectX over OpenGL, and the latest iterations of DX (being 10 and 11) have a very clean and straightforward API with a robust set of features.

I must say that MrJoshL does have a point, the DirectX API pretends to be C++, but in fact is more like C with classes. It's not const correct, bloated with unneeded pointers and uses global functions where C++ APIs would use static class functions. If you call that a clean API, I'm afraid your own post is kind of biased as well.

However, when choosing a third party API, it's not always possible to pick a clean API, as not always one is available that meets the requirements. In the case of DirectX or OpenGL, the choice is between a C++ API that uses classes in an bad way, or a C API that doesn't use classes at all. So if you want to use clean object oriented classes in your engine, you have to make your own wrapper, or use a higher level API that abstracts DirectX or OpenGL. So in that perspective, it doesn't really matter. I just strongly recommend against using DirectX if you are new to C++, because if you learn C++ by working with dirty APIs, you learn it the wrong way.
[/quote]

Sure, DirectX has its flaws, I totally agree with you on that, but in my experience there is no real ambiguity in the API and getting something up and running is a straight-forward and well-documented process. OpenGL has its flaws too, and the ARB and the interested parties don't always make the best decisions IMHO.

I want to clearly note that I'm not a DirectX fanboy, and I'm not claiming that DirectX is superior to OpenGL. I have experience with both libraries - although I have to admit that I use DirectX more frequently these days - and I've never had any "migraines and internal neuro-bleeding" with either of them, nor have I experienced any tough learning curves either as clear documentation is available for both of them.

Me saying his post was biased was because he directly wrote DirectX off as a completely horrible library which might be his opinion, but is absolutely not the case.
In general it's just a bad idea to start off with either library when still learning C++, and if this is the actual case with the OP he should probably stick with rendering libraries which abstract away the gritty details in favor of a more clean API.

I gets all your texture budgets!

This topic is closed to new replies.

Advertisement