Sign in to follow this  
BoReDoM_Inc

Game Engine Architecture

Recommended Posts

There is a distinct lack of articles and documentation out there on how game engines are all pieced together. There are plenty that will say things like the client and server plug into the kernel etc. But I have been unable to find any complete documents about how everything is integrated in detail, eg. how all the object instances are kept in a list (or vector) and about what classes are daughter classes of others etc. I have made games before but none of which are truely game engines because to make a different game the source code must have been touched at least a small amount. I'm looking for an article that tells you how to make a complete engine (any genre i don't care) but will tell me how to integrate everything correctly. Questions I would like answered are how to correctly integrate the renderer, and whether it is right to make two classes one called CPlayer which is just input functions that will control certain instances and a CAIPlayer etc. and how this is all integrated. The only article I did find which started on this road is the enginuity series which is incomplete and the arthur now says that if he did it again he would do things slightly different. Any help would be appreciated, thanks.

Share this post


Link to post
Share on other sites
What type of game engine are you speaking of 2D and 3D Game Engine Architectures are slightly differen't. One book id consider you looking at is this or this.

Its on 3D game enigne architecture (the first one) the second is on game engine design. Sounds like exactly what you want.

Share this post


Link to post
Share on other sites
Well I'll say a 3D FPS shooter one that incorporates networking. It's not neccessarily a 3D FPS that I'm looking to make, however FPSs contains basically a combination of the features that all other genres have.
I'm quite interested in advneture games and I've already started on an engine but so far it's been basically impossible to find information on that as the gaming industry at the moment is focusing on 3D RPGs and FPSs, as much as I enjoy these games it's also a bit of a shame that there isn't as big a variety of game genres as there could be.

PS. Mhondoz I mentioned the enginuity series in my orginal post and explained that I did not want to use them because they are incomplete, though they are quite informative.

Share this post


Link to post
Share on other sites
The main reason why you haven't seen specific tutorials is that there is no "correct way to integrate the renderer, and whether it is right to make two classes one called CPlayer which is just input functions that will control certain instances and a CAIPlayer etc. and how this is all integrated."

I've looked at some of the free engines, and I've got my own, and I've seen the inhouse one my company uses and all of them do it differently. No one can say "yes its correct todo A" because there is no correct. If it works and does what you like then yay, if its slow and doesn't work then boo but thats as a definition as you'll get.

And another reason is that it takes alot of work to just write a game engine to writing a tutorial on it is more than most people can be bothered todo.

If you've written a few games then the best thing you can do is see what you used in each one, and try to extract those out into seperate parts so they can be used in any project. Get an image loader, sound loader, ai system extracted and you've got a game engine - thats pretty much how I got mine.

Share this post


Link to post
Share on other sites
kaysik I realise this but I still don't think I'm experienced enough I have tried mixing all that I know into a single engine but I don't know enough specifically about the renderer. The best idea I've come up with is looking at open source engines like Quake 1 and 2, Crystal Space, Irrlicht etc.

Share this post


Link to post
Share on other sites
Are you writing a software engine? Because unless you are I'm not really sure what you mean by your renderer. For 3D stuff you just have a mesh class/manager which loads models and draws them and its your graphics API which actually does the rendering. Personally I have a mesh manager which loads a mesh and then returns an ID. To render a loaded mesh just pass the manager the ID and it draws it - very simple and easy to use. If I want to add something fancy (ie. cell shading) I just change the render() function of my mesh manager and all is well.

I think most people make games engines out to be these huge complicated things. You can make one like that if you like, and the full profeshinal ones probably are, but you can make simple ones pretty easily. Just think about what you'll need in each game, design a few classes so that they can be reused for lots of different purposes and your set.

Share this post


Link to post
Share on other sites
My problem is I don't know what are core things and what are not, and how to make things like inventory and weapons systems very well. And generally in a game engine there is a part called a renderer, the camera is a part of this and when you draw the scence this is the renderer. Basically objects are passed to the renderer it organises how they will be drawn using an APIs functions, eg. OpenGL :) then OpenGL sends them off to the video card.
As you can see I've done a lot of reading just I'm not sure how to code these sort of things.

