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 » 10 Sep 2010, 13:12

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?
0 x

Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: documentation on modrules.lua?

Post by Gnomre » 10 Sep 2010, 16:55

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.
0 x

SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: documentation on modrules.lua?

Post by SirMaverick » 10 Sep 2010, 23:51

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.
0 x

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

Re: documentation on modrules.lua?

Post by SpliFF » 11 Sep 2010, 07:07

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.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6109
Joined: 29 Apr 2005, 01:14

Re: documentation on modrules.lua?

Post by FLOZi » 11 Sep 2010, 12:53

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 43 times
0 x

SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: documentation on modrules.lua?

Post by SirMaverick » 11 Sep 2010, 16:15

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.
0 x

raaar
Metal Factions Developer
Posts: 817
Joined: 20 Feb 2010, 12:17

Re: documentation on modrules.lua?

Post by raaar » 12 Sep 2010, 02:14

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.
0 x

trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: documentation on modrules.lua?

Post by trepan » 12 Sep 2010, 02:25

See the transportByEnemy unitDef tag.
0 x

raaar
Metal Factions Developer
Posts: 817
Joined: 20 Feb 2010, 12:17

Re: documentation on modrules.lua?

Post by raaar » 24 Sep 2010, 00:22

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.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6109
Joined: 29 Apr 2005, 01:14

Re: documentation on modrules.lua?

Post by FLOZi » 03 Apr 2012, 20:30

18+ month bump:

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

Go forth and find errors, my minions. 8)
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: documentation on modrules.lua?

Post by knorke » 03 Apr 2012, 22:56

allow_team_colors just got removed:
https://github.com/spring/spring/commit ... 06e0d99158
0 x

User avatar
The Nixtux
Posts: 11
Joined: 13 Dec 2010, 10:26

Re: documentation on modrules.lua?

Post by The Nixtux » 03 Apr 2012, 23:25

We use nano spray tag in tech annihilation . As nano spray is colored per faction not per team. Removal of tag was unwelcome imho
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: documentation on modrules.lua?

Post by smoth » 04 Apr 2012, 00:43

Is there a way for gamedevs to replace this? If it exists, please post it for the xta guy and drama avoided.
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: documentation on modrules.lua?

Post by knorke » 04 Apr 2012, 03:02

s nano spray is colored per faction not per team.
i guess the nanoColor tag in unitdefs still works
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14603
Joined: 17 Nov 2005, 02:43

Re: documentation on modrules.lua?

Post by Forboding Angel » 04 Apr 2012, 06:09

Nevermind, changing that was stupid. Who is "RT?"
0 x

Google_Frog
Moderator
Posts: 2440
Joined: 12 Oct 2007, 09:24

Re: documentation on modrules.lua?

Post by Google_Frog » 04 Apr 2012, 07:40

I think allowUnitCollisionDamage = false disables all damage caused by unit-wreck, unit-unit and unit-ground collisions.
0 x

User avatar
The Nixtux
Posts: 11
Joined: 13 Dec 2010, 10:26

Re: documentation on modrules.lua?

Post by The Nixtux » 04 Apr 2012, 09:17

Just checked and team color nano spray overrides any unidef setting.
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: documentation on modrules.lua?

Post by smoth » 04 Apr 2012, 14:37

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.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6109
Joined: 29 Apr 2005, 01:14

Re: documentation on modrules.lua?

Post by FLOZi » 04 Apr 2012, 15:01

It works but the players team-nano setting takes priority over it <-- should be fixed.
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: documentation on modrules.lua?

Post by smoth » 05 Apr 2012, 00:32

agreed
0 x

Post Reply

Return to “Engine”