Engine Structuring Problem

Started by
11 comments, last by Esap1 23 years, 7 months ago
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,
Advertisement
Do you understand my problem?
Write a map importer.
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,
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"
"It's obvious isn't it Miller? Curiosity killed these cats!"
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
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.
Could someone show me an example of using a Modular Engine?(then I could try to write mine to work like it.)
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"
"It's obvious isn't it Miller? Curiosity killed these cats!"
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
-------homepage - email

This topic is closed to new replies.

Advertisement