Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Esap1

Engine Structuring Problem

This topic is 6527 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem designing my 3d Engine, if there are any tutorials on the net, please send me one thanks. My problem is that I dont know how Im going to make my engine be used in more than one program. I dont mean by putting my stuff in DLL and stuff, I mean like, how should the "Game" using my Engine set up a Render''er and Load a map, and draw the map? How should it work, I have the code to do it. But how should I enable anyone to use my engine. If someone could just show me source of using someone else''s engine, then I could problem design mine like it(like just how to call the engine''s functions). Thanks a lot for your time,

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Write a map importer.

Share this post


Link to post
Share on other sites
Do you mean a means of loading Models. I have loading functions. OK, let me refrase this.

Could someone just show me some sample source of using someone else''s engine?

Thanks,

Share this post


Link to post
Share on other sites
Esap1 -
This is a little difficult to answer because you don''t specify you''re level of programming knowledge or what language you''re working in. However, for a very simple example in C check out the 3DGPl example engine. (Just do a search on 3dgpl and you''ll find it.) For other examples in C++ look at Genesis3D, or any other free or open-source engine that provides an API. An API (Application Programming Interface) is what you are trying to provide. You will find, for example that Genesis provides a lot of documentation and examples for using their API. Other engines do as well, and you will find a lot of programming book examples that provide an API too.

Good luck.

"things are more like they are now than they ever have been"

Share this post


Link to post
Share on other sites
Ok, then
Ive been programming an OpenGL Engine in C++ for a while now. Could someone show me a REALLY simple example of using a 3d Engine, and then I can try to design mine like that, for example:

3dRender *Render;
DoSomething(Render);


I dont know, just whats a good way of using an engine you create. How do you use each system Seperatly, when some systems are Dependent.

I hope I dont sound really confusing, Ill try to refrase it

Share this post


Link to post
Share on other sites
I thinks he''s asking whether or not he should hard-code his engine to the game, or make it more modular and flexable for multiple projects.

=======================================
A man with no head is still a man.
A head with no man is plain freaky.

Share this post


Link to post
Share on other sites
Could someone show me an example of using a Modular Engine?(then I could try to write mine to work like it.)

Share this post


Link to post
Share on other sites
Look at 3dgpl. It''s very simple. It''s very modular. I suggested this about 4 messages ago.

"things are more like they are now than they ever have been"

Share this post


Link to post
Share on other sites
Hi Esap1,

Modular engines usually have C++ classes that are loaded from a dll. The advantage of this is that you can easily swap your engine with a newer version (so that bugfixes are easy to do)

Something like this:

    
// In header file:

class Renderer {
public:
// Setup display mode

void setDisplayMode(int width, int height, int bpp);

// Draw a polygon

void drawPolygon(Polygon &p);
};
__declspec(dllimport) Renderer *createRenderer();

// Inside DLL

__declspec(dllexport) Renderer *createRenderer();



Then the DLL would export the renderer dll and a lib which the application uses.

In the engine Im currently developing I scan a directory for a dll and then load it dynamically so I could have Direct3D and OpenGL support at the same time (a bit like Unreal). You can use the Windows functions ''LoadLibraryEx'' and ''GetProcAddress'' for that. Ofcourse I wouldn''t recommend using a native API inside the renderer directly (especially if you want to support Linux as well)

BTW: There are plenty of tutorials on this topic on www.flipcode.com

cya

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!