Share this post


Link to post
Share on other sites
Quote:
Original post by BoReDoM_Inc
and how to make things like inventory and weapons systems very well.

Those things you listed are completely game specific and are not part of an engine actually :)

Share this post


Link to post
Share on other sites
Saruman, isn't the different objects that go in the inventory and weapon types game specific and there is still an inventory system which organises these things and perhaps loads the different weapon an object types out of files?

Share this post


Link to post
Share on other sites
I have also found the lack of information out there very frustrating. I can recomend a few good articles on object or entity systems, in the book serious Game Programming Gems 2, 3, and 5. I sure that the others have some good articles about components of an engine, but I havn't got my hands on them yet! But an occuring them seems to be an object system, and an engine that is data driven. I have created a very simplified object system for some of my programs. It consists of a GameManager, ObjectManager, ResourceManager, SimulationManager, RenderManager,and InputManager. You may say what's up with all the Managers, but It makes good sense to me. I use the lists throughout the code to keep track of each "object" within the current scene. I have also tried to make it a bit data drivin with some simple stdio.h file reading to get info about the objects to create.

For example the ObjectManager will open a script file that has the nubmer of objects to create and variuos variables for my given project like X file names, Bounding sphere dimensions, if the object is static or dynamic.

So my GameManager is coordianting all of this by the way. After the ObjectManager creates the objects it returns a list that list is then passed to the ResourceManager. This is where all my meshes are loaded. This manager also keeps track of validity
of the resource, in DX terms has the device been lost or destroyed, etc.

On certain Physical systems simulations I have then passed the list to the SimulationManager that runs a simulation on objects that are flaged as dynamic, although at this point it has only been one object. I haven't quit got to incorperating different simulation code into my engine. Although this may be trival to hard code in I would like to find a solution to dynamically load simulation code for different physical simulated objects within different "scenes" or "levels".

It realy seems like ya just got to get all the knowledge that you can start to code this guy up with some functionality in mind and then when it breaks start again with the break in mind.

One area that I am not sure about is communication between components. I havn't found much out there about that, but one book that keeps poping up about a lot of this stuff is

Design Patterns: Elements of Reusable Object-oriented Software by Erich Gamma

Numerious articles I have read in the Gems have referenced this book. (my girlfriend is picking it up for me at the library as I type, or perhaps sometime today before she comes home)

Share this post


Link to post
Share on other sites
Quote:
Original post by BoReDoM_Inc
Saruman, isn't the different objects that go in the inventory and weapon types game specific and there is still an inventory system which organises these things and perhaps loads the different weapon an object types out of files?

Nope those are game specific actions / logic. You wouldn't find anything like that in a normal game engine as it is part of the game itself.

If you want to seriously learn game engine design and architecture I would recommend that you pick up David Eberlys books along with going through the code of existing engines such as Ogre, Irricht, etc.

Share this post


Link to post
Share on other sites
I'm also very intressted about finding more information on this.

I would also know more about how professional engines manages or works with DLL conponents and how they share data between exe and DLL. And also how the engine should work with a client and server (not only for networking) design... Like if you host and play on the same computer, what would the communication be? should there be totaly diffrent applications for the client and server and how would they both have access to the resources (cause i guess the server will need it for validating things and client will need it to render).

So if anyone have any good information regarding this, please share.

\\ Xeta

