Shop  •   Avatar  •   FAQ  •   Search  •   Memberlist  •   Usergroups  •   Profile  •   Log in to check private messages  •   Log in  •  Register 

Working on a perl savegame editor (for Mac)
Post new topic   Reply to topic     Forum Index -> Customization & Modding Goto page 1, 2  Next
View previous topic :: View next topic  
Author Message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat Apr 14, 2012 1:15 pm    Post subject: Working on a perl savegame editor (for Mac) Reply with quote

FYI, I've started on a savegame editor that will run on Macs. It's in perl, so when I publish it you will be able to read the code as a sort of documentation of savegame syntax. [ Does anyone have extensive savegame documentation already? ]

So far I've got the easiest stuff - name, difficulty level, crew size, ship contents, rank & attitude with each country, names of cities and settlements, number of ships. I was very surprised to see that I could rename cities, not just settlements, but the game seems to not complain.

I'd really like to be able to change city attributes, but I don't know how far I'll be able to reverse engineer it.
Back to top
View user's profile Send private message
Captain Mercer
Swabbie
Posts: 57



516 Gold -

PostPosted: Sun Apr 15, 2012 1:40 am    Post subject: Reply with quote

People actually play games on a mac? why????
Back to top
View user's profile Send private message Visit poster's website
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Tue Apr 24, 2012 10:56 am    Post subject: Reply with quote

Well, I've decoded most of the ship information - class, flag, upgrades, crew, cannon, contents, mission, starting and destination cities, and coordinates. [But setting coordinates of my flagship doesn't work, for some reason]

This should be enough to create a scenario where you have to protect a visiting royal flotilla against hordes of intercepting marauders....

I've also decoded most of the visibility bits for cities/settlements, and found several of the parts of your personal score - wealth banked, lost cities found, relatives found.

I'm worried that the next parts are going to be much harder to work out, though. I'd like to be able to relocate settlements at will, and change the beauty of specific daughters. Pirate treasuremaps must be part of the saved data too, but decoding that seems very ambitious.

Actually, would someone care to help me out? If you have a computer on which one of the Windows savegame editors works, could you post a few savegames that differ ONLY in some of the details I haven't decoded yet? Just post before and after editing savegames.
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat May 26, 2012 12:45 am    Post subject: Reply with quote

I'm getting closer to being ready to release this... I understand the treasure maps now, I can decode the Ship's Log, and yes, I can set all of the daughters to "rather plain".

How do I go about posting the script when it's ready? It's perl, so it is a plain text file, and it's a bit over 1000 lines.
Back to top
View user's profile Send private message
Fish
Powder Monkey
Posts: 11


188 Gold -

PostPosted: Sat May 26, 2012 12:52 am    Post subject: Reply with quote

jlangsdo, sounds great...looking forward to a mod for Mac Smile
Back to top
View user's profile Send private message
Roland
Helmsman
Posts: 4190



23929 Gold -

PostPosted: Sat May 26, 2012 1:26 am    Post subject: Reply with quote

jlangsdo wrote:
I can set all of the daughters to "rather plain".

For each nationality and beauty level, there are two skins, with number 1 seemingly more common than number 2. Have you figured out how the game assigns whether each daughter is a 1 or a 2?
Back to top
View user's profile Send private message Send e-mail
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat May 26, 2012 11:21 am    Post subject: Reply with quote

Hi Roland -

That's an interesting one, I hadn't tried to look for which skin is assigned to each daughter before. I gave it a shot (sounded more fun than merchant prices, which are tough).

No dice so far. The choice of skin may be built into the city.

My test case was the beautiful English daughter of Antigua... she always seems to come up a redhead with a deep red dress.

If you have a beautiful English daughter in Antigua in the aqua dress, upload the savegame file. Or in general, if you can provide 2 savegames with different skins for the same nationality and beauty level daughter in the same city, post them and I'll be able to work it out by splicing between the two files.
Back to top
View user's profile Send private message
Roland
Helmsman
Posts: 4190



23929 Gold -

PostPosted: Sun May 27, 2012 10:05 pm    Post subject: Reply with quote

jlangsdo wrote:
The choice of skin may be built into the city.

I suspected that myself - and I believe I just confirmed it.

I loaded seven savegame files and visited every city in the Lesser Antilles. Without exception, in every city (barring changes in nationality), a daughter of a given beauty level was the same in every game. Following the numbering conventions of this forum, the daughters in St. Martin and St. Eustatius are B1, A1, or P2. Those in St. Kitts, Nevis, and Antigua are B1, A2, or P1. Those in Montserrat and Guadeloupe are B1, A1, or P2. And those in Martinique are B2, A2, or P1.

Martinique vs. the other two French cities makes an interesting test case: they are mirror images, opposite with respect to daughters of all three beauty levels. Another test case was a game where St. Martin had been captured by the English. The daughter there was a B2, as opposed to the B1 who always appeared when the city was Dutch.

I asked recently if the numbering conventions that have been used in discussion here came from the game or were arbitrarily assigned for discussion in this forum. I now strongly suspect that those numbers used for reference here are arbitrary. That would allow for a single number assigned to each city to determine which daughter appears for each beauty level.
Back to top
View user's profile Send private message Send e-mail
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Mon May 28, 2012 1:07 pm    Post subject: Reply with quote

The cities have a standard order in several places in the savegame file.

There are 128 city/settlement slots, I number them 0 to 127.

