More moddable modules

Ideas and suggestions for how to improve the Warzone 2100 base game only. Ideas for mods go in Mapping/Modding instead. Read sticky posts first!
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

More moddable modules

Post by Shadow Wolf TJC »

You know how, when you apply a module to a power plant, factory, or research lab, the structure seems to change shape, and be given a bonus to power generation, production, and research rates respectively? However, I don't think that modules have any effect on the structure's stats, such as HP, armor, etc. Also, they seem to be restricted to just those 3 kinds of buildings, and it seems as if only one choice of module is available for each structure. What if someone wanted to apply the idea of upgrading structures through modules to other kinds of structures, like, say, HQs, Repair Facilities, defenses, or even Oil Derricks? What if someone wanted to have the choice of whether to upgrade one factory with a production speed bonus, or give it additional HP and armor?

What I'd like to propose is for modules to, instead of adding their functions to existing structures without changing them, actually transform structures into other structures, with the new structure's stats overwriting the old structure's stats. For example, if a Factory Module was applied to a Light Factory, instead of preserving the factory's name ("A0LightFactory") and stats, it would transform the structure object to, say, a Medium Factory. The new structure would still retain some of the old structure's object properties, such as id, player, and coordinates, but properties such as the structure's name (which would be changed to, say, "A0MediumFactory"), stats, and base production speed (which would still be defined in functions.txt) would all change. Alternatively, the player could instead opt to apply an "Armored Structure" module to the Light Factory, transforming it into, say, an "Armored Light Factory", with similar production rates to a "Light Factory", but far more HP and armor (and its name property changed to, say, "A0LightFactoryArmored").

Some possible questions/comments that could arise:

How would modders be able to determine what is a module and what isn't a module?
- Modules could be defined in functions.txt, in which they'd take the following example format:

Code: Select all

Module Function, A0FacMod1, A0LightFactory, A0MediumFactory
Module Function, A0FacMod1, A0MediumFactory, A0HeavyFactory
Module Function, A0FacMod1, A0LightFactoryArmored, A0MediumFactoryArmored
Module Function, A0FacMod1, A0MediumFactoryArmored, A0HeavyFactoryArmored
Module Function, A0FacMod1, A0VtolFactory1, A0VtolFactory2
Module Function, A0FacMod1, A0VtolFactory2, A0VtolFactory3
Module Function, A0FacMod1, A0VtolFactory1Armored, A0VtolFactory2Armored
Module Function, A0FacMod1, A0VtolFactory2Armored, A0VtolFactory3Armored
Module Function, A0FacModArmor, A0LightFactory, A0LightFactoryArmored
Module Function, A0FacModArmor, A0MediumFactory, A0MediumFactoryArmored
Module Function, A0FacModArmor, A0HeavyFactory, A0HeavyFactoryArmored
Module Function, A0FacModArmor, A0VtolFactory1, A0VtolFactory1Armored
Module Function, A0FacModArmor, A0VtolFactory2, A0VtolFactory2Armored
Module Function, A0FacModArmor, A0VtolFactory3, A0VtolFactory3Armored
Module Function, A0FacModArmor, A0CyborgFactory, A0CyborgFactoryArmored
Production,FacProd1,LIGHT,10
Production,FacProd2,MEDIUM,20
Production,FacProd3,HEAVY,30
The extra FacProd entries on the bottom would most likely be assigned to the new structures in structurefunctions.txt.

Clicking on an existing structure that can be upgraded, such as, say, a Light Factory, while having a truck selected would normally order the truck to automatically upgrade the structure. What would happen to this feature if structures can choose from more than 1 module to be upgraded with?
- If both modules are available to a player, then the module that's placed higher up on functions.txt could be given priority over those lower on the list. For example, using the code list above, the truck would automatically choose to upgrade the Light Factory into a Medium Factory instead of an Armored Light Factory.

Won't compatability with older mods break?
- Depends on the mod. This would only be true if the mod modified structures.txt, functions.txt, and/or structurefunctions.txt (and possibly rules.js), meaning that mods such as NoQ's Ultimate Scavengers Mod, and my own Contingency Mod, would most likely require an update. Texture mods, tileset mods, or skybox mods would probably still work.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
aubergine
Professional
Professional
Posts: 3462
Joined: 10 Oct 2010, 00:58

Re: More moddable modules

Post by aubergine »

Some mods might break if they use enumStruct() with structure id rather than type - eg. if they are expecting their tank factories to always have an id of "A0LightFactory".

NullBot does exactly that:

Code: Select all

const	lab = "A0ResearchFacility";
const	factory = "A0LightFactory";
const	command = "A0CommandCentre";
const	generator = "A0PowerGenerator";
const	derrick = "A0ResourceExtractor";
const	borgfac = "A0CyborgFactory";
const	vtolfac = "A0VTolFactory1";
const	vtolpad = "A0VtolPad";
const	satlink = "A0Sat-linkCentre";
const	lassat = "A0LasSatCommand";
const	oilres = "OilResource";
const	cbtower = "Sys-CB-Tower01";
const	oildrum = "OilDrum";
const	artifact = "Crate";
That's from top of nullbot-*-header.js.inc file.

Rather than changing the id of the structure after the upgrade, maybe it could be done using some sort of 'overlay' of it's properties.

So different research modules, for example, would overlay different stats on top of the base research lab.

It might be that you want a lab that's very good at researching weapons (turrets, rof, damage, etc) so you upgrade it with modules that specialise in weapons research.

The base research lab would have one set of stats, for example:

* cost to build, time to build, etc.
* weapon research bonus
* research research bonus
* unit research bonus
* armour research bonus
* etc.

Then a module would simply add to the bonuses as applicable. So I could build 4 weapon research modules if I want to max out the lab's weapon research bonus.

The lab id would remain the same, maybe there could be some way to access it's properties to see what the lab is best at researching.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: More moddable modules

Post by Shadow Wolf TJC »

@aubergine: We could indeed expand how modules currently add their stats to existing structures, but I've been thinking about applying the concept of upgrading with modules to replace old outdated defenses with newer more state-of-the-art defenses, with more state-of-the-art weapons (like, say, upgrading Lancer Hardpoints into Tank Killer Hardpoints, and then into Scourge Hardpoints), and I doubt that what you're proposing would work in this case.

Anyways, I doubt that this would be implemented anytime soon, as like I said before, it would likely break compatability with older mods. Then again, the Warzone 2100 Project has added new things before (like Gates and the Super Transport) that broke compatability with older mods, including Iluvalar's NRS mod I believe, when they made the jump from the 2.3.x series to 3.1.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100