[WIP] [SERVER-MOD] Anti Paper units

Discussion in 'Work-In-Progress Mods' started by Corang, June 1, 2014.

  1. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Attached zip has all json files from within media/pa/units if they have an attribute max_health it is multiplied with 2-8, depending on the directory it is in.

    Scala program to do it, depends on liftweb json.
    Code:
    import java.io.File
    import net.liftweb.json._
    import net.liftweb.json.Serialization.write
    import net.liftweb.json.Extraction._
    
    object UnitJsonConverter {
      implicit val formats = DefaultFormats // Brings in default date formats etc.
      val factor = 8
      val inputRoot = new File("E:\\Games\\PA\\Planetary Annihilation\\PTE\\media\\pa\\units")
      val outRoot = new File("E:\\units\\unitsx"+factor)
    
      def main(args: Array[String]) {
        processFile(inputRoot)
      }
      def processFile(f: File): Unit = {
        if (f.getPath().endsWith(".json")) {
          processJson(f);
        } else if (f.isDirectory()) {
          val ffs = f.listFiles();
          if (ffs != null) {
            for (x <- ffs) {
              processFile(x)
            }
          }
        }
      }
    
      def processJson(jsonFile: File) = {
        val text = readFile(jsonFile)
        val input = parse(text).extract[Map[String, JValue]]
        val output = modifyJson(input)
        val outText = pretty(render(decompose(output)))
        val outFile = new File(jsonFile.getAbsolutePath().replace(inputRoot.getAbsolutePath(), outRoot.getAbsolutePath()))
        outFile.getParentFile().mkdirs()
        printToFile(outFile)(p => {
          p.print(outText)
        })
      }
    
      def modifyJson(in: Map[String, JValue]): Map[String, JValue] = {
        if (in.isDefinedAt("max_health")) {
          in("max_health") match {
            case JInt(h) =>
              in.updated("max_health", JInt(h*factor))
            case _ =>
              in
          }
        } else {
          in
        }
      }
      def readFile(f: File): String = {
        val source = scala.io.Source.fromFile(f)
        try {
          source.getLines mkString "\n"
        } finally {
          source.close()
        }
      }
    
      def printToFile(f: java.io.File)(op: java.io.PrintWriter => Unit) {
        val p = new java.io.PrintWriter(f)
        try { op(p) } finally { p.close() }
      }
    }
    
    Can easily be modified to do other "mass transformations" as well.
    Also pretty formats the output files.

    Didn't actually test the unit json files though.

    Attached Files:

    thetrophysystem, Clopse and tatsujb like this.
  2. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Sorry about that game, my game had that problem again. I haven't been able to play PTE, I had loaded the planet yet when it appeared it stayed for a couple moments then switched to the "Generating planets" screen and never loaded... Odd. I'll go make a bug forums report on it.
  3. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    join the new game
  4. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    Disable ALL normal mods
  5. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    I shouldn't have any enabled for PTE but I'll check.
  6. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    if mods are enabled for the normal PA they are also enabled for PTE
  7. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Alright, I'll check that then.
  8. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    the only mod that I know works for sure is KO Deferred
  9. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Do you know if having mods installed for the steam version affects the PTE version?
  10. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    Yes it does, disable ALL OF YOUR MODS
  11. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    While watching this match, here's my initial verdict.

    4x health increase is too much. It increases micro too much. When attacking, you have to pay close attention to the attacks to make sure all the buildings are destroyed. You can't easily manage multiple attacks at once because you have to pay closer attention.

    I'd love to try a 2x health increase though.
  12. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    did you record it?
  13. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Yep, a lot of micro, 2 or 3 times would be more optimal. Though I did have a lot of fun with four times. You really needed to baby sit your forces, focusing on every little thing, lets say my army was composed of T1 tanks and infernos, and an equal force came in, I'd need to run my infernos straight into the enemies t1 tanks and micro around the enemy infernos. Though this was fun and made it feel a lot more like my actions actually mattered, it got to a very tedious state. It did allow me to survive much longer than normal with horrible resources.

    Edit: The micro wouldn't have been so bad, in fact it probably would have been a lot more fun, if I wasn't lagging so bad. :p
  14. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    I did record it, but didn't save it. It was not interesting at all to be honest.

    Blue did nothing but build bomb bots that did absolutely nothing.
    Red attacked, but didn't expand or have a good economy so the attacks were weak.
    White didn't attack or expand at all until he amassed a large army and then steamrolled.

    It simply wasn't an enjoyable match. :-/
  15. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    okay, ima go post on gamma issues with my mysterious graphical issues
  16. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Didn't say anything about pink. :(

    Un less you mistook me for red, because I did do some attacks and pretty good damage at first, but I just couldn't expand, no metal to expand to.
  17. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    figured so. Actually figured x4 would let your army perimeter-run other armies and turrets and walls and run right into a base or commander, albeit with very low chip damage and its fair every player can do so.

    x2 may be too much still. The new tanks can perimeter run turrets walled only on one side. But x2 may be more interesting, maybe closer to 75% additional health.

    I'm glad we are testing these. Keep these test builds stored.
  18. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Yeah units could get into enemy bases quite easy, but that was actually kind of fun, (at least I want armies running into eachother.) The infernos were one of the best weapons because with enough you could do a lot of damage with minimal damage done to because of HUGE health. And enough of them attacking one thing is still split second death.
  19. brianpurkiss

    brianpurkiss Post Master General

    Messages:
    7,879
    Likes Received:
    7,438
    You looked like red to me.
  20. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,356
    Ah well. I dunno'. :p

Share This Page