Reading RulesParams from AI

Reading RulesParams from AI

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
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Reading RulesParams from AI

Post by aeonios »

I recently updated the zk ai I've been working on to the latest dev engine (101.0.1-414-g6a6a528) and found that there were some changes to the way unit/gamerulesparams are handled by the ai interface. While I think the new system is definitely cleaner than the old one there is no longer any way to read out the full list of rules params anymore which makes development more difficult/impossible. You need to know the exact name of the rulesparam you're looking for before you can get its value, and rules params are badly documented and scattered all over the place in lua so reading them out directly is generally better than trying to reverse engineer from the game source.
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Reading RulesParams from AI

Post by hokomoko »

Can you give a concrete example of a place where a full list is needed?
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Reading RulesParams from AI

Post by aeonios »

Take mexes for example. In zk they have at least two different rules params regarding how much metal they produce: mexIncome and current_metalIncome (I think they were called). The first describes only base income and the second includes overdrive. I ended up using those values as eco measures because it's more reliable for separating the influence of reclaim and overdrive, but without being able to print out all the rulesparams for mexes I wouldn't have been able to find that out. Unarmed status for bombers was similar. There might be other useful things but because of the changes I can't test anything.
hokomoko
Spring Developer
Posts: 593
Joined: 02 Jun 2014, 00:46

Re: Reading RulesParams from AI

Post by hokomoko »

That's an example of using a "print all params" as an offline development aid, which is already available in lua (you can widget this easily, no need to compile etc.)

the AI interface is there for online use, do you have a concrete example for that?
Post Reply

Return to “Engine”