Cortex Command

Cortex Command

Not enough ratings
Modding Basics: Anatomy of a working RTE
By Tonald Drump
Basic summary of the what a modder will need to know. How LUA works, how to create scenes, and how to sprite are not included here.

Notice: This guide is a beta.
 
Rate  
Favorite
Favorited
Unfavorite
Preface
Revision 1: so...RTEs. They uh….there's a folder and uh...you put stuff in it…..um….
Revision 2: This guide will tell you how mods work, from the .ini standpoint. How to code with .lua and how to make sprites that work with the game won't be covered here.



Pictured: Content
What am I doing?
As a moddable game, Cortex Command is very flexible. Every asset packaged alongside the base game can be viewed, activated, or deactivated. You can remove, every faction, replace the map image with a eternally floating bust of Danny Devito, create as many factions as you can load, or create a standalone mission campaign (with some lua knowledge). Heck, you don't even need this guide if you know where to look! If you can figure out how it will work in practice, you can create it.

This could be you


That being said, there are still very concrete limits concerning how the content you're trying to load can be packaged. Learn those limits so with creativity, you can surpass them.

What do I need?
An attention span, Raw motivation, the superpower to kick yourself until you've finished what you started. Optionally you might want Notepad++ or Textwrangler. For advanced things like spriting, you'll need preferrably GIMP or photoshop. The specifics of image editing won't be covered here, however.

By the way; If you think you're enough of a bad-a** to do it, don't hesitate if you want to close this guide and jump straight into the linked resources from here. I made this guide with the intent to compliment and link the wiki, steam, and forum resources.

YOU DO NOT NEED TO KNOW ALL OF THIS. I personally learned modding by hand; playing around offline with the work of other modders, and referring back to the wiki, base game assets, or other mods if i needed to figure out how something was done.
1. Bare Bones: Enter the .INI
The .ini file is what you'll be working with the most. Everything that you can shoot, get shot by, pick up, crash into, buy, and destroy, manipulate with .lua has to be defined by a .ini. (Don't quote me on that last thing though. If a modder can correct me on that, go ahead.)


Some definitions shamelessly ripped from the Cortex Command wiki first. Read from these pages and come back.
http://wiki.datarealms.com/Module_Structure
http://wiki.datarealms.com/Modding_101




Done? Great!

You should have learned that you need a Index.ini for a working mod. I think you'll also notice that in the example given of what a index.ini looks like, there are references to other .ini files.

How you want to create your mod's file structure is up to you, but you should maintain some organization. You should look at your work and imagine how difficult it will be months later to figure out what you were doing (Because that can happen). If you're working with others or have something particularly complex disabled, leave comments.

Here are three alternate examples of index layouts. Ultimately, any of the following will safely load in-game; though descriptions and icons both show in the buy menu. The point is; syntax is important, and you NEED to have DataModule at the head.

DataModule IncludeFile = Example.rte/Content1.ini IncludeFile = Example.rte/Content2.ini IncludeFile = Example.rte/Content3.ini IncludeFile = Example.rte/Content4.ini //incomplete // IncludeFile = Example.rte/Content5.ini // IncludeFile = Example.rte/Content6.ini //incomplete IncludeFile = Example.rte/Example/Content2.ini

DataModule ModuleName = My Faction Tech IconFile = ContentFile FilePath = Example.rte/Icon.bmp Author = Me Description = Fight! IncludeFile = Example.rte/Content1.ini IncludeFile = Example.rte/Content3.ini IncludeFile = Example.rte/Example/Content2.ini



And that's the Index.
2. Bloody Guts: Objects, Types, Words, Variables, Data, Viscerality
Cortex Command is, mechanically, a mesh of different types of data and data representing objects that can interact with eachother. To put it generally: A gun is a HDFirearm, a bunker is a SceneObject, and a bullet is a MOPixel. A gun shoots a bullet that hits a bunker and you have the game. Clever modders use the different types together with others and .ini/.lua magic to create the desired effect they might want.
Here's a brief list of the object types you'll be dealing with more often. Some are broad in definition, and the ones parented under it will share properties by nature of the heiarchy. What that means: a MovableObject might not be a AHuman but AHuman is a MO by nature. I'll only briefly touch on the abstract classes and i won't be including the generic manager types that are more exclusive to .lua in this guide; I may need help to define those.


SceneObject
The base class shared by Both TerrainObjects and MovableObjects, ie anything that can be places in a scene.
http://wiki.datarealms.com/LuaDocs/SceneObject

