Author Topic: Is making a mod this easy?  (Read 2915 times)

Offline Bee

  • Sergeant
  • **
  • Posts: 10
    • View Profile
Is making a mod this easy?
« on: December 05, 2022, 01:10:16 pm »
So, I figured out how to work Mapview2 so I can change some things I don't like. It was good learning, but it was a struggle haha. I am not looking to make major changes. Everything I have done has been by editing the vanilla (OXCE, in this case) rulesets. Changing damage (power), armor, costs, research tree, etc.

If I am only doing things like that, is it just a matter of creating a folder, placing it in the mods folder, then within said folder, creating a metadata.yml file with the proper master, and then a ruleset file within a rulesert folder? I am just lookng at a mod I downloaded and this seems to be it.

So, if my changes are basic, can I not just copy over the original ruleset and make the changes I want within the mod folder, thereby leaving the vanilla ruleset intact, while creating a mod? It seems like this should be all there is to it, for my purposes.

Thank you.

Let me edit with example:
Say I want to alter all the alien armor values. Can I not just copy the original armors.rul file to my mod folder and make all the edits there? And in so doing I have a mod that overwrites the armor values while leaving all the vanilla values intact.
« Last Edit: December 05, 2022, 01:21:58 pm by Bee »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Is making a mod this easy?
« Reply #1 on: December 05, 2022, 02:04:30 pm »
If I understand you then yes, you could create a mod just as easily as creating a metadata.yml file and then copying those .rul files into your own mod folder and altering the variables.

However, you don't have to copy the entire armors.rul file if you are not altering all of the items.

When you make an entry with the same name as one already in vanilla X-Com's .rul file only variables you alter or add are effected.


For example in the original .rul file the Laser Rifle item:

Code: [Select]
items:
  - type: STR_LASER_RIFLE
    size: 0.2
    costSell: 36900
    weight: 8
    bigSprite: 0
    floorSprite: 0
    handSprite: 8
    bulletSprite: 6
    fireSound: 11
    hitSound: 19
    hitAnimation: 36
    power: 60
    damageType: 4
    accuracyAuto: 46
    accuracySnap: 65
    accuracyAimed: 100
    tuAuto: 34
    tuSnap: 25
    tuAimed: 50
    clipSize: -1
    battleType: 1
    twoHanded: true
    invWidth: 1
    invHeight: 3


This item could be altered in your mod to have a different BigOb, Power and Inventory Width and the rest of that equipment item's settings would still have their default values from the base game.

Meaning you only need to give a new value to those three variables without duplicating the rest in your mod.

Code: [Select]
items:
  - type: STR_LASER_RIFLE
    bigSprite: 700
    power: 85
    invWidth: 2


In the event that you want one or more of the base game's entries completely gone you could also delete it with this command.
Code: [Select]
items:
  - delete: STR_LASER_RIFLE

Once deleted you can recreate the STR_LASER_RIFLE item without it automatically importing any of its settings from the base game.

Or you can also just leave the item out of the game, there is no need to remake STR_LASER_RIFLE after deleting it if it is unwanted.
« Last Edit: December 05, 2022, 02:10:44 pm by The Martian »

Offline Bee

  • Sergeant
  • **
  • Posts: 10
    • View Profile
Re: Is making a mod this easy?
« Reply #2 on: December 05, 2022, 09:26:41 pm »
When you make an entry with the same name as one already in vanilla X-Com's .rul file only variables you alter or add are effected.

Thank you for this. This answered a future question I had too. It was a pain going through the items.rul when I wanted to adjust damage type, time units used, etc. So many entries. It's nice to know I can delete all the extra stuff and only use what I need in my "mod." Cuts down the lines in some of those .rul files by the hundreds, if not thousands haha. My mouse scroll wheel thanks you.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Is making a mod this easy?
« Reply #3 on: December 17, 2022, 12:21:39 am »
It is both easy and difficult. The difficulty is in dealing with syntax and learning to never make syntax mistakes. But if you can get past that, the essence of modding openxcom is very easy.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: Is making a mod this easy?
« Reply #4 on: December 18, 2022, 11:48:12 am »
Compared to another games - it is super easy. I have some experience in making mods (or at least learning how to make one or altering someone's work) for Stellaris, Kerbal Space Program, XCOM 2, UFO: Afterlight and Skyrim. OpenXcom mods are very limited, you can't do complicated things - changing or introducing new game systems, making new UI, etc. But doing simple things is super easy, it's just a plain ruleset editing. All of it has reference (https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)), and it has amazing tools for VS Code, that makes it no brain.
Say, in XCOM 2 you have to code a new unreal script to event add a new item and compile it, or KSP, where you have to code your own DLL with Unity API and cook engine assets to just make a new rocket part.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11727
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Is making a mod this easy?
« Reply #5 on: December 18, 2022, 01:07:29 pm »
Say, in XCOM 2 you have to code a new unreal script to event add a new item and compile it, or KSP, where you have to code your own DLL with Unity API and cook engine assets to just make a new rocket part.

Really? Lol, that's insane.

I agree, X-Com is very easy to mod, for a game of its complexity. I have history with modding several games as well, most notably Civilization: Call to Power and Alien Shooter 2. Some of their aspects were easier, but it was because they were not as complex games, so adding new elements was more straightforward.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: Is making a mod this easy?
« Reply #6 on: December 18, 2022, 03:59:39 pm »
Really? Lol, that's insane.

Yeah, that freaked me out too =)
This is all about code structure. See, all modern games use Object-oriented programming approach, where all code is made of different classes. Classes are essentially the blueprints for making different game objects. Say, in OpenXcom we have `RuleItem` class, and it creates an item from rulesets every time yaml parser see `- type:` under `items:` (well, not exactly like that, but it's just for simplicity). So all in-game items are essentially the same, they just have different properties, but they are all printed with the same logic, coded in `RuleItem` class.
Now, in XCOM 2 any item has to have own class, and in-game will be blueprinted from that specific class. So one class for assault rifle, one for sniper rifle, one for grenade and so on. That can (and AFAIK all items do) have some config settings, so you can specify damage output of your rifle without compiling your own code, but you can't make a brand-new item without making a new class for game logic.
On one hand, that puts modding of XCOM 2 to another level, and most XCOM 2 modders would be treated as engine coders in our OpenXcom community, as XCOM 2 mods (well, most of them) essentially alters the game code. On another, it makes XCOM 2 modders one head above, as they can actually change game logic in a way they want, without making own version of the game (not to mention, that you can't distribute whole commercial games as altered versions). So yes, you have to make a new unreal engine code to make a new item, but you can make it in a way you want it to work without any limitsSo yes, you have to make a new unreal engine code to make a new item, but you can make it in a way you want it to work without any strict limits (for example, in OpenXcom you can't make a psi amp that will also shoot, but it's easy in XCOM 2). With such approach, we can have global overhaul mods like Long War.
« Last Edit: December 18, 2022, 04:11:11 pm by Finnik »

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: Is making a mod this easy?
« Reply #7 on: December 18, 2022, 07:02:08 pm »
[...]or KSP, where you have to code your own DLL with Unity API and cook engine assets to just make a new rocket part.
Isn't that just for new functionality though?

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: Is making a mod this easy?
« Reply #8 on: December 24, 2022, 03:29:42 pm »
Isn't that just for new functionality though?
Yeah, coding new DLL with Unity is only for new functionality there. But since loading DLLs or anything like that is not going to be a thing (expect peerless y-scripts) in OXC, I guess, this is an off-topic...