Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Add support for ini file diff-mods. #3890

Closed
wzdev-ci opened this issue Jan 19, 2013 · 13 comments
Closed

Add support for ini file diff-mods. #3890

wzdev-ci opened this issue Jan 19, 2013 · 13 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_patch (an actual patch, not a request for one) | by NoQ


A patch that allows making mods that don't substitute whole ini files with their versions of them, but only substitute certain parameters in certain sections, relying on the base game to fill in the rest.

It does so by merging an extra QMap<QString, QVariant> object into WzConfig containing all overridden properties with their values.

Part 1 (trivial):
https://github.com/haoNoQ/warzone2100/commit/61fc55c24866c5ef6e0a754d0f76fe546b33c054
Part 2:
https://github.com/haoNoQ/warzone2100/commit/9d8e2ccdbbde224897600a1958aa398778d1ed89

I didn't yet think about what happens if two ini diff mods both modify the same parameter in the same file, but it seems easy to add such collision detection.


Issue migrated from trac:3890 at 2022-04-16 10:49:15 -0700

@wzdev-ci
Copy link
Contributor Author

NoQ changed type from bug to patch (an actual patch, not a request for one)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 9, 2013

Per commented


Do you have some example data?

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 9, 2013

NoQ commented


:oops: sorry didn't notice this message when i was on IRC.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 9, 2013

NoQ uploaded file test.wz (0.2 KiB)

Set viper body weight to 10000

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 9, 2013

NoQ uploaded file test2.wz (0.9 KiB)

Sets cobra price to 10000 and machinegun model to rocket superfortress weapon model. Can be used together with test.wz without conflicting on body.ini

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 9, 2013

NoQ uploaded file test3.wz (0.7 KiB)

Modify several things in a single file: set mg to HOMING-indirect and long-range, set tmg to penetrating. Still doesn't conflict with test.wz and test2.wz.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 9, 2013

NoQ uploaded file wz2100-20130210_084114-Sk-Mountain.jpg (295.6 KiB)

A screenshot ^__^
wz2100-20130210_084114-Sk-Mountain.jpg

@wzdev-ci
Copy link
Contributor Author

vexed commented


I am not sure about doing these mini mods / re:inis, on one hand, it does make mods much smaller, but on the other hand, just how the heck do we handle these things once we get multiple versions ?

This same thorn is with the mod support we have now though.
While we could setup a way to pick mods, the current thinking is to only allow only one mod loaded, or one mod per mod type.

I would wait a bit longer to see how we finally decide on how to do mod support.
If you have any idea, feel free to chime in. :)

@wzdev-ci
Copy link
Contributor Author

Cyp commented


Even if only allowing one mod, a delta probably has much more chance of being compatible with new versions of the game than just replacing whole files. (Haven't looked at the delta format to confirm this.)

@wzdev-ci
Copy link
Contributor Author

NoQ commented


Here are complete contents of the mods uploaded above.

test.wz:

/diffs/test/stats/body.ini

[Body1REC]
	weight = 10000

test2.wz:

/diffs/test2/stats/body.ini

[Body5REC]
	buildPower = 10000

/diffs/test2/stats/weapons.ini

[MG1Mk1]
	model = GNWPFRKT.PIE

test3.wz:

/diffs/test3/stats/weapons.ini

[MG1Mk1]
	movement = HOMING-INDIRECT
	longRange = 1920
	
[MG2Mk1]
	penetrate = 1

As you see, any changes in the game data will not be reverted back when loading such mod; it is simply not mentioned inside it, resolving quite a lot of problems.

Also, each such diff-mod stays inside its own PhysFS folder, never overwriting files of other diff-mods, so we can mod the same file twice without running into conflicts.

Also, it's trivial to add a check and throw an error when two diff-mods overwrite the same paremeter in the same file; something like that is not possible with our traditional mods.

@wzdev-ci
Copy link
Contributor Author

NoQ commented


One of the possible bad conditions may be when a weapon is removed from the game. If we load a diff-mod that modifies a weapon that no longer exists, then this weapon will appear again, with some completely weird default stats. Probably some work can be made to make sure that items with poorly initialized stats don't work, if at all they don't crash.

@wzdev-ci
Copy link
Contributor Author

Per changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

Per changed resolution from `` to fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant