MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | LPC Basics |
| 2 | Written by Descartes of Borg |
| 3 | 23 april 1993 |
| 4 | |
| 5 | |
| 6 | INTRODUCTION |
| 7 | This manual, how to use it, and its terms |
| 8 | |
| 9 | I have seen a lot of requests lately on USENET for LPC manuals. In addition, |
| 10 | the immortals on my mud have been telling how good the building documentation |
| 11 | of Nightmare is, but that there was just no adequate explanation of the |
| 12 | LPC programming language. So I decided to try my hand at writing a manual. |
| 13 | Some things you should keep in mind. |
| 14 | LPC is a very easy programming language to learn, and it has real |
| 15 | value in that place most of us know as the real world. I began playing |
| 16 | muds in 1991, and in the space of a month created an unimpressive area |
| 17 | and musician's guild on the original Bates College MUD called Orlith. |
| 18 | After that, I moved to Los Angeles for a year and had no contact with |
| 19 | mudding or computers. In June of 1992, I was back on the internet and |
| 20 | a wizard of Igor. In September of 1992 I began coding the Nightmare |
| 21 | mudlib for our use, and then later decided to distribute it due to there |
| 22 | not being any mudlibs for MudOS at the time that a person could just throw |
| 23 | up a running mud with (now, that of course is not the case :)). |
| 24 | So, I have been doing serious coding for less than a year. As a |
| 25 | Philosophy major in a world of Computer Science majors, I just want to |
| 26 | make clear that it is not at all required that you have ever done anything |
| 27 | with your computer than log into a mud in order for you to really come |
| 28 | to understand LPC coding. This manual makes the following assumptions: |
| 29 | Someone has taught you basic UNIX commands like ls, cd, mkdir, mv, rm, etc. |
| 30 | You know how to enter your mud's editor and write a file. No other |
| 31 | assumptions are made. If you know C, you are handicapped in that LPC |
| 32 | looks a lot like C, but it is not C. Your preconceptions about |
| 33 | modular programming development will be a hinderence you will have to |
| 34 | overcome. If you have never heard of the C programming language (like |
| 35 | me in May of 1991), then you are only missing an understanding of the |
| 36 | simple constructs of C like the flow of program execution and logical |
| 37 | operators and such. So a C guru has no real advantage over you, since |
| 38 | what they know from C which is applicable to LPC is easy to pick up. |
| 39 | The stuff they know about C which makes them a guru is irrelevant to |
| 40 | LPC. |
| 41 | |
| 42 | The chapters of this manual are meant to be read in order. Starting with |
| 43 | the introduction, going sequentially through the chapter numbers as |
| 44 | ordered in the contents file. Each chapter begins with a paragraph or |
| 45 | two explaining what you should have come to understand by that point |
| 46 | in your studies. After those introductory paragraphs, the chapter then |
| 47 | begins to discuss its subject matter in nauseating detail. At the end |
| 48 | of the chapter is a briefly worded summary of what you should understand |
| 49 | from that chapter if I have been successful. Following that may or may |
| 50 | not be some sidenotes relevant to the subject at hand, but not necessary |
| 51 | to its understanding. |
| 52 | |
| 53 | If at any time you get to a chapter intro, and you have read the preceeding |
| 54 | chapters thoroughly and you do not understand what it says you should |
| 55 | understand by that point, please mail me! Clearly, I have failed at that |
| 56 | point and I need to know where it is I have gone wrong so I can revise |
| 57 | it properly. Similarly, if you do not understand what the chapter summary |
| 58 | says you should, please mail me. If your mumud is on the MudOS intermud |
| 59 | system, mail descartes@nightmare. Otherwise mail borg@hebron.connected.com. |
| 60 | |
| 61 | Some basic terms this manual uses: |
| 62 | driver- |
| 63 | This is the C program which is the game. It accepts incoming sockets |
| 64 | (links to other computers), interprets LPC code defined by the mudlib, |
| 65 | keeps mud objects in memory, makes periodic attempts to clean unused |
| 66 | mud objects from memory, makes periodic calls to objects, and so on. |
| 67 | |
| 68 | mudlib- |
| 69 | LPC code which defines the world in which you are in. The driver of itself |
| 70 | is not a game. It is just a program which allows the creation of a |
| 71 | multi-user environment. In some sense, the driver is like an LPC |
| 72 | compiler, and the mudlib is like a compiler's library (a very loose |
| 73 | analogy). The mudlib defines basic objects which will likely be used |
| 74 | over and over again by people creating in the mud world. Examples of |
| 75 | such objects are /std/room (or /room/room), /std/user.c (or /obj/player.c), |
| 76 | and so on. |
| 77 | |
| 78 | area or castle: |
| 79 | Specific creator coded objects which often use a feature of LPC called |
| 80 | inheritance to make use of the properties of basic mudlib objects and |
| 81 | turn them into specific objects to be used by players in the game |
| 82 | |
| 83 | object: |
| 84 | a room, a weapon, a monster, a player, a bag, etc. More importantly, |
| 85 | every individual file with a .c extension is an object. Objects are |
| 86 | used in different ways. Objects like /std/living.c are inherited by |
| 87 | objects like monster.c and user.c. Others are cloned, which means a |
| 88 | duplicate of that code is loaded into memory. And still others are |
| 89 | simply loaded into memory to be referenced by other objects. |
| 90 | |
| 91 | native and compat: |
| 92 | these two terms refer to two popular flavours of drivers. Native mode |
| 93 | mudlibs make use of on the design of LPMud driver 3.0 and later. You may |
| 94 | have a 3.0 driver however, but have a 2.4.5 style mudlib. This is what |
| 95 | is meant by compat mode. Mudlibs which are native mode are any for |
| 96 | MudOS, CD, and LPMud mudlibs that |
| 97 | are listed as native. Compat mudlibs are any LPMud mudlib before 3.0 and |
| 98 | those which are 3.* compat mudlibs. I believe Amylaar's is compat. |
| 99 | [ Not true, Amylaar supports native and compat mudlibs, MorgenGrauen |
| 100 | is native - Boing ] |
| 101 | |
| 102 | Good Luck! |
| 103 | George Reese |
| 104 | (Descartes of Borg) |
| 105 | 12 july 1993 |
| 106 | borg@hebron.connected.com |