Newsgroups: comp.sys.amiga.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ncoast!davewt From: davewt@NCoast.ORG (David Wright) Subject: Re: Text Adventure Source Code Organization: North Coast Public Access Un*x (ncoast) Date: Sun, 16 Jun 1991 17:49:32 GMT Message-ID: <1991Jun16.174932.20524@NCoast.ORG> Summary: A shared library is best References: Lines: 52 In article Alex_Topic@resbbs.UUCP (Alex Topic) writes: > Have a BIG games.library!!! and have User.modules for each phone >line..etc It will have alot of interprocess communication happening in >it, since I want it to be fully teractive.,. This is the best way to do it. Having done a lot of work on Amiga Empire, writing my own new multi-player space game in SAS/C, I have found that writing the entire thing as a library is the best way all around. Your only other real choice is to make the user stuff one big program which is residentable, but this has a bad side effect. Should you wish to update the library (add new commands, fix bugs, etc.) every user program will have to be recompiled as well. You will also need to write many versions (all of which are again huge) for things like ARexx versions, serial port versions, etc. if you want it to run on BBS systems besides DLG. By writing all the game-specific code in one library, it only takes up space on disk (and in RAM) once, and the library can be upgraded without recompiling all your "client" programs. > In my user modules I will simple allocate memory for players structure >to work with the RUN-TIME library... so no confusion is about.. then once >that is done.. I will jump right into the LIBRARY and the rest is the games >code... Exactly. And in fact, you can even put a "allocate" function into your library so that client programs don't have to know how big the structure is. That way you can change it later and again not have to recompile programs. > Anyone have a good idea how to write a library in 'C'?? hmmm I'm >new to 'C'.... oh well later all! The game I am working on is tenatively called "Imperium" (all I have left to do is add the combat code) and is a multi-player space Empire-like exploration game. It makes use of all of the above things (plus all the "clients" are "pure" and can be made residentable, so you only spend about 32k per "client" after the first is loaded), and I would not even consider doing it as anything other than a shared library. You also might want to consider creating a "standard" linkable object which people can use to create "doors" for other BBS systems. In Imperium I made up a module called "ModImp" (for Modular Imperium) which contains all the code for opening the Imperium library, handling command-line args, etc. All that people have to provide is another "module" which contains the user I/O functions they wish to use, plus some utility functions used by ModImp that are "module" specific (such as the strings to print in the log, the title bar text for any console windows opened, etc.). Doing this allows the the "modules" created by users to know nothing about Imperium or the Imperium library. I am providing the source to the serial port client as an example of what a "module" should look like (the console client could also be written this way, but I didn't feel it was worth the extra indirection and most of the other features (such as command-line/WB arg parsing) would basically be duplicated). Dave