The main cities are 0-43 in alphabetical order, from Antigua (0) to Villa Hermosa (43). Don't forget Coro (5). Then you have Florida Chan.(44) and Europe (45, 46) and then the settlements from 47 to 127.

Also, guess what else is correlated to the daughter's attractiveness? The upgrades available from the shipwright!
Back to top
View user's profile Send private message
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Tue May 29, 2012 1:15 am    Post subject: Reply with quote

Here is version 1.32:

pirates_savegame_editor.pl

On a mac, this should work out of the box - download it, run it from the Terminal window. It knows the default location for savegame files:
/Users/$USER/Library/Preferences/Firaxis Games/Sid Meier's Pirates!/My Games/Game

There is a short -help message, and a much longer -advanced_help message.

For a non-mac, you would need to install perl first, and probably use the -dir switch to tell it where the savegame files live.
Back to top
View user's profile Send private message
Roland
Helmsman
Posts: 4190



23929 Gold -

PostPosted: Tue May 29, 2012 3:58 am    Post subject: Reply with quote

jlangsdo wrote:
Also, guess what else is correlated to the daughter's attractiveness? The upgrades available from the shipwright!

Yesterday as I was checking out the daughters, I also noticed the variation in governors. I wish I had recorded the different governor models, as well as daughters, to see if they also are correlated in some way.
Back to top
View user's profile Send private message Send e-mail
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sat Jun 02, 2012 10:40 am    Post subject: Reply with quote

I found the link between shipwright's offerings and daughter's beauty.

If we number the beauty from 0 (rather plain) to 2 (beautiful),

and number the upgrades from 0 to 7:
("copper plating", "cotton sails", "triple hammocks", "iron scantlings",
"chain shot", "grape shot", "fine grain powder", "bronze cannon");

and number the cities in alphabetical order 0..43 (Don't forget Coro at 5),

then:
upgrade = (city + beauty) mod 8

So in Antigua, if the girl is beautiful, they have hammocks.

But more broadly, this means that Antigua can only have copper plating, cotton sails, or triple hammocks - in any game. And if you are sailing around the Caribbean, wishing that you could find some place that installs iron scantlings, only certain cities will ever have them. Florida Keys might have them (if the Governor's daughter is plain), but never Eleuthera.
Back to top
View user's profile Send private message
Roland
Helmsman
Posts: 4190



23929 Gold -

PostPosted: Sun Jun 03, 2012 1:00 am    Post subject: Reply with quote

I just checked the data sheet from my latest game, and it is consistent with your formula.

I have already figured out a use for this bit of knowledge. The landlocked cities of Gran Granada, Panama, and Puerto Principe have shipwrights that supposedly offer upgrades, even though we cannot get our ships there. When the stranger provides info on a city, he gives us the available upgrade, but not the daughter's beauty level. Now we can infer the beauty level from the upgrade.

Conversely, if the bartender tells us a daughter is beautiful, we can infer the upgrade available in that port.

Have you figured out how the all-important beauty levels are assigned?
Back to top
View user's profile Send private message Send e-mail
Roland
Helmsman
Posts: 4190



23929 Gold -

PostPosted: Sun Jun 03, 2012 6:47 am    Post subject: Reply with quote

jlangsdo wrote:
and number the cities in alphabetical order 0..43 (Don't forget Coro at 5)

I looked over my game data more carefully. There are a few cities that do not quite fit the pattern - unless those cities are slightly out of alphabetical order. For your formula to work with my data, Nevis must precede Nassau, and Santa Marta must be switched with Santo Domingo, so that the order is Santo Domingo - Santiago - Santa Marta.

With regard to the latter, it is as if they ordered the four Sant- cities by order of the saints' names, ignoring gender inflections: Catalina, Domingo, Iago, Marta (or, for you English speakers, Catherine, Dominic, James, Martha).

Could you check the order of the cities to confirm this?
Back to top
View user's profile Send private message Send e-mail
jlangsdo
Cutthroat
Posts: 398



11012 Gold -

PostPosted: Sun Jun 03, 2012 10:57 am    Post subject: Reply with quote

You are correct, sir.

You can read the canonical order from the top of any savegame file (the city names are in plain text); I had never noticed that they were not quite alphabetized.

0 Antigua
1 Barbados
2 Campeche
3 Caracas
4 Cartagena
5 Coro
6 Cumana
7 Curacao
8 Eleuthera
9 Florida Keys
10 Paramaribo
11 Gran Granada
12 Grand Bahama
13 Guadeloupe
14 Havana
15 Leogane
16 Maracaibo
17 Margarita
18 Martinique
19 Montserrat
20 Nevis
21 Nassau
22 Nombre de Dios
23 Panama
24 Petit-Goave
25 Port-de-Paix
26 Port Royale
27 Puerto Bello
28 Puerto Cabello
29 Puerto Principe
30 Rio de la Hacha
31 San Juan
32 Santa Catalina
33 Santo Domingo
34 Santiago
35 Santa Marta
36 St. Augustine
37 St. Eustatius
38 St. Kitts
39 St. Martin
40 Tortuga
41 Trinidad
42 Vera Cruz
43 Villa Hermosa

I know how to control the daughter's beauty (as well as her visibility, which makes doing this test much easier), but I assume that the beauty level is assigned randomly in each game.

The settlements and pirate havens sometimes offer upgrades. They are not ordered alphabetically; they always have the "daughter's beauty" number set to 0. I would assume that the formula relating their city-number to their upgrade offered is the same, but I haven't tested that.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Customization & Modding All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group