[Edited by - Xeta on July 4, 2005 4:38:03 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Xeta
I would also know more about how professional engines manages or works with DLL conponents and how they share data between exe and DLL. And also how the engine should work with a client and server (not only for networking) design... Like if you host and play on the same computer, what would the communication be? should there be totaly diffrent applications for the client and server and how would they both have access to the resources (cause i guess the server will need it for validating things and client will need it to render).

So if anyone have any good information regarding this, please share.

\\ Xeta

Pick up Game Engine Architecture by David Eberly, as he was a lead architect on NDLs NetImmerse/GameBryo engine that powers games such as Morrowind, Dark Age of Camelot, etc. He knows what he's writing about :) He is also PhD in Math and CS.

Share this post


Link to post
Share on other sites
Just read the review for the above book it seems like it might be a good book about the enginering aspect of game engine design. I just wanted to drop off a few links to some list of game engines. Some of these are free with source. So I figured that that might be a good place to start don't know why I didn't think of it before http://www.devmaster.net/engines/ http://www.cyberloonies.com/game-engines.html

Hope these might hlep some people, i'm just going to sit down and study the source code

Share this post


Link to post
Share on other sites
Sorry to slightly hijack this thread, but I've been stuck on the same problem; I've been designing and redesigning my latest game engine for ages (and not getting to the coding part) as I've not got a good idea about what's good and what's not. I'd really like my engine to be well designed to save time later.

Anyway, thanks for the book tip Saruman and DevLiquidKnight, I've read the table of contents on amazon and it looks pretty good. Are the other books by David Eberly worth picking up?

Share this post


Link to post
Share on other sites
Quote:
Original post by Saruman
Quote:
Original post by Xeta
I would also know more about how professional engines manages or works with DLL conponents and how they share data between exe and DLL. And also how the engine should work with a client and server (not only for networking) design... Like if you host and play on the same computer, what would the communication be? should there be totaly diffrent applications for the client and server and how would they both have access to the resources (cause i guess the server will need it for validating things and client will need it to render).

So if anyone have any good information regarding this, please share.

\\ Xeta

Pick up Game Engine Architecture by David Eberly, as he was a lead architect on NDLs NetImmerse/GameBryo engine that powers games such as Morrowind, Dark Age of Camelot, etc. He knows what he's writing about :) He is also PhD in Math and CS.


I actually got this book a couple of weeks ago and I agree its very good. Although it doesnt really get into client-server situations or how to implement the game logics with the rest of the egine (rules, AI, etc... ).

One other thing i cant really understand is how some engines (like the Halflife engine) has a completly diffrent DLL file for the game logics etc, while the rendering engine is in the exe file... how does the DLL file manage to use the rendering functions? wouldn't it need the exe´s header files to use them or something? ´The game launches in the exe file and then manages to use the code in the DLL file for game logics without even knowing whats there (well this is probably really wrong but i am very confused about how this works).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I'm not sure you will ever find an adequate tutorial on how to piece a game engine together. and if you did im not sure you'd want to pay it any mind. the best route on something like that is to develop your technique on the small pieces of a project and put them together as you go. all systems are different, all pieces of your puzzle are different from someone elses, so you can't really take a grand scheme from something like that.

one of my favorite quotes for game dev is paraphrased "your first 5 games are goign to suck, just do them and get the out of the way"

you will learn more by solving this problem repetitively than by reading theory on it.

if you are having problems abstracting your game code from your engine code, maybe take a project you've already done and code another game parallel. for instance i've made a platformer where you jump around on other peoples heads. a good parallel would be a figher ala super smash melee brothers. practice will teach you how to abstract engine from the game.

just start small :)

Share this post


Link to post
Share on other sites
Quote:
Original post by DevLiquidKnight
What type of game engine are you speaking of 2D and 3D Game Engine Architectures are slightly differen't. One book id consider you looking at is this or this.

Its on 3D game enigne architecture (the first one) the second is on game engine design. Sounds like exactly what you want.


I just want to point out that "3D Game Engine Design" by Eberly is poorly named. The book is about implementation details, not design. It is devoted almost entirely to 3D math/geometry. I haven't read "3D Game Engine Architecture", so I don't know what it's like.

Share this post


Link to post
Share on other sites
3D Game engine architecture is very good, but don't expect a tutorial. It's not going to tell you how to architect the engine from beginning to end, rather it goes over each section of the engine, covers it in detail, and moves on. You wont even get to sections that describe the application class system that is used to interface with the library until 80% through the book.

Anyhow, check out games like quake3 and half-life2 that have sdk's released. You can clearly see where the engine begins and the game / game logic begins and how they organized it.

