documentation on modrules.lua?

documentation on modrules.lua?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

documentation on modrules.lua?

Post by SpliFF »

In every mod I've seen so far this file seems to have been copied from another mod. But where is the documentation on what everything means?

My mod never had this file and it used to work, now I get errors.

Checked the wiki and searched the forums. Searched Google too. Nada.

The only place I haven't checked yet is the source code but I know from experience it isn't always easy to work things out just by reading it.

Is there something I missed?
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: documentation on modrules.lua?

Post by Gnomre »

Here's ours from IW. I documented it as best I could from reading the source. However, it looks like I last messed with this file in late 2008 so the information might be outdated and there is likely new stuff by now.

Code: Select all

local modrules = {
	reclaim = {
		multiReclaim = false,		-- boolean - allow only 1 or >1 unit to simultaneously reclaim a feature/corpse
		unitMethod = 1,			-- int, 1
		unitEnergyCostFactor = 0,	-- float, 0
		unitEfficiency = 1,		-- float, 1
		featureEnergyCostFactor = 0,	-- float, 0
		allowEnemies = true,		-- bool, true
		allowAllies = true,		-- bool, true
		reclaimMethod = 0,		-- 0 is gradual reclaim (ie a small % is reclaimed every tick)
						-- 1 is current behaviour - ie one large hit of resources at the end of the reclim period
						-- >1 is chunky behaviour - reclaim happens in n equal sized chunks
	},
	repair = {
		energyCostFactor = 0.75,	-- how much of the original cost it requires to repair something.
	},
	resurrect = {
		energyCostFactor = 0.5,		-- default: 0.5
	},
	capture = {
		energyCostFactor = 0,		-- default: 0
	},
	transportability = {
		transportGround = true,	-- defaults to true	--Can [x] units be transported?
		transportHover = true,	-- defaults to false
		transportShip = false,	-- defaults to false
		transportAir = true,	-- defaults to false
	},
	flankingbonus = {
		defaultMode=0,		-- defaults to 1
	},				-- 0: no flanking bonus
					-- 1: global coords, mobile
					-- 2: unit coords, mobile
					-- 3: unit coords, locked

	experience = {
		experienceMult = 1.0,	-- defaults to 1.0

		-- these are all used in the following form:
		--   value = defValue * (1 + (scale * (exp / (exp + 1))))

		powerScale = 1.0,	-- float, 1.0
		healthScale = 0.7,	-- float, 0.7
		reloadScale = 0.4,	-- float, 0.4
	},
	fireatdead = {
		fireAtKilled = false,
		fireAtCrashing = false,
	},
	construction = {
		constructionDecay = true,	-- bool, true
		constructionDecayTime = 8,	-- float, 6.66
		constructionDecaySpeed = 1,	-- float, 0.03
	},
	sensors = {
		los = {
			losMipLevel = 4,	-- int, 1, must be -1 < n < 7
			losMul = 1,		-- float, 1
			airMipLevel = 2,	-- int, 2, must be -1 < n < 31
			airLosMul = 1,		-- float, 1
		},
		requireSonarUnderWater = true,	-- bool, true
	},
	nanospray = {
		allow_team_colours = false,
	},
}

return modrules
I'd also look at CA's modrules file since they're probably more up to date.
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: documentation on modrules.lua?

Post by SirMaverick »

SpliFF wrote:In every mod I've seen so far this file seems to have been copied from another mod. But where is the documentation on what everything means?
Any specific questions?
I'd also look at CA's modrules file since they're probably more up to date.
Last time I checked it was complete, I even added stuff set to default values (because people look at CA first).
I used rts/Sim/Misc/ModInfo.* as reference, it doesn't really have much more comments.

Edit: typo
Last edited by SirMaverick on 11 Sep 2010, 16:09, edited 1 time in total.
User avatar
SpliFF
Posts: 1224
Joined: 28 Jul 2008, 06:51

Re: documentation on modrules.lua?

Post by SpliFF »

The comments in the the above mentioned examples tell you what values are allowed. They don't tell you what the values do.

Some may be obvious, others not. For example flankingBonus requires an understanding of how the engine handles flanking (and knowing what flanking even means in a global context). You need to know how mip levels relate to line of sight. Understanding reclaim and nanospray requires a knowledge of Total Annihilation.

Are both files even complete lists?

Anyway I don't have any specific question except where is the documentation? Is there a specific file in the source code where these things have further explanation or has it been assumed everybody knows what they mean?

