1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Reading Civ5Replay files (update: HTML export!)

Discussion in 'Civ5 - Strategy & Tips' started by dannythefool, Oct 4, 2010.

  1. DagHammarskjol

    DagHammarskjol Warlord

    Joined:
    Oct 18, 2007
    Messages:
    135
    Note that, in the game, you can save the map independently of saving the game itself.

    Might this be helpful in figuring out a way to overlay the replay onto the correct map?
     
  2. Mahi

    Mahi Warlord

    Joined:
    Apr 24, 2010
    Messages:
    276
    ^^good point
     
  3. MinoanGuy

    MinoanGuy Chieftain

    Joined:
    Sep 15, 2010
    Messages:
    22
    Awesome work danny! Thanks! I hope Firaxis actually finishes this feature in a patch so we don't have to rely on the community to get it done for them.
     
  4. lrdgrd

    lrdgrd Chieftain

    Joined:
    Oct 31, 2005
    Messages:
    4
    I just tested it on a regular Earth map game and works wonders. I have another save from a huge earth map with marathon settings on at home. Ill try on that later and see if it all goes well as well.

    Really nice thing u got going there!!! Kudos!
     
  5. dannythefool

    dannythefool King

    Joined:
    Jul 15, 2009
    Messages:
    657
    I have to look into it, I completely forgot about that. :) At least the pre-made maps that ship with the game are much simpler than save games.

    I've had some success with my save games too, though. Not quite there yet, but it works for some of my very early save games. On the other hand, it will never be as reliable as reading map files.


    I suspect it will at least be very slow because the animation javascript is really inefficient :)
     
  6. evanbgood

    evanbgood Chieftain

    Joined:
    Sep 26, 2010
    Messages:
    77
    Dude, that ending was AWESOME!

    But yeah, I'm super-excited to see something like this. Civ victories have always made me feel kinda empty, since they take so long and end so suddenly, and Civ V is definitely the most underwhelming in this department, unfortunately. At least they were smart enough to make the replay files, even if they don't support them yet. I can't imagine they'd do that without intending to add it to the game eventually. It probably just hit the cutting floor as they got closer to release. In the mean time, Civ's ultimate mod community is really doing an awesome job picking up the pieces like this. Kudos!
     
  7. Venereus

    Venereus This Is Streamlined!

    Joined:
    Aug 8, 2010
    Messages:
    1,026
    What happened to my CIV? What are these ugly replays?


    Nice work getting them to work, though. Thanks.
     
  8. BotYann

    BotYann Chieftain

    Joined:
    Oct 7, 2010
    Messages:
    9
    Location:
    France
    Many Thanks dannythefool !

    Your Python code is very cool :thanx:

    I translated it in french with UTF-8 support for french save on Civfr
     
  9. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    Those are amazing. They look so ... organic! :D
     
  10. dannythefool

    dannythefool King

    Joined:
    Jul 15, 2009
    Messages:
    657
    I've just uploaded a new version that improves a number of things and doubtless breaks some others...

    If they are ugly, that's entirely my fault :) The replay files only contain data, no graphics. But I think I've improved it somewhat now.


    Thanks, that's way cool!

    I read in your thread on your French forum that you have replay files that didn't work (or at least that's what I think I read) - would you mind sending them to me by e-mail? My address is in the script.

    Also, I included your translation in the new version of the script. In theory, you can now add " -l fr" to run the script in French mode. But as I don't have any French replay files, I can't guarantee anything - if you could try it out, that would be great.
     
  11. Mahi

    Mahi Warlord

    Joined:
    Apr 24, 2010
    Messages:
    276
    Wooohooo land!!! :goodjob:
     
  12. jpinard

    jpinard Martian

    Joined:
    Jan 18, 2002
    Messages:
    760
    Location:
    Enceladus, Saturn
    Danny,
    Your ID should be changed from Dannythefool to Dannythebrilliant :)
     
  13. Zechnophobe

    Zechnophobe Strategy Lich

    Joined:
    Sep 1, 2006
    Messages:
    1,866
    Location:
    Goleta, California
    I'm so happy for this, and the work you've done... will you trade open borders with me? What if I throw in some Dye?
     
  14. litewulf

    litewulf Chieftain

    Joined:
    Oct 7, 2010
    Messages:
    1
    Danny: I'll look into making this a web service over the weekend if you don't mind?
     
  15. dannythefool

    dannythefool King

    Joined:
    Jul 15, 2009
    Messages:
    657
    I don't mind, I'm happy if I don't have to host it myself :D

    Note that I can't vouch for the security of running this on a web server. At least, I'm pretty sure that someone who's good with a hex editor can get arbitrary HTML into the output of the script. (This is a non-issue if you only let people download the HTML and don't host it yourself. If you want to host all the HTML output, make sure it's not on a domain that would let javascript embedded in it access any cookies etc.)
     
  16. BotYann

    BotYann Chieftain

    Joined:
    Oct 7, 2010
    Messages:
    9
    Location:
    France
    Thanks dannythefool :goodjob:

    I will try the new version this week-end and i send you a french save after that.

    Great Job !

    -------

    Edit for security in php we can strip tags by :
    $sString = preg_replace ('@<[\/\!]*?[^<>]*?>@si', '', $sString);

    or by :
    $sString = strip_tags ($sString);

    I dont know for Python how to add that in the parsed content.
     
  17. dtolman

    dtolman Chieftain

    Joined:
    Jul 3, 2002
    Messages:
    16
    Wow! Even better! I hope 2KGames takes this feature and credits you in a future update.
     
  18. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    Too bad that modbuddy browser does not work well with this as well ( no map ,just the event list :( ). Otherwise you could simply pass the python code to lua ( lol, as if passing code in one language to other was a trivial task :D ) and it would be a nice adition to ModBuddy features...
     
  19. Larsz

    Larsz Chieftain

    Joined:
    Jan 10, 2006
    Messages:
    35
  20. Carch

    Carch Chieftain

    Joined:
    Mar 30, 2002
    Messages:
    64

Share This Page