Jump to content
  • Advertisement


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


Game Client as library or core program

This topic is 5285 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

Hey, I was just wondering if it would be better to have a GUI Client as a library used by the main program, or to be a main part of it? One reason I was considering compiling it as a lib was because I was planning on making it non-dependent on the game whatsoever, letting me use it in future projects without much change. The only problem with this would be communicating between the lib, and the caller. If, for example, the Client hit an error requiring it to close immediately, it might need to tell the caller to shut down its subsystems, while providing feedback in the GUI about what is happening. The only way around this that I''ve thought of is similar to the way wxWidgets uses event tables, by passing a function to a macro which gets called on a triggered event. Anyone have any other ideas, fixes, etc? Anything is welcome

Share this post

Link to post
Share on other sites
Original post by silencer-
I was just wondering if it would be better to have a GUI Client as a library...

An excellent idea.

Generally, information is passed back to the main program via a return value, a query function, some sort of callback, or an exception. It''s more cumbersome, but that is the tradeoff.

One other thing, your use of the word "client" is confusing. Since the main program calls the GUI, the main program is a client of the GUI, not the other way around.

John Bolton
Page 44 Studios
Current project: NHL Faceoff 2005 PS2

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
I just finished up implementing something similar myself. What I did was to separate the game engine and the game logic.

The engine is compiled into and executable and the logic into a library. When the engine starts up it reads an ini file and gets the name of the dll it should be loading for logic. This dll exports only one function which takes 2 parameters. The first is a structure of function pointers for all the functions that the engine wants to export to the game logic. The second is a structure of function pointers that the logic fills in for it''s exports to the engine. There are very few exports that the engine needs from the logic, only an init, shutdown, frame update and maybe level start/end functions depending on how I set up my graphics subsystem.

The engine controls the program flow by telling the logic what it is currently doing, the logic tells the engine what to display and where.

For a good example of this sort of set up take a peek at the Quake 2 source and the Quake 3 logic source, I pulled ideas from there when designing my own.

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!