R8: "You Added What?!"

by Kyzrati on 20121013 , under

Recently on Bay 12 we've been talking about making X@COM more accessible to modding, and that's what R8 is all about. The game data has always been pretty moddable since it's stored in text files, but changing the data wouldn't be as much fun without the ability to create your own scenario to go along with it!

Since internally R7's Cataclysm was written using a very modular, data-based system (I love data-based design in general--probably fairly obvious by now), making the entire thing moddable only took a couple days of extracting that part of the code into text scripts, followed by extending the system so you can do plenty of things that weren't even seen in Cataclysm. So now you can use the text files to change/improve/expand Cataclysm, or go even further and do a total conversion.

There are 4 main files to edit when creating a scenario, one listing the areas and their properties, another drawing the blueprints for each area, a third for spawning objects, and the last for defining the scenario's rules and other settings. Here is an example of the settings file where you can change victory conditions, mission scoring, and general properties:
This file includes explanatory comments for data entries--the others are instead explained in much greater detail in the modding guide.

To make a mod you'll definitely want a copy of X@COM Modpack M1, which you can get by joining the new X@COM Forum (for modders and mod players only right now--it'll be expanded later). The Modpack comes with some helpful tools to make your modding experience a lot more pleasant. You'll get...
  • a 20-page guide (required reading!)
  • a palette key
  • my version of Notepad++ with syntax highlighting for X@COM script files (*.xt)
  • a fixed-width font you may want to use with NP++

If you're feeling bold and creative, you can do much more than simply modify Cataclysm. You can add new races, units, items, terrain and other objects to create a turn-based strategy game with entirely different content. On the more complex (but fun) side, you can even implement your own special abilities that enable the type of very dynamic environment seen in Cataclysm. Learn from the hundreds of examples included with the game. Here's the entire implementation of *all* the original abilities seen in X-COM, with syntax highlighting:
Click to see full script (server on which these were stored died)

And here are the lines which control the spread of the virus in Cataclysm:
Click to see full script (server on which these were stored died)

But you don't have to mess with all that stuff if you don't want to--you can create your own mission using only the scenario files and all the objects I've already created for previous scenarios.

Of course it's nice if others can play what you create, so beginning with R8, X@COM can now run mods which are simply dropped into the game directory.

Debesh Unnos (Crazy Cow) has already created the very first mod for X@COM which adds some new potential buildings/encounters to your Cataclysm town, among other changes. His mod is the beginning of what we'll call "Cataclysm+". If anyone wants to just add one new building or make a few simple additions to Cataclysm, something not necessarily worth a standalone mod, send them to me and I'll merge them with Debesh's mod to expand the scenario and give everyone a chance to see any of the extra content in their towns. Check the files page for currently available mods.

Other more ambitious mods (total conversions) are already in the works, so you'll still get some fun new stuff to play with while I work on improving the game in general.

Though modding support is the main feature of R8, it does still come with other goodies a proper release deserves.

There is of course the psi-amp, covered in my previous post. As described there, X@COM also supports intrinsic abilities, though you won't yet find any in the game.

You can now seed the map/mission generator, so you can share a particularly interesting map with other players, or play the same map multiple times without relying on a saved game. The seed for a given map is found in your mission results/score file, and can be set in "data/maps/_seed.xt".

I've added a swap hands command ('w') available as a free action (0 TU) to switch the contents of a unit's left and right hands.