MovableObject
A movable object with mass. It's referred to in shorthand as a MO.
http://wiki.datarealms.com/LuaDocs/MovableObject
  • MOPixel - A movable object with mass that is graphically represented by dynamic drawing stuff. MOPixels are the smallest type of effect. They are one pixel, with one color, and some properties. Their singular and manually defined atom defines the material that the MOPixel is made of, as well as a trail effect. They fill a lot of roles, they can be used as sparks, blood, shrapnel, exhaust, bullets, the list goes on.
    http://wiki.datarealms.com/MOPixel
    http://wiki.datarealms.com/LuaDocs/MOPixel

  • MOSprite - A movable object with mass that is graphically represented by a BITMAP image.
    http://wiki.datarealms.com/LuaDocs/MOSprite

    • MOSParticle - MOSParticles are quite simply MOPixels with an animated sprite. They can be gibs, but they cannot be gibbed. Despite this, they are parented to MOSprites. Because they have sharpness and mass they can be projectiles too.
      http://wiki.datarealms.com/MOSParticle
      http://wiki.datarealms.com/LuaDocs/MOSParticle

    • MOSRotating - A sprite movable object that can rotate. They can be functional gibs as well but they have advantages over MOSParticles of having regular collision and being able to gib. Because of this gibbability they can be used as explosive projectiles.
      http://wiki.datarealms.com/LuaDocs/MOSRotating
      http://wiki.datarealms.com/MOSRotating


    • Attachable - Attachables can act as armor plating to a dropship, helmets and body armor, extra bulk for shields, and more. In theory they can presumably attach to any other MO. If that is the case one could possibly do some really crazy things with these.
      http://wiki.datarealms.com/LuaDocs/Attachable
      http://wiki.datarealms.com/Attachments
      • AEmitter - AEmitters are a class of actor whose purpose is to emit particles. Wounds, Jetpacks, Engines, and other Emissions are in this class. Almost any class of object is able to be emitted in this manner, including AEmitters themselves. AEmitters can be attached ot other objects much like attachables. In such a application the emitters function just like they would anywhere else. The emitters will emit in the direction that they were attached relative to the parent object. If the parent object rotates, then the emitter will rotate with it, and emit in the new direction. However, if the parent object flips, as AHumans do when turning around, the emitter will not flip accordingly.
        http://wiki.datarealms.com/AEmitter
        http://wiki.datarealms.com/LuaDocs/AEmitter

      • Magazine - Magazines are parented to attachables, but are primarily related to HDFirearms or HeldDevices. Magazines hold rounds and HDFirearms use Magazines.
        http://wiki.datarealms.com/Magazine
        http://wiki.datarealms.com/LuaDocs/Magazine

      • HeldDevice - Generically named and currently only used for shields, a HeldDevice is equipped to an AHuman's background arm, unless they have equipped an HDFirearm which requires two hands or a TDExplosive. The HeldDevice is not known to be useable by ACrab Actors.
        http://wiki.datarealms.com/HeldDevice
        http://wiki.datarealms.com/LuaDocs/HeldDevice

        Note: The Buy menu AddToGroup for Shields can be used to make a HDFirearm with "OneHanded = 1" be used as an offhand weapon by having "AddToGroup = Shields" as the only AddToGroup used in an AddDevice declaration which is not a CopyOf.
        This is also true for a TDExplosive, but the offhanded TDExplosive will not be thrown and also will only be shown by the Build menu, not the in-game Buy menu. OneHanded non-Shield bombs can be thrown while holding a Shield or firing an "offhanded" HDFirearm.



        • HDFirearm - A concatenated abbreviation of "Held Device" and "Firearm", these generally are weapons, but are also tools such as diggers, scanners, detonators, sprayers, and some other exotic devices. An HDFirearm is anything which needs to be triggered by an Actor at the right time and place for the situation. By default all have unlimited reloads except those with infinite ammo. Technically all have rounds contained in magazines, shells ejected, and muzzle flash, but sometimes they're only technicalities. Some mods have made weapons with finite reloads, recharging ammo, and switchable ammo types through .lua work.
          http://wiki.datarealms.com/HDFirearm
          http://wiki.datarealms.com/LuaDocs/HDFirearm

          • Round - A round is the round that a HDFirearm fires. They are quite simple. They consist of both the round particle and the shell. Shells are the ejected particles of a round. These can be a huge variety of objects, but they are generally MOSParticles with an animation of a spinning casing. I'm not sure if there are any restriction on what a round can be. The round particle is whatever is being fired. Most rounds i have observed would use a copy of a TDExplosive, MOPixel, or MOSRotating as it's particle.
            http://wiki.datarealms.com/Round

        • TDExplosive - A "Thrown Device" "Explosive" is used for grenades, explosive shells, mines, "Dropship ONLY" bombs-- even a thrown stone. The TDExplosive is anything you want triggered to "gib" at a later time and usually a different place than when and where it was thrown (or fired from a HDFirearm). The trigger is generally det-on-impact or a reasonable time delay, though some are unreasonably long timers so detonators can be used remotely. They can only be thrown by AHumans who have a foreground arm. The speed and thus distance can be controlled by charging up the throw and a parabolic arc makes it easy to throw over/around cover. TDExplosives, unlike a HDFirearm's Magazine, do not reload; once gibbed, it's gone.
          http://wiki.datarealms.com/TDExplosive
          http://wiki.datarealms.com/LuaDocs/TDExplosive


Other

Glow - Glows are applied VIA Attachables, but I leave them here because they aren't really their own type of object. Screen Effects or Glows are a post processing effect in CC which applies 24 bit images onto an object. They are generally just radial gradients of various sizes and color to make a visual effect, but they aren't limited to such. Vanilla glow screen effect files can be found in base.rte/effects/glows.

Black is interpreted as transparency, and dark colors are interpreted as translucent.
http://wiki.datarealms.com/Glows


Oh hey, i ran out of space to type. I mean rea
3. Command Cortex: Putting it all together
Alright. Are you thoroughly confused yet?
Don't be.

It's not necessy to really know everything, again. If you want to you could be a specialist and primarily make guns or craft. I'm better at making scenes than working with .lua or making actors but I still know how the interlocking objects of the game work because, it's really simple stuff.


Here are some examples of How you can use the different objects to achieve different effects (projectile trails, old-school sticky bombs, etc)
3.1 Pistol
(Soon)
< >
1 Comments
EliteZirrick Jan 6 @ 3:12pm 
helpful i hope you will finish this i need help making maps