Victory! In Lua!

I don’t remember exactly what triggered it, a combination of things – waiting for several slow SVN updates, the game compiling in the background, and an email from Doc to the production and godsofwar mailing lists were on-hand when I started.

So I started hashing out a system way to describe Victory Conditions in Lua.

— — — — — — — — — — — — — — — — — — — — — — —
–! Victory Condition: Capture X% of the map.
— — — — — — — — — — — — — — — — — — — — — — —

VictoryConitions.Condition.percentage_of_map_owned = {
[‘Value’] = 10 — Something we can squeeze stuff around.
, [‘Rule’] = function (self, side)

— Percentage we must reach to win.
local totalOwnableCPs = totals[ALLIED].originals + totals[AXIS].originals
local cpsOwned = totals[side].current
local percentageOwned = cpsOwned * 100 / totalOwnableCPs

local victory = 92 — CONFIGURABLE: Percentage to win.

return ( percentageowned >= victory )


From there it was just a hop, skip and a jump towards implementing the code to run these rules (and adding a few more rules to get the producers started).

This brings the total amount of Lua used in the game servers to 5,000 lines of code.

Remember that next time you’re accusing me of premature optimization. If I were a mindless optimizer, I sure as hell wouldn’t write that much code in a scripting language.


Is that percentage CP’s or facilities?
I would think facilities would be better to add a weight value to the capture percentage. Should factories be worth more? Just trying think of rules that would make it more interesting.

Remember that next time you’re accusing me of premature optimization.

lol, sorry about that :D

Stang: Yeah, just CPs. But remember, this is only a prototype, it’s not live (I freaked Gophur out for the same understandable assumption). It’s purpose is to try and give the producers material to work with.

of premature optimization

Can’t you get medication for that?

I was under the impression that CPs (towns) were weighted, and that the requirement was 94%, is this not the case?

Also I’m wondering if the victory conditions were up for debate? The end of each map can be really painful, with the losing side always compressed deep into the same corner (NE Germany and NW France/UK).

I wonder if having certain towns (alongside factory towns) heaviliy weighted might make the end-game map more interesting, with certaon CPs (towns) becoming focal points, eg Bernay/Le Crotoy in France or Ratingen/Langenfeld in Germany – capture of these towns only happens when the ability to defend is compromised and I’d wager that no side has ever come back having lost such towns. If there towns were weighted such that capture of them triggered victory, you might at least see Alamo defending with loss of the town guaranteeing defeat.

I don’t know if is the case, the current victory conditions are performed by the Gazette which I have no involvement/access to. Remember: the rules I rolled are prototypes to demonstrate how they can be made to start a discussion internally, when we get around to actually implementing this ;-P

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: