• Advertisement

Archived

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

Engine Structuring Problem

This topic is 6348 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
Guest Anonymous Poster
It seems to me like you''re jumping overboard without a care for sharks dwelling in wait for you. All this talk of modularity is only going to encumber you while you try to write about learning 3D engines.

Write your first one, who cares how crap it is? Just make sure it works. By making sure it works you''ll gain insight into how you can make it better due to mostly, what went wrong.

*THEN* come back here and digest some of the good advice already posted.

Good luck...

Share this post


Link to post
Share on other sites
Let me take a shot at this...Don''t know how it''ll turn out cause its a complex subject, but...

An engine as I understand it is a collection on generic functions. I doubt that anyone has been able to design one from scratch. Rather, I think they are developed from experience with other applications, and in many ways discovery plays a large part: (Ahh.. I can use this code elsewhere!).

For 3D games, typical functions would include init(platform), close(same), load(objects,maps,etc), step(action), render(to screen). Having relegated the detail to subfunctions, one can focus on the game itself.

At a higher level, one could add an interpreter; a script or data processer which sets up the game parameters, and references the objects to be loaded, and how they act. At this point, the "engine" requires no additional code to operate - only the script need be changed from game to game. Notably, such a project is quite ambitious, and should evolve from simpler projects (as suggested by anon above).

I guess the point of this rambling is to indicate that you really should start simple, and aggregate functionality as you go. Where you put it (.c, .dll ...) depends on how well tested it is.

Writing an engine for others may not be a good idea - the technical developers already have their own, and the others may try to exploit you. The general public is a better customer. Look to develop your own talents - thats something they can''t take away. Sorry to get a bit philosophical on the latter.

This may not answer your question completely, but I hope overall this conveys some useful insights. Keep at it!

Share this post


Link to post
Share on other sites
Ive already written one of those Crap engines, but the problem was it was less an engine, than it was a program that drawed poly and stuff. It wasnt Modular at all, thats why now Im trying to start out right,

Share this post


Link to post
Share on other sites

  • Advertisement