For example, in half life 2 there is a main function that is called by the exe to tell the server.dll and client.dll to startup. It passes a pointer to a factory pattern class (see Object Oriented patterns by the gang of four) where the client can say myRenderer = factory->getRenderer(). It can then call methods in the engine, in the exe by running myRenderer->DoThis().

hth! :)

Share this post


Link to post
Share on other sites
Quote:
Original post by s_p_oneil
I just want to point out that "3D Game Engine Design" by Eberly is poorly named. The book is about implementation details, not design. It is devoted almost entirely to 3D math/geometry. I haven't read "3D Game Engine Architecture", so I don't know what it's like.


I just want to point out that people need to stop complaining about the title and contents of this book. The book is about what it took to design most of NetImmerse. NDL started work on that engine in Summer 1995. I came on board in January 1996. At that time there was 3Dfx Voodoo1 hardware (add-on card), no 3D sound hardware to speak of, and networking used TCP/IP. We used the term "game engine" because back then, that's what people called the graphics engine. It was an engine for them to build the rest of the game on top of. I started writing the book in 1998 and the title was appropriate at the time for what people meant by "game engine". Only later did the term evolve to include other components that make up a game. The book was printed in September 2000. It is now five years later and too late to change the title. In fact, the second edition of the book is in the works and the title *still* will not change, but there will be some minimal discussion about how the rest of the game components fit in. You want a book that covers well all the components and earns such a title? Find someone qualified to do it all and who does not mind writing about 5000 pages of content.

And damn it, I really mean DESIGN. DESIGN of a scene graph system. DESIGN of the algorithms that the objects in the scene use. Object-oriented DESIGN for the systems you need in large libraries (RTTI, smart pointers, streaming, and so on). Like any software engineer, I spent a lot of time with other engineers on DESIGN sessions for NetImmerse.

NO, the book is not focused on implementation details. YES, the book has a lot of mathematics in it, but NO NO NO it is not devoted entirely to 3D math/geometry. Why is it that folks see a bunch of equations in a book, and then curse the book (and author)? A computer graphics book without mathematical equations is like a programming book without sample source code.

The book "3D Game Engine Architecture" is about the implementation details and the thought process that went into creating Wild Magic. I intentionally tried to avoid mathematical discussions in this book, but they still occur a little bit. You can certainly see, for example, a general framework to be able to tessellate any surface you like, but there is no discussion on special types of surfaces (B-spline, NURBS, Bezier, implicit, revolution, etc.) and how you would implement them to feed the general framework. This is where 3DGED comes in.

Look, pay attention to a lot of the posts that occur in the GameDev forums. How many questions do you see about collision, intersection, distance, physics, curves, surfaces, and similar items? If folks think they can build a 3D graphics/physics engine without seeing mathematics, good luck. It ain't gonna happen. When I see posts like "How do I compute the inertia tensor for a tetrahedron? I need a simpler description than the ones I've seen because symbols and equations confuse me.", typically followed by "my math background is not that strong", I am dismayed that those folks think that they are ready to build toy graphics and physics systems, let alone real ones.

In my experiences in academia, I found that people wanted to be trained in technical areas requiring a background in mathematics and computer science, but they were not motivated to learn that background. When games came along, and I saw how excited people were to want to write games, I got my hopes up that we finally had a medium for motivating those people to improve their math and cs skills. But those hopes have been dashed over the years because about all I hear is "I can do this without any stinking mathematics." But I guess not all is lost. As long as folks balk learning all these skills, my company will continue to thrive.

So PLEASE work for a game company on graphics/physics and DO NOT READ MY BOOKS. Contact me directly and have your purchase order ready for my company to provide you with contract programming services :)

Share this post


Link to post
Share on other sites
Dave: While you are here for this thread I would like to take the opportunity to thank you for this awesome book. I spent an hour at borders trying to decide what book to get, and basically on a whim chose yours depsite the $75 price tag and that I'm using DirectX, not OpenGL. I am confident I made the right choice. I have learned an amazing amount and I have only read maybe half of the book so far.

I'll be honest that I get a little queezy when I see long math-heavy articles, but that's where the meat is! I can't wait to improve my math skills and engine design skills enough to go through your 3D Game Engine Design book.

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this