If I have any specific question it's whether or not this file is required. I didn't have it and spring crashed expecting a table to be returned. Can I return an empty table? Many of these values are meaningless to my game. I'd rather leave out what I don't need to keep the mod 'clean'.

I don't mean to come off as whiney, I expect there actually isn't any documentation, I'm just urging Spring devs to document these changes as they move things out of the engine or we'll end up with thousands of meaningless configuration options that get set through trial and error. That's no way to make a game.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: documentation on modrules.lua?

Post by FLOZi »

SpliFF wrote: If I have any specific question it's whether or not this file is required. I didn't have it and spring crashed expecting a table to be returned. Can I return an empty table? Many of these values are meaningless to my game. I'd rather leave out what I don't need to keep the mod 'clean'.
Shouldn't do that in 0.82+. This works fine for me:
A.sd7
(309 Bytes) Downloaded 44 times
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: documentation on modrules.lua?

Post by SirMaverick »

SpliFF wrote:Are both files even complete lists?
As I wrote CA's list seems complete. Source code hasn't changed after last time I checked.
Anyway I don't have any specific question except where is the documentation?
Afaik no further documentation.
If I have any specific question it's whether or not this file is required. I didn't have it and spring crashed expecting a table to be returned. Can I return an empty table? Many of these values are meaningless to my game. I'd rather leave out what I don't need to keep the mod 'clean'.
Returning empty table sets default values.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: documentation on modrules.lua?

Post by raaar »

the

Code: Select all

   transportability = {
      transportGround = true,   -- defaults to true   --Can [x] units be transported?
      transportHover = true,   -- defaults to false
      transportShip = false,   -- defaults to false
      transportAir = true,   -- defaults to false
   }
could use a

allowEnemies = true, -- bool, true

so people could disable transports kidnapping enemy units.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: documentation on modrules.lua?

Post by trepan »

See the transportByEnemy unitDef tag.
raaar
Metal Factions Developer
Posts: 1094
Joined: 20 Feb 2010, 12:17

Re: documentation on modrules.lua?

Post by raaar »

trepan wrote:See the transportByEnemy unitDef tag.
[opens the wiki]

http://springrts.com/wiki/Units:FBI
...
http://springrts.com/wiki/All_FBI-varia ... lt%2C_type
...

it isn't there ._.

But it shows up on some posts.

There's a post by smoth from 2007:
transportByEnemy=0;

Fixes all unit naping.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: documentation on modrules.lua?

Post by FLOZi »

18+ month bump:

http://springrts.com/wiki/Modrules.lua

Go forth and find errors, my minions. 8)
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: documentation on modrules.lua?

Post by knorke »

allow_team_colors just got removed:
https://github.com/spring/spring/commit ... 06e0d99158
User avatar
The Nixtux
Posts: 11
Joined: 13 Dec 2010, 10:26

Re: documentation on modrules.lua?

Post by The Nixtux »

We use nano spray tag in tech annihilation . As nano spray is colored per faction not per team. Removal of tag was unwelcome imho
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: documentation on modrules.lua?

Post by smoth »

Is there a way for gamedevs to replace this? If it exists, please post it for the xta guy and drama avoided.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: documentation on modrules.lua?

Post by knorke »

s nano spray is colored per faction not per team.
i guess the nanoColor tag in unitdefs still works
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: documentation on modrules.lua?

Post by Forboding Angel »

Nevermind, changing that was stupid. Who is "RT?"
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: documentation on modrules.lua?

Post by Google_Frog »

I think allowUnitCollisionDamage = false disables all damage caused by unit-wreck, unit-unit and unit-ground collisions.
User avatar
The Nixtux
Posts: 11
Joined: 13 Dec 2010, 10:26

Re: documentation on modrules.lua?

Post by The Nixtux »

Just checked and team color nano spray overrides any unidef setting.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: documentation on modrules.lua?

Post by smoth »

knorke wrote:
s nano spray is colored per faction not per team.
i guess the nanoColor tag in unitdefs still works
Forboding Angel wrote:Nevermind, changing that was stupid. Who is "RT?"
if the tag knorke cited works then I don't agree forb.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: documentation on modrules.lua?

Post by FLOZi »

It works but the players team-nano setting takes priority over it <-- should be fixed.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: documentation on modrules.lua?

Post by smoth »

agreed
Post Reply

Return to “Engine”