R8 makes some significant changes to how doors and windows work by turning them from terrain into props (I hope I've made all the necessary adjustments--it required a rather sweeping refactoring effort). That windows are now props is an issue even for gameplay because it means you can now stand in a space previously occupied by a window, i.e. much closer to the edge, and get a better view. Sadly, this also means you'll have to hit someone twice to knock them out of a window (unless/until I enable melee knockbacks greater than one space), whereas they used to crash through the window and immediately slip off the edge.

Units are allowed to throw directly to ally positions. You could always throw at *enemies*, which is great for grenades, but the game was disallowing tosses to allies because it assumed you were trying to do something bad by throwing stuff at them =p. It's now much easier to pass around weapons and gear when you need to--in my own experience this need arises quite often in Cataclysm, so I finally fixed it.

Over the past couple weeks I noticed some things amiss in Cataclysm, or parts that could be quickly improved, so I tweaked the scripts a bit more. I don't have a list of all the changes, but among them:
  • You are guaranteed at least one homemade flamethrower in the survivalist's house. I thought I had done that originally but apparently not, and it pissed me off when I got there and searched the house only to find a bunch of ammo!
  • Suicide bombers no longer detonate on the dogs which roam the town--they're not THAT stupid...
  • Allied criminals freed from the police station will find themselves weapons if you don't give them any.
As an amusing side note, just before release I also had to fix a regression where the police started attacking me... It was rather amusing to be shot dead as I sought refuge in the police station, because the police suddenly thought they were terrorists (literally) of all things, heh.

17 comments more...


  • Kyzrati

    Damnit, fact check fail... Fixed!

    (It'd be easier for me if I didn't have to remember your three names. Very bad with names, I am... would you like to add a fourth and really confuse me? =p)

    You'll definitely have some company. draxis has already joined up. Still waiting for sambojin so he can get the new modpack and start development in earnest on his Doom mod.

  • Kyzrati

    Non-violent, eh? That could work, though making it playable would require designing a good number of "special abilities" to handle the gameplay.

    In any case, welcome to join up on the forum to discuss any details!

  • sylverone

    I'm not able to run Cataclysm+ for some reason. Here's the log output:

    X@COM v0.16.121024r8.2 (alpha)

    I=0000000 Initializing Rogue Engine X
    I=0000001 | Starting SDL
    I=0000025 | Importing icon
    I=0000026 | Setting video mode
    I=0000056 | Initializing resources
    I=0000058 | Initializing audio
    I=0000111 | Loading colors
    I=0000111 | Initializing font type data
    I=0000111 | Mapping standard ASCII values
    I=0000111 | Loading fonts
    F=0000112 | | REX::loadFonts() | Unable to open config file (data-CataclysmPlus/fonts/_config.xt)

  • Kyzrati

    This is most likely a problem with permissions on your computer. I assume you've decompressed the rar, maintained the directory structure, and run it using XCOMRL-CataclysmPlus.bat? Have you played any other mods yet, like Rookie's Tale? They all use this new batch command method which tries to run the game from a separate directory other than the one the batch file is in, the goal being to keep things simple and generally non-confusing. Make sure the game directory and its contents have full admin permissions.

  • sylverone

    Yes, I decompressed it like normal and tried to run the batch file in the same way I've been doing it for the vanilla X@COM mods (which do work for me). Neither Cataclysm+ nor A Rookie's Tale will run, same error for both. They have the same permissions as the vanilla game, which I've been playing without problems.

    I should have mentioned that I'm trying to run it on linux (ubuntu) using Wine. The window flashes up for a moment as if it wants to load and then exits. I have played A Rookie's Tale successfully on Windows but that box isn't usually available to me. I can successfully play all of the mods packaged with the basic X@COM package using Wine (including regular cataclysm), though, so I hope there's a way to get it to work.

    I tried running XCOMRL.EXE directly, and it also failed to run. Here's the run.log:

    X@COM v0.16.121024r8.2 (alpha)

    I=0000000 Initializing Rogue Engine X
    I=0000001 | Starting SDL
    I=0000033 | Importing icon
    I=0000038 | Setting video mode
    I=0000091 | Initializing resources
    I=0000093 | Initializing audio
    I=0000139 | Loading colors
    I=0000139 | Initializing font type data
    I=0000139 | Mapping standard ASCII values
    I=0000139 | Loading fonts
    F=0000140 | | REX::loadFonts() | No fonts found in "data/fonts"

    I appreciate your responses. I'm quite enjoying the game so far, especially now that I'm starting to try the newer mods. Obviously a lot can be done with this system.

  • sylverone

    Hey, I got it to work! I made a new .bat file inside the folder with the EXE containing the following:

    start XCOMRL.exe -mod:RookiesTale

    It appears to work fine if I run that, and I'm confident cataclysm+ will run as well. :D

    I'll be checking them both out once I get done exploring Cogmind, which I just discovered. ;)

  • Kyzrati

    Glad you figured it out! It must be that your system was disallowing the -d switch on the batch file mods are currently using. Your solution is a good one, and how I would prefer to release mods, actually, but since standalone mods don't come with the core game data, running XCOMRL.exe directly will crash it and I don't want to confuse people by requiring that they open the main directory and find the file to run.

    "Obviously a lot can be done with this system."
    Tip of the iceberg, tip of the iceberg... :)

    Cogmind is a lot of fun, but very hard to beat. Good luck :)

  • sylverone

    Just finished my first run; got to level four, and did okay for a while until I got swarmed and all of my parts got blown off. Then I restocked and went running all over the level trying to find an exit but ended up in uncharted territory and my weakened core couldn't hold up. I'm going to send in my score file.

  • Kyzrati

    Level 4 is good for a first run of Cogmind. You'll certainly be able to get further with a better score if you can do that on your first try. Might as well send your score when it's more impressive :)

  • sylverone

    Hey, cool. I see you added a batch file inside the X@COM folder for the new version of A Rookie's Tale. That was a nice little surprise since I was getting ready to fire up notepad and do it myself. :) And yes, I use notepad on linux; I think it installed with Wine, and since it's conveniently there in my "open with" list, I use it. I find it humorous. ;P

  • Kyzrati

    That I did. Some Windows setups (including that used by Wine) won't let you run that batch file, and I learned that some players were writing their own batch files--one of the benefits of having more than a casual-level player base :) So I added a second one just in case. Later once we get a real front end we can do away with these batch files entirely...

Post a Comment

Note: Only a member of this blog may post a comment.