Force a gameover with mods

1

I was wondering if it was possible to make a mod to force a game to end, without killing the coms outright.

If it was possible to do and also to make it an option in lobby (off;5min;10min;15min;30min) it could make for some interesting games

And I guess also have it show up a countdown counter UI element ingame, but I think it would be a little bit more complex

0

I think you'd want it to force a score victory, but yes - I might actually try more custom games with such an option.

0

@Raquaza

Some ideas:
Most score or mex output after 30 minutes wins.
Kill all enemy factories to win
1st who builds an experimental wins. (excluding monkey lord)

End game conditions based on unit count or time is easy to implement.
We could first build this as external mod and later implement it to the game itself.

So yes, its possible.

0

Yes, building these functionalities would be my focus, but at this point I'd be asking if anyone has any insights on what to touch on for the win conditions (code wise) and mostly for the ui side of the mod since I would love it to make very modular to create a lot more gametypes

0

These are the victory conditions:
https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/victory.lua#L3

local victoryCategories = {
    demoralization=categories.COMMAND,
    domination=categories.STRUCTURE + categories.ENGINEER - categories.WALL,
    eradication=categories.ALLUNITS - categories.WALL,
}

demoralization: game ends when we have no ACU left (Unit with blueprint category 'COMMAND')
domination: game ends if we have not structures or engineers left.
eradication: game ends if we have no unit left (except walls)

Here is the function that checks the victory:
https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/victory.lua#L42
This line is getting the Victory options:

local categoryCheck = victoryCategories[scenarioInfo.Options.Victory]

This is the line where the victoyCategories are checked:
https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/victory.lua#L55

And this leads to the function that is actually checking the real units against the victoryCategories:
https://github.com/FAForever/fa/blob/deploy/fafdevelop/lua/victory.lua#L9

So the function AllUnitsInCategoryDead() returns true if all units depending on the victoryCategories table are dead.

You can modify the game here to return true or false to end the game for a player.

0

Interesting stuff, for the past hour I've been trying to get some of those elements modified/working through mods but I will need a bit more time to have something worthwhile (and not prone to crashing on startup).

The only doubt I'd have at this moment would be the ability to end the game after a certain time, since it doesn't seem I can change the original function and I'd have to make a parallel function to check the time, but maybe I can disable the original function based on the victory condition?

Oh and also, there isn't a good way to modify the lobbyOptions file apart from copying the file, scrolling through the options and then replace the wanted element with a copy of itself, right?

0

I am sorry you can't modify the lobby with a mod.
Mods will be loaded on game scenario start (when you leave the lobby).

So ignore the options for a while.

in case you need help with your mod, please zip your mod and post it here.
This way we can test it and add some lines if needed.

[Edit] Options for mods will be available soon:
https://github.com/FAForever/fa/pull/3144

0

If you mod decides that the game should be over, it could instantly kill all ACUs from the losing side.

It could even do something like add 50,000 health to the ACUs for the winning team, to make it much less likely that they would die (whether from ACU explosions or for some other reason).

0

@arma473

yes, exploding ACUs would look awesome, but its not needed codewise.
You can simply set who is winner and who not and just call the the endgame function.