Jump to content
Sign in to follow this  
fatherbushido

Some auras and techs json syntax

Recommended Posts

For fixing some bugs I am changing the auras and technology affects syntax in the json files.

I would request inputs from @Nescio or @wowgetoffyourcellphone  (not exclusive) as currently active modders about what they prefer between type A and type B.

Type A:

affects: [["Pork", "Beans"]]

affects: [["Pork"]]

affects: [["Pork"], ["Bean"]]

Type B:

affects: "Pork+Beans"

affects: "Pork"

affects: "Pork Bean"

  • Like 1

Share this post


Link to post
Share on other sites

For example in: https://github.com/JustusAvramenko/delenda_est/blob/master/simulation/data/technologies/advanced_unit_bonus.json


{
	"genericName": "Stats for advanced units",
	"autoResearch": true,
	"description": "These stat modifications will be applied to advanced and elite units.",
	"modifications": [
		{"value": "ResourceGatherer/BaseSpeed", 	"multiply": 0.75                        		},
		{"value": "Health/Max",						"multiply": 1.1                       			},
		{"value": "Armour/Hack",					"add":      1                           		},
		{"value": "Armour/Pierce",					"add":      1                           		},
		{"value": "Armour/Crush",					"add":      1                           		},
		{"value": "UnitMotion/WalkSpeed",			"multiply": 0.95, "affects": "Infantry" 		},
		{"value": "UnitMotion/WalkSpeed",			"multiply": 0.95, "affects": "Cavalry"  		},
		{"value": "Attack/Ranged/Damage/MaxRange",	"multiply": 1.2,  "affects": "Ranged"   		},
		{"value": "Vision/Range",					"multiply": 1.2,  "affects": "Ranged"   		},
		{"value": "Attack/Ranged/Damage/Spread",	"multiply": 0.90, "affects": "Ranged"   		},
		{"value": "Attack/Melee/Damage/Hack",		"multiply": 1.1,  "affects": "Melee"    		},
		{"value": "Attack/Capture/Capture",			"multiply": 1.1                         		},
		{"value": "Heal/Range",						"multiply": 1.1,  "affects": "Healer"   		},
		{"value": "Vision/Range",					"multiply": 1.1,  "affects": "Healer"   		},
		{"value": "Heal/HP",						"multiply": 1.1,  "affects": "Healer"   		},
		{"value": "Cost/Resources/food",			"add": 5,  		  "affects": "Citizen Soldier -Mercenary"	},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Archer -Mercenary"   		},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Spear -Mercenary"    		},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Javelin -Mercenary"  		},
		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Crossbow -Mercenary" 		},
		{"value": "Cost/Resources/metal",			"add": 5,  		  "affects": "Sword -Mercenary"    		},
		{"value": "Cost/Resources/metal",			"add": 5,  		  "affects": "Sling -Mercenary"    		},
		{"value": "Cost/Resources/glory",			"add": 5,  		  "affects": "Healer"   		},
		{"value": "Cost/BuildTime",					"add": 2,  		  "affects": "Citizen"			}
	],
	"affects": ["Advanced Unit", "Elite Unit"]
}

 

Which one of those two things would you prefer (in any case there are scripts to do it auto):

"affects": [["Advanced", "Unit"], ["Elite", "Unit"]]

or

"affects": "Advanced+Unit Elite+Unit"

 

Share this post


Link to post
Share on other sites
2 hours ago, fatherbushido said:

For fixing some bugs I am changing the auras and technology affects syntax in the json files.

What exactly is wrong with the current syntax? I'm not saying is perfect, but I'm used to it now.

If it is to be changed, I'd recommend following the syntax used in the xml templates, i.e. a space means “or” and a plus means “and”.

20 minutes ago, fatherbushido said:

"affects": "Advanced+Unit Elite+Unit"

 

I'd also favour that one (less typing than the alternative with square brackets). This would even be shorter:

	"affects": "Unit+(Advanced Elite)"

(I'm not entirely sure that's an improvement, though.)

Share this post


Link to post
Share on other sites
8 minutes ago, Nescio said:

What exactly is wrong with the current syntax? I'm not saying is perfect, but I'm used to it now.

It's bugged and source of confusions.

I expected that the second form I suggested would be preferred. I will opt for that one.

The shorter form you suggest can't be supported. You need to put things in disjunctive normal form.

Edited by fatherbushido

Share this post


Link to post
Share on other sites
4 minutes ago, fatherbushido said:

It's bugged and source of confusions.

I expected that the second form I suggested would be preferred. I will opt for that one.

Once you've done that in your fork, perhaps you could consider making a patch for 0 A.D. as well?

I don't know if and when you intend to release your project, but having a different syntax would mean more work for modders, if they decide to switch or port from one to the other.

41 minutes ago, fatherbushido said:

		{"value": "Cost/Resources/wood",			"add": 5,  		  "affects": "Archer -Mercenary"   		},

 

Shouldn't that be "Archer+!Mercenary"?

Share this post


Link to post
Share on other sites
17 minutes ago, Nescio said:

 but having a different syntax would mean more work for modders, if they decide to switch or port from one to the other.

Indeed that's problematic :/

We try to document the more we can and I had already offered to helping in converting mods. If there are massive changes, we try to make them scriptable.

17 minutes ago, Nescio said:

Shouldn't that be "Archer+!Mercenary"?

Yes it should. (But anyway none of them will work as expected here.)

Share this post


Link to post
Share on other sites
22 minutes ago, Nescio said:

I don't know if and when you intend to release your project, but having a different syntax would mean more work for modders, if they decide to switch or port from one to the other.

 

Welcome to my world.

  • Like 1

Share this post


Link to post
Share on other sites
On 4/16/2020 at 12:18 PM, fatherbushido said:

:D

So you are trying to no have mods.

You must release a fist version then change the syntax.

Share this post


Link to post
Share on other sites
25 minutes ago, Lion.Kanzen said:

So you are trying to no have mods.

Not at all mate :/

I even offered to do the job.

25 minutes ago, Lion.Kanzen said:

You must release a fist version then change the syntax.

I didn't understand

Share this post


Link to post
Share on other sites
Just now, fatherbushido said:

Not at all mate :/

I even offered to do the job.

I didn't understand

You must have a release  or you project then you can make the syntax if you don't follow this way you probably don't have any modder in your project.

Share this post


Link to post
Share on other sites

Greetings bushido

There are enough capricious and arbitrary changes being made in this world. This change would directly affect me e.g.

"affects": "mod maintainer",

What is the benefit to changing how these tech targets are parsed? Which bug(s) does it address?

Thank you for your time.

  • Like 1

Share this post


Link to post
Share on other sites

As far as I know MatchesClassList supports A and B variants already.

For reference

"A B+C" == A or (B and C)

Share this post


Link to post
Share on other sites

Oh, 
I see what can cause confusion. It is mixed version, I do not like that one really.
Btw @wowgetoffyourcellphone if you want "value": "Cost/Resources/wood", "add": 5, "affects": "Archer !Mercenary"  to be Archer AND NOT Mercenary you need to enclose that into [ ] so it would be like

["Archer !Mercenary"] what can be ["Archer+!Mercenary"] (I know, bleh)

or

"Archer+!Mercenary"

or

[["Archer", "!Mercenary"]]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...