blob: 061f28429a4331323963b41eb0aec82892be9e28 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001Intermediate LPC
2Descartes of Borg
3Novermber 1993
4
5 Chapter 1: Introduction
6
71.1 LPC Basics
8Anyone reading this textbook should either have read the textbook LPC
9Basics or be familiar enough with mud realm coding such that not only are
10they capable of building rooms and other such objects involved in area
11coding, but they also have a good idea of what is going on when the code
12they write is executing. If you do not feel you are at this point, then go
13back and read LPC Basics before continuing. If you do so, you will find
14that what you read here will be much more meaningful to you.
15
161.2 Goals of This Textbook
17The introductory textbook was meant to take people new to LPC from
18knowing nothing to being able to code a nice realm on any LPMud. There
19is naturally much more to LPC and to LPMud building, however, than
20building rooms, armours, monsters, and weapons. As you get into more
21complicated concepts like guilds, or desire to do more involved things with
22your realm, you will find the concepts detailed in LPC Basics to be lacking
23in support for these projects. Intermediate LPC is designed to take you
24beyond the simple realm building process into a full knowledge of LPC for
25functioning as a realm builder on an LPMud. The task of mudlib building
26itself is left to a later text. After reading this textbook and working through
27it by experimenting with actual code, the reader should be able to code game
28objects to fit any design or idea they have in mind, so long as I have been
29successful.
30
311.3 An Overview
32What more is there? Well many of you are quite aware that LPC supports
33mappings and arrays and have been asking me why those were not detailed
34in LPC Basics. I felt that those concepts were beyond the scope of what I
35was trying to do with that textbook and were more fitting to this textbook.
36But new tools are all fine and dandy, what matters, however, is what you
37can do with those tools. The goal of LPC Basics was to get you to building
38quality LPMud realms. Mappings and arrays are not necessary to do that.
39The goal of this book is to allow you to code any idea you might want to
40code in your area. That ability requires the knowledge of mappings and
41arrays.
42
43Any idea you want to code in an LPMud is possible. LPC is a language
44which is amazingly well suited to this task. All that prevents you from
45coding your ideas is your knowledge of LPC or an inadequate mudlib or
Arathorn2e97b6a2019-12-03 00:37:34 +010046your mudÕs theme or administrative policies. This textbook cannot make
MG Mud User88f12472016-06-24 23:31:02 +020047the mudlib you are working with any better, and it cannot change the mud
Arathorn2e97b6a2019-12-03 00:37:34 +010048theme or the mudÕs administrative policies. Never once think that LPC is
MG Mud User88f12472016-06-24 23:31:02 +020049incapable of doing what you want to do. If your idea is prevented by
50administrative policies or themes, then it is simply not an idea for your
51current mud. If the mudlib is inadequate, talk to the people in charge of
52your mudlib about what can be done at the mudlib level to facilitate it. You
53would be surprised by what is actually in the mudlib you did not know
54about. More important, after reading this textbook, you should be able to
Arathorn2e97b6a2019-12-03 00:37:34 +010055read all of the mudlib code in your mudÕs mudlib and understand what is
MG Mud User88f12472016-06-24 23:31:02 +020056going on at each line in the mudlib code. You may not as yet be able to
57reproduce that code on your own, but at least you can understand what is
58going on at the mudlib level.
59
60This textbook starts out with a discussion about what the LPMud driver is
61doing. One nice thing about this textbook, in general it is completely driver
62and mudlib independent (excepting for the Dworkin Game Driver). The
63chapter on the game driver does not get into actual implementation, but
64instead deals with what all game drivers basically do in order to run the
65mud.
66
67Next I discuss those magic topics everyone wants to know more about,
68arrays and mappings. Mappings may be simultaneously the easiest and
69most difficult data type to understand. Since they are sort of complex arrays
70in a loose sense, you really need to understand arrays before discussing
71them. All the same, once you understand them, they are much easier than
72arrays to use in real situations. At any rate, spend most of your time
73working with that chapter, because it is probably the most difficult, yet most
74useful chapter in the book.
75
76After that follows a brief chapter on the LPC pre-compiler, a tool you can
77use for sorting out how your code will look before it gets sent to the
78compiler. Despite my horrid intro to it here, this chapter is perhaps the
79easiest chapter in the textbook. I put it after the mappings and arrays
80chapter for exactly that reason.
81
82Strings are re-introduced next, going into more detail with how you can do
83such things as advanced command handling by breaking up strings. Once
84you understand arrays fairly well, this chapter should be really simple.
85
86The next chapter is the second most important in the book. It may be the
87most important if you ever intend to go beyond the intermediate stage and
88dive into mudlib coding. That chapter involves the complex ideas behind
89LPC inheritance. Since the goal of this textbook is not to teach mudlib
90programming, the chapter is not a detailed discussion on object oriented
91programming. Understanding this chapter, however, will give you some
92good insights into what is involved with object oriented programming, as
93well as allow you to build more complex objects by overriding functions
94and defining your own base classes.
95
96Finally, the textbook ends with a simple discussion of code debugging.
97This is not an essential chapter, but instead it is meant as more of an
98auxiliary supplement to what the knowledge you have accumulated so far.
99
1001.4 Not Appearing in This Textbook
101Perhaps what might appear to some as the most glaring omission of this
102textbook is largely a political omission, shadows. Never have I ever
103encountered an example of where a shadow was either the best or most
104effecient manner of doing anything. It does not follow from that, however,
105that there are no uses for shadows. My reasoning for omitting shadows
106from this textbook is that the learner is best served by learning the concepts
107in this textbook first and having spent time with them before dealing with
108the subject of shadows. In that way, I feel the person learning LPC will be
109better capable of judging the merits of using a shadow down the road. I
110will discuss shadows in a future textbook.
111
112If you are someone who uses shadows some or a lot, please do not take the
113above paragraph as a personal attack. There may be some perfectly valid
114uses for shadows somewhere which I have yet to encounter. Nevertheless,
115they are not the ideal way to accomplish any given task, and therefore they
116are not considered for the purposes of this textbook an intermediate coding
117tool.
118
119I have also omitted discussions of security and object oriented
120programming. Both are quite obviously mudlib issues. Many people,
121however, might take exception with my leaving out a discussion of object
122oriented programming. I chose to leave that for a later text, since most area
123builders code for the creativity, not for the computer science theory. In both
124the intermediate and beginner textbooks, I have chosen only to discuss
125theory where it is directly applicable to practical LPC programming. For
126people who are starting out green in LPC and want to code the next great
127mudlib, perhaps theory would be more useful. But for the purposes of this
128book, a discussion of object oriented programming is simply a snoozer. I
129do plan to get heavy into theory with the next textbook.
130
1311.5 Summary
132LPC is not difficult to learn. It is a language which, although pathetic
133compared to any other language for performing most computer language
134tasks, is incredibly powerful and unequalled for the tasks of building an
135area in MUD type games. For the beginner, it allows you to easily jump in
136and code useful objects without even knowing what you are doing. For the
137intermediate person, it allows you to turn any idea you have into textual
Arathorn2e97b6a2019-12-03 00:37:34 +0100138virtual reality. And for the advanced person, itÕs object oriented features
MG Mud User88f12472016-06-24 23:31:02 +0200139can allow you to build one of the most popular games on the internet. What
140you can do is simply limited by how much you know. And learning more
141does not require a computer science degree.
142
143Copyright (c) George Reese 1993