OpenXcom Forum
Modding => Work In Progress => Topic started by: SupSuper on October 17, 2012, 07:22:32 pm
-
Since there's been a lot of modding talk lately, I figured I'd post about this feature here first, since it's still experimental and you guys are probably best fit to try it out and let me know how it works before I let it out into the wild. :) You can use the Git Builds (https://openxcom.org/index.php/downloads/git-builds/) (and eventually 0.4.5) to try it out.
Anyways, one of the first stepping stones in the big road to full moddability are "modular rulesets". What does this mean? Well currently, if you wanna make your own mod for OpenXcom, you have to make your own modded version of the fuckin' huge Xcom1Ruleset to distribute with it. Then you have to bitch everytime it changes and you have to update your mod, bitch everytime you wanna change your mod and find yourself editing a fuckin' huge file, and gawd forbid you wanna use multiple mods because you'll have to merge them all yourself into some new frakenstein version of Xcom1Ruleset (and bitch a lot). :o
Well in 0.4.5, modular rulesets put an end to all that! The principle is that each mod ruleset should only contain what it mods, not the whole picture. For example, taking this example (https://openxcom.org/forum/index.php/topic,668.0.html), you could make a XcomutilInterceptor.rul with just this:
crafts:
- type: STR_INTERCEPTOR
soldiers: 6
vehicles: 1
battlescapeTerrainData:
name: INTERC
mapDataSets:
- BLANKS
- PLANE
mapBlocks:
- name: INTERC
width: 10
length: 10
That's it! No more need to lug around the entire Xcom1Ruleset around! Any updates won't affect your mod, and you have a much more manageable file to take care of. But wait, how do I put it into OpenXcom? Well there's a new "rulesets" section in your options.cfg, you just have to add it there:
rulesets:
- Xcom1Ruleset
- XcomutilInterceptor
And voilá! Your mod is now in effect. No muss, no fuss. OpenXcom will load all the rulesets specified one by one, combining them all in runtime for you, so in the end you get the all the mods running together. :) Note that order matters! Xcom1Ruleset must come first as it's the "base ruleset", otherwise it'll end up overriding any rulesets that come before it.
-
Great feature. What with changing existing objects, if you want to, let's say, change the building cost of a laboratory to 800000, you make a file with just:
facilities:
- type: STR_LABORATORY
buildCost: 800000
Will that work?
Never mind, it works :p
-
oh, that is VERY nice. I'll have to find some time to play around with that. adding new weapons, for example. that should be possible, right? I just have to define them in a ruleset file.
...all we need now is loading graphics from .png files... and loading files from .zip archives, so we can put all relevant files into one .zip archive and load them from there :) :) :)
-
Great feature. What with changing existing objects, if you want to, let's say, change the building cost of a laboratory to 800000, you make a file with just:
facilities:
- type: STR_LABORATORY
buildCost: 800000
Will that work?
Never mind, it works :p
Yeah, the way it works is that when loading rulesets, OpenXcom simply keeps loading new info on top of the old one, instead of "starting from scratch", and it checks the IDs to see if it's a new entry or an update to an existing one, so in the end you get everything combined cleanly (assuming there's no conflicts between mods :P).
Technically this has been supported from the start, it just took the (oh so painful) removal of the hardcoded XcomRuleset.cpp to get it going.
oh, that is VERY nice. I'll have to find some time to play around with that. adding new weapons, for example. that should be possible, right? I just have to define them in a ruleset file.
...all we need now is loading graphics from .png files... and loading files from .zip archives, so we can put all relevant files into one .zip archive and load them from there :) :) :)
Patience. ;)
-
Would it be possible to combine this with the UFOPedia entry as well? e.g. you can add the following string at the end of your definition:
STR_INTERCEPTOR_UFOPEDIA
COMBAT AIRCRAFT WITH HYDROGEN TURBORAMJET ENGINES AND SPECIALLY SHIELDED ELECTRONIC SYSTEMS. THE BEST AVAILABLE EARTH BASED TECHNOLOGY.
It would replace the stock text?
-
There are plans to eventually bring Languages, Resources and Rulesets all under one optimum moddability banner. Again, patience. I'd really like to hear about people trying out this feature and finding any issues first. :P
-
OK , i have tested this function with a separate" Dawn City" Ruleset , everything appears to work except this map set has a few issues in Openxcom , i want to test it a few times in the original before i start blaming Daiky as it may be something to do with how its made.
That being said , its a really nice set and i am tempted to spend a few nights tweaking it to my own tasts
-
Luke83, that picture is... :o ;D
-
... sweet! 8) 8)
-
Yep there was a few issues in the Mapset - but the code to add doesn't seem to be the issue ( well at this moment i dont think its the new code causing the issues).
--- posts merged ---
Had me scratching my head as to what was goign on until i loaded my CF terror maps back into game , Supsuper , it appears this is Mixing my Defualt URBAN set ( in this case its Hobbes DAWN MAP) with my additional " modular" set instead of replacing it , i think the screen shot shows it rather well.
The result is rather interesting to look at :)
-
Could you post the rulesets (and related files) you used for me to test it out?
-
As requested , i think its everything you will need.
-
Ok this should be fixed now.
-
Just trying this again and i got this error, i have double checked all my game files , i THINK there all correct so maybe someone can tell me the normal cause of this Error message?
Also is there a LOG in Openxcom yet?
-
Thats an STL vector out of bounds access getting caught in a debug build by debug only error checks in the STL
some code is trying to access element N of a vector of less than N+1 elements in length.
-
ok ???, so lets dumb it down another notch, Is this something i am doing or a bug or you cant tell?
-
Most likely a bug, can you reproduce the problem reliably? What is your configuration? Can you provide a save that causes it? Are you using modified files? (ruleset, tiles, map)
-
Can you comment in Rulesets, e.g.:
https://This is a comment?
-
Yes you can make comments in YAML with # This is a comment
-
Any progress towards replacement text strings in the rulesets or are you just waiting until after OXCOM is finally pretty much completable and done for this "chrome"?
-
PS : I answered below to your error, before seing that this error is in fact old of 4 monthes. You certainly fixed it, but as I spent some time to write this answer, I keep it, perhaps it will help someone else in the future...
@SupSuper : modular ruleset are a must, it's a pleasure to modify them or create sub rulesets !
As I met same error message, and you are apparently working on terror missions, I had a look at your ruleset and I saw some errors
Check at lines 3824-3826 : you defined only one itemSet for alienRank 6
You have to define one itemSet for each of three technology advancement levels
Also replace
itemSets:
-
[]
with
itemSets:
-
[]
-
[]
-
[]
Same at lines 3814-3818
itemSets:
-
- STR_PLASMA_PISTOL
- STR_PLASMA_PISTOL_CLIP
- STR_ALIEN_GRENADE
to be replaced with
itemSets:
-
- STR_PLASMA_PISTOL
- STR_PLASMA_PISTOL_CLIP
- STR_ALIEN_GRENADE
-
- STR_PLASMA_PISTOL
- STR_PLASMA_PISTOL_CLIP
- STR_ALIEN_GRENADE
-
- STR_PLASMA_PISTOL
- STR_PLASMA_PISTOL_CLIP
- STR_ALIEN_GRENADE
You should make same correction for TerrorShip
And if you are intended to test other UFOs, I can see following are wrong too
3856
3864
3877
3887
-
Any progress towards replacement text strings in the rulesets or are you just waiting until after OXCOM is finally pretty much completable and done for this "chrome"?
This will probably come after 1.0 when I focus again on moddability.