rlcevg / CircuitAI

Spring RTS local native AI
GNU General Public License v2.0
19 stars 20 forks source link

Circuit only obeys disabledunits modoption in singleplayer games. #50

Closed GoogleFrog closed 7 years ago

GoogleFrog commented 7 years ago

Set disabledunits="turretlaser+turretmissile" in a singleplayer game and circuit will implement the option correctly. Note that I am talking about the modoption, not the AI option. The same setting in multiplayer does not work, circuit builds units that should be disabled. I have checked chobby and found no special handling for the disabledunits modoption.

As a stopgap I enforced disabledunits strictly here: https://github.com/ZeroK-RTS/Zero-K/commit/bc1659a3c0eb7611849a20cfa9d792b6a3575863

rlcevg commented 7 years ago

Looks like an old bug. !setoptions disabledunits=turretlaser+turretmissile does work as intended. Going to make new stable release.

rlcevg commented 7 years ago

Oops, wrong, doesn't work. Bug in regex?

GoogleFrog commented 7 years ago

I don't know. It differs between MP and SP so perhaps Springie sets modoptions in a different format to chobby? How does circuit read the modoption?

rlcevg commented 7 years ago

I already found bug in regex. Tdf/Lua tables shouldn't be parsed by regex (just like xml and html), but i don't want to add Tdf/Lua parsers. Trying to workaround with another pack of regexes.

An example of MP modoptions:

[modoptions]
{
commandertypes=ewog...;
startboxes=return { };
disabledunits=turretlaser+turretmissile;
}

"startboxes" ruins it all, and regex doesn't look after first "}" SP has either differrent order of params or doesn't have "startboxes" in it.

GoogleFrog commented 7 years ago

I don't recall setting startboxes with chobby. Those keys are just strings.

rlcevg commented 7 years ago

Regex monstro: "[modoptions]\s{([\s\S]+?(?=}\s([|$)))" https://github.com/rlcevg/CircuitAI/commit/0b17ffc6ba1ef09ecf9025469a9b0f4e91c87be9