Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need equation(s) for PC strategy game.

  1. Feb 5, 2012 #1
    I'm having some trouble figuring out several different things. 1) How big an army can I make based on the amount of gold I have. 2) How much of each resource will I need to purchase to create said army. 3) How much of 1 resource would I need to buy given how much of the other I already have to maintain my 3:2 army ratio. There are 6 different units each requiring different amounts of each resource to create. There are only 2 resources WOOD and IRON. I really only prefer 2 different units, ARCHERS and PIKES. Ideally I try for a 3:2 ratio of PIKE to ARCHER. To create 1 unit of each it cost 3 IRON + 6 WOOD for PIKE and 13 WOOD for ARCHER. Each resource costs 2 gold from the merchant to buy, or I can just gather the resources myself, but sometimes both resources aren't available. If there is any other information needed that I may have left out just let me know.

    P.S.- If anyone is wondering what game, it's Lords of the Realm 2. Old, I know, but still loads of fun.
     
  2. jcsd
  3. Feb 6, 2012 #2

    chiro

    User Avatar
    Science Advisor

    Hey ViRTue and welcome to the forums.

    So just to clarify, these are the rules for buying soldiers:

    1x PIKE = 3xIRON + 6xWOOD
    1x ARCHER = 3xIRON + 13xWOOD

    1xIRON = 2xGOLD and 1xWOOD = 2xGOLD

    Now you said have a 3:2 ratio of PIKE:ARCHER and you want to maintain your 3:2 ratio.

    If there are no other constraints then all you have to do is for every five new soldiers get three new pikes and two new archers, but from the context of your question it seems that there might be other constraints. You mentioned the fact that you can't always find resources so thats definitely one constraint.

    Lets say you want to figure out how much gold for 3n PIKES and 2n ARCHERS to keep your 3:2 ratio.

    In terms of gold for 1 PIKE you have 3xIRON + 6xWOOD in terms of gold = 3x2xGOLD + 6x2xGOLD = 18xGOLD and for 1 ARCHER you have 3xIRON + 13xWOOD in terms of gold = 3x2xGOLD + 13x2xGOLD = 32xGOLD. This means for n 'bunches' of 3:2 ratio soldier groups you have 18xGOLD + 32xGOLD = 50GOLD for 5 soldiers in your 3:2 ratio. More groups of 5 soldiers are just multiples of that.

    Is this what you are looking for? Are there any other constraints?
     
  4. Feb 6, 2012 #3
    1x Archer = 13 Wood
    1x Pike = 3 Iron + 6 Wood
    1x Wood = 2 gold
    1x Iron = 2 gold
    X amount of gold = # of troops? (3:2)P:A
    X amount of gold = # of resources

    Yes that is along the lines of what I was thinking but I fail to create a universal equation I can just plug numbers into. I would like to find out how many units I can create given a certain amount of gold, and how much of each resource I need to purchase to create said troops.

    Also the way the game works is you gather certain amounts of resources every turn from a "county" sometimes they don't always have Iron in them so I need to purchase that from the merchant. So I would like to know how much I need to buy to match the amount of wood I have to create my 3:2 army.

    Was hoping to find something that would work in a spreadsheet but if I could figure out an equation to solve all these values I could easily transport it into spreadsheet.
     
  5. Feb 6, 2012 #4

    chiro

    User Avatar
    Science Advisor

    Well for these kind of problems the first thing to do is figure out the units of everything and what specific unit you are trying to find. From that you end developing ways to convert one unit to another (like wood to gold or iron to gold) and then from that you generate a formula.

    So I'll do one and let you go about doing the rest.

    So lets say we want to find the amount of gold for a pike. Now a pike needs iron and wood so we have to also find the amount of gold for a unit of wood and the amount of gold for a unit or iron.

    We know that the amount of gold for iron and wood is $2 a piece. So our rate for [gold/piece of iron] = [gold/piece of wood] = $2.

    Now we need to figure out [gold/pike]

    Now we have [gold/pike] = 3 x [gold/iron] + 6 [gold/wood] = 3 x $2 + 6 x $2 = $6 + $12 = $18/pike.

    For the others you do basically the same thing: you figure out what the units are and then from the bottom up plug them into your formula.

    Remember that as you go up the hierarchy for your units you use the fact that [a/c] = [a/b] x [b/c]. So from the example we have c is our gold and a as our pike with b representing wood and iron.

    If you have any problems, I'll do my best to answer them.
     
  6. Feb 6, 2012 #5
    Yes I understand all this, it does help me a little and it touches somewhat on what i'm ultimately looking for. I'll add a little more to the solution which I hope will eventually give us a single equation without having to go through all this figuring every time.

    In order to keep to the 3:2 ratio you'll have to multiply the G/P (gold per pike) by 3 getting 54, then do the equation again to solve for archers which comes out to 26 G/A (gold per archer); multiply that answer by 2 to get 52. Now add the 2 answers together to get 106 G/R (gold per ratio.) So it will cost 106 gold to get 3 pike and 2 archers. I divided the G/R by my total gold to get the total number of G/R I could buy (call this max ratio or MR.) I then multiplied the MR by my 3:2 ratio, then those 2 answers (1 for each unit) gets multiplied by the combined material cost; 18 for pike and 26 for archers (basically working backwards now to convert it back into specific units of wood and iron.) This answer is then divided up into its different resources, pike consists of 1/3 iron and 2/3 wood while archer is just wood. This tells me exactly how much gold I can spend each resource.

    So basically what I'm looking for is how to condense this into a single equation (maybe more if necessary to convert back) where I can just plug in my total gold and get the answer. My issue is with word problems and putting them into workable equations. I can solve the problem easily it just takes longer than it really should. ;p
     
  7. Feb 6, 2012 #6

    chiro

    User Avatar
    Science Advisor

    So are you asking given $G in gold how many archers and pikes can you buy with your gold and also how many units of wood and iron do you need to purchase? Basically formulas for these quantities?
     
  8. Feb 6, 2012 #7
    Yes, I just need some help simplifying this massive story problem into a single equation, if possible.

    Should I have started this thread in a different subforum?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook