Modding 101

From Data Realms Wiki

(Difference between revisions)
Jump to: navigation, search
Petethegoat (Talk)
(Removed Abuse Filter test.)
Newer edit →

Revision as of 23:46, 4 June 2010

Modding 101 The Basics
Start here.


Actors Actors
Anything that can be controlled.


Effects Effects
Explosions, glows, and emission.


Modding 107 Mod Creation
Learn how the pros create objects.


Devices Devices
Weapons and tools.


Scenes Scenes
How to create scenes.


Module Structure Module Structure
Setting up a module index.


Lua Lua
Scripting.


:Category:Modding Modding
All the modding pages.



If you have experience in object-oriented programming and scripting, you already know at least half of what is required to create mods for this game. For now, we will assume you do not have this experience. For now, lets start with a vocabulary primer:

Vocabulary

You will see these words used quite frequently when you are creating mods. They are integral to the object-oriented programming design cycle. Learn them.

Classes

  • A class is a conceptual structure that is used to define an item. If you want a weapon, you use the HDFirearm class. Classes cannot be changed or edited. Their structure is unmodifiable.
  • Real-world example: A car is a class of transportation. Don't think about it too hard, just take that as a fact.
  • In-game example: An HDFirearm is a class of held device.

Objects

  • An object is an instance of a class. Simply put, an object is a class that you can edit and modify to your needs. It is created for you to make a specific type of class.
  • Continuing our real-world example: A Volkswagen Beetle, a Toyota Camry, or a Ford Taurus would be objects of the car class. Does that make sense? A Beetle, Camry, or Taurus are a "type" of car. The type of car would be the object.
  • In-game example: A YAK-47, Rail Pistol, and the Gatling Gun are objects of the HDFirearm class.

Properties

  • A property is another fancy, object-oriented word for variable. An object has certain attributes, and a property defines what those attributes are.
  • Again, using the car analogy: A Volkswagen Beetle (the object) can have several properties. They include (but are not limited to): color, engine size, or transmission.
  • In-game example: RateOfFire, FullAuto, and Mass are properties of the YAK-47 object of the HDFirearm class.

Attributes

  • Attributes are simply the values of properties. Mass = 16. Mass is the property, 16 is the attribute. Fairly simple.
  • Real-world example: Red (attribute) is the color (property) of the Beetle (object) that is a car (class).
  • In-game example: 4 (attribute) is the mass (property) of the Rail Pistol (object) that is an HDFirearm (class).

If you feel you are comfortable with the terminology, continue on to Module Structure.

Fundamentals

To begin, the Cortex Command interpreter has very strict rules. Proper capitalization and tabbing are absolutely critical. Look at the two examples below:

  • Example one:
AddDevice = HDFirearm
	PresetName = SMG
  • Example two:
Adddevice = hdfirearm
Presetname = SMG

Example one is properly capitalized and tabbed. Example two is not, and will throw an error. One of the first errors you should check should you experience errors is proper spelling, tabbing, and capitalization.

Additionally, it is considered good form to properly comment and document your code. This is accomplished through a variety of means, primarily code commenting. There are two methods to do this: Line comments and block comments.

// This is a line comment, the double forward slash denotes this.  It can only occupy one line.

/*
This is a comment block.
Anything between the
forward slash and
asterisk is a comment
*/

Those are basic conventions implemented by the interpreter. If you don't follow these, your code (and as a result, your mod) will not load and the game will crash.

Personal tools