At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What Is LPC?

M. Ingalls
M. Ingalls

LPC is a computer programming language used primarily in gaming but that also has applications in other settings, perhaps most notably as the basis for the Pike language. It was developed by the Swedish computer scientist Lars Pensjö, and this is where the “LP” part of the name comes from. The “C” comes from the C language, from which it was derived. C is one of the most common programming languages, and many different platforms and programs have been built on its back. Pensjö created his program at least in part as a way to more effectively create objects and blueprints in multi-user dungeons (MUDs), which are a facet of several online gaming platforms. One of the most defining features of this language is that it allows players to type commands with more or less natural wording, and a number of different gaming platforms make use of its core syntax and specifications. Though it tends to be most popular within the gaming community, it has also found a number of uses elsewhere in the world of open-source coding.

Inception and Original Purpose

Man holding computer
Man holding computer

MUDs are popular parts of a couple of different mainstream online gaming platforms. Players from anywhere in the world — anywhere with an Internet connection, that is — can meet up, usually in the persona of an avatar, and exchange information, fight, or create objects with each other through coded controls. Anyone playing a multi-user game like this typically needs at least a basic grasp of coding and command syntax in order to engage. The simpler C-based format was designed primarily to make that part of the game more easily approachable.

Basic Syntax

The basic syntax of any coding language is the system used to generate lexical and syntactic analyzers. In simpler terms, it’s the nuts and bolts of how the coding runs, is written, and is received by hosts. In most key respects LPC mirrors the language C, but it has no strongly typed variables. This allows it to be used for creating objects instead of items. In a dungeon environment, for instance, rooms, weapons, monsters and armor are objects. The programming language allows users to create, modify, delete and reproduce these objects in almost any manner they choose.

Programming Specifications

In general the language supports many different types of programming, including procedural, modular, structured, object-oriented, defined data, and weak variable, making it a comprehensive and all-encompassing computer language. One key feature of Pensjö's design is its relative resistance to common programming errors by content builders. The overall stability of a server is almost always enhanced with this language in use, too, which can allow new programmers to focus on the task of building things rather than being consumed with the programming logic itself.

Role of Blueprints

Although almost everything is an object in LPC, it does not use the concept of classes. Instead, an object in this setting is a blueprint object or a clone of a blueprint object; although technically different from a class, these blueprints can often be treated in the same way. All attributes and methods can be accessed at the instance and class levels in this language, which isn't always the case in other object-oriented languages that allow them to be limited to class and instance.

Relationship of Objects to the Central File

In LPC code, common objects are defined in centralized files. As different game "rooms" are created, they inherit objects from the central file, and accordingly a change to that file will also affect every piece of code where that object is used. This prevents needing to code each of those objects into every location, making the code easier to write and maintain. This centralization is not unique, but is part of what makes it possible to create complicated games with this programming language.

Flexibility and Other Uses

The flexibility of the code as a whole has led to it being used for a variety of purposes other than for the MUD game creation. Wide-reaching uses include the creation of the Pike programming language, which is based almost entirely on Pensjö’s model. Pike is widely used for multimedia applications, system administration tasks, and Internet servers.

Discuss this Article

Post your comments
Forgot password?
    • Man holding computer
      Man holding computer