• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Mods and Restarting the game

dchaley

Landlubber
<img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/hi.gif" style="vertical-align:middle" emoid=":gday" border="0" alt="hi.gif" />

So I got the CVS code and resources and found out that my current saved games just didn't work at all. And yeah, I know I was warned. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

At first, my controls weren't working right - I couldn't use any of the dialog arrows, nor could I select the `quick-command` options. To fix this, I reset controls to default and it seemed to be quite happy.

From there on things just go straight downhill. All of the ship pictures are missing, and I cannot go to port - it crashes. If I try to look at the ship status, it crashes.

I tried looking through the code for any obvious mistakes but there were none.

And, starting a new game does indeed "fix" the problem - no crashes in a new game.

But so here's the thing. It seems that there probably isn't that much to be done in order to keep saves across versions, right? I mean, something just seems fundamentally wrong with throwing away saves every time one of these mods is added.

That reminds me. What kind of mod makes you restart anyways? What needs to be changed to force a game restart?

If we can pin down exactly what forces a restart, we could perhaps fix the problem.

I'm not <i>that</i> far into the game, but it's definitely an annoyance. And I'm pretty sure that being told that save games are not compatible would be a fairly major `turn-off` to a lot of people who've made lots of progress in the game.

Anyways, that's just my little rant from this little corner of the world. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I was looking forward to playing with the new features and was really bummed out to find that it didn't work.

That being said, all the new code in the CVS really does look nice, and I'm very impressed with the new interfaces. I played around with them for a few minutes in a new game, and they look really nice.
 
Mainly, I think it's adding new characters that will make you have to restart. New locations will probably also do it, I'd guess.

Me, I don't mind starting anew, but then again, I enjoy the challenge of building yourself up - I guess I'm not as impatient as others regarding this.

Perhaps with the advent of the `in-game` console to edit games, we can put together a selection of codes to customize new starts. ?
 
Like Catalina I don't mind starting a new game, in fact one evening I started a new game three times just because I wanted to change somethings.

I actually managed to play POTC for the first time in a month or more today and it took me a while to `re-learn` all of the controls.


IIRC NK has added PRS3 to Build 12 and that would require starting a new game.
 
First, for controls, you just need to go to options->controls->reset to defaults. For some reason you need to do that every time you add a control to the init_pc.c file.

Quoted from CVS thread:
<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Basically, there are two (that I know of) limits to `during-run` changes in POTC.  
The first, is that while most (I believe; I know it works for strings and ints) arrays _can_ be resized via SetArraySize(), object arrays _cannot_. I.e. Items[], ShipsTypes[], etc. That's why we use overblown #defines and then limited ints to say how much is _really_ used.  

The second is that (I believe; I haven't tested this recently) global variables cannot be removed from a game and the game resaved (i.e. you can _add_ new globals, but you can't remove them).  

So as long as we're only adding new vars, and as long as we don't overshoot our limits for the base array sizes, there are no _technical_ problems with not restarting, just _practical_ ones:  

In that there are some arrays whose properties are so changed during the game (Locations[], where locators are locked and unlocked on the fly) that reinitializing them would include overwriting the locator defines.  
However, a method similar to the one used in SetRumorDefaults could be used, to go through every location in the game and store each locator's locked/unlocked status, then reinitialize everything (including adding new stuff), then go back and set the properties per the temp save object.  

Same reason and solution for islands.  

Characters, there's already a function for `adding-new`-`char-if`-`not-exist`, and that's what Kieron just used to make FBQ reinitable.
-----------------
The changes that currently require a restart in bv12:  
Ship IDs changed; will need to go through characters and swap PRS2 ids for PRS3 ids with random stats. This can mostly be done parametrically, i.e. if id == "lugger1_X" then id = "lugger1"; SetRandomStats(char, shipidx, X);  

New location tags (can manually add these via reinit, for each island each location gets attribute loc.island = "islandid" and all locations in towns that did not previously have townsack attribs (or that had the _wrong_ townsack attribs, i.e. QC) get the correct ones (i.e. in oxbay, loc.townsack = "oxbay", loc.island = "oxbay")  

Also I will be shortly going through all shipyards and setting their loc.type to shipyard or shipyardoffice, so that sound are music are set correctly (right now both are "shop"). But this will be done in reinit too, so never mind.  

What we _do_ need to do is make the Location init for the tailor shops match what's in their reinit, so saving in tailor shops works.<!--QuoteEnd--></div><!--QuoteEEnd-->
 
DCHaley: I agree with you. Restarts suck, and should not be necessary.

Basically the only change that _in principle_ requires a restart is a change in the size of an object array.
If there's room to spare in the array (or it's not type object) then in principle it can be reinitialized (or resized and reinit'd).

In terms of PRS3, can add some code to reinit to findsubstr(char.ship.type,"_",0) and then cut everything after but including the _. That should fix the id mismatch with PRS3 problem.

In terms of locations, there's not a lot we can do short of writing down _every_ location that needs a tag and reiniting them.
Well, say better, add property island = FDF to all between loc[0].island.fdf.begin and *.end, and so forth, and then go back and add the few missing townsacks.

Characters as was noted can be done on the fly, see FindBlankCharSlot() function.
 
Well, my problem is that I haven't yet finished the game, and I'd kind of like to be able to do so without having to restart everytime somebody adds something interesting to the CVS. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

I guess that I'm trying to say that it would be really great if `mod-makers` could keep very careful track of which mods change the structure of something, and then write code to "upgrade" from one release to the next. Clearly the information is more or less the same, so it should be possible to write a function that converts e.g. old ship type information to new ship type information. This conversion routine would be somewhat similar to reinit - the game state could store a number indicating its version, and then there would be a function responsible for updating all the information from that version to the current version.

Of course it would require some coordination among the developers but that's a good thing IMO.

In any case I'm not <b>that</b> far into the game - and I could probably rush through the story line up till that point. I just really think that to whatever extent possible any mod that requires a restart should instead release a function that updates a game state to whatever new form it has to be in.
 
That's sorta what we do now--frex, Kieron's interfaces are activated by reinit so no need to restart, same with KR, and now the FBQ is modded for that.
And I certainly plan to do the same for PRS3 when I get the chance, per above.
 
Speaking of Kieron's interfaces... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

There are a lot of attributes that it tries to find that seem to be missing. I added in some CheckAttribute checks to get around that, but I suspect that the attributes aren't being created even though they should be.

Additionally the current CVS version seems to crash whenever you engage hostile ships. For instance the game crashes when I leave Redmond port when I have a pirate hunting mission available. And yes, I started a new game and all that. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
<!--`QuoteBegin-dchaley`+--><div class='quotetop'>QUOTE(dchaley)</div><div class='quotemain'><!--QuoteEBegin-->For instance the game crashes when I leave Redmond port when I have a pirate hunting mission available. [/quote]

Dis be an ol' bug in de Pirate Hunting quest, matey! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" /> Ye has tew press de 'T' key befer leavin' de dock or else ye be a crashin'! Pressing 'T' be an ol' `band-aid` fix o' Nathan's dat be repairin' a problem in a loop or sumptin'! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/icon_mrgreen1.gif" style="vertical-align:middle" emoid=":cheeky" border="0" alt="icon_mrgreen1.gif" />
 
2. Yeah, that's a bug I found from modding; sometimes ship gets set to SHIP_NOTUSED though the character is still alive. Weird. Fixed by checking for that.
Been busy the last couple days so never committed the fix. Sorry. :
 
The 'T' fix didn't work. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> It actually started before the pirate hunting; I was sailing to Redmond, bumped into a pirate, engaged and poof, it died!

NK, I'm eagerly awaiting the commit so that I can play again! I have some business to take care of <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/guns.gif" style="vertical-align:middle" emoid=":2guns" border="0" alt="guns.gif" /> <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/duel_pa.gif" style="vertical-align:middle" emoid=":ixi" border="0" alt="duel_pa.gif" />
 
Done.
And this is exactly the #1 thing you warned against. Sorry. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
Hey Nathan... you're going to hate me but it still isn't working. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

I'm not sure why. There are no messages in error.log. The end of compile.log contains:

Load from location to sea sLoc = l1, x = -907.898,z = -15.3169
Incorrect location id 'SetCharacterShipLocation' (location '' not found)

I'm at the Redmond port and trying to go to sea.

Incidentally I saw this in there, don't know if it's important:
LocLoadShips: Can't find Location.locators.ships in location: Redmond_store

Fun isn't it? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" />
 
D'oh - never mind. I should have checked ALL the log files. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/oops3.gif" style="vertical-align:middle" emoid=":eek:ops2" border="0" alt="oops3.gif" />

Turns out that after downloading JMV's ship packs, it seems to be working fine. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
That reminds me - when you add a new ship to the CVS code, could you also add its resources? I've gone through and have been adding things I'm bumping into but I'm sure there are lots of ships and stuff missing.
 
<!--`QuoteBegin-dchaley`+--><div class='quotetop'>QUOTE(dchaley)</div><div class='quotemain'><!--QuoteEBegin-->Speaking of Kieron's interfaces... <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

There are a lot of attributes that it tries to find that seem to be missing. I added in some CheckAttribute checks to get around that, but I suspect that the attributes aren't being created even though they should be.[/quote]

oh! which ones? that was all done by reinit before. perhaps it's because of prs3, i haven't updated everything for that yet. which interface, and which attributes? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/happy.gif" style="vertical-align:middle" emoid="^_^" border="0" alt="happy.gif" />
 
Naw, at least for the one DCHaley fixed (and the one in transfer_char that I applied his fix to yesterday) it's doing an sti of pchar.shiptransferinterface even if it doesn't exist.
 
Yeah, whenever I make fixes I immediately upload them to the CVS server.

Hey NK, more bad news <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> I was playing the game normally, but it seems that when I engage ships on the open sea, the game dies. That is, when I bump into ships on the world map, like a bunch of hostile pirates.

And yeah, I've already checked the logs, and it's not a ship model I don't have. :)

Oh yeah - I uploaded a bunch more ships to the CVS. If you check out the resources directory, the download might take significantly longer!
 
Fixed as of yesterday evening.
Also, I plopped up temporary frigatenksup and corvfrig1 folders.

I'm trying to use your method of immediate commital and `per-file` comments. Takes some getting used to. :}
 
Yeah, it's a little tedious at first, but over time the advantages become pretty clear - it's a lot easier to trace through the CVS code and see what exactly happened when and where. It makes it easier than dealing with massive changes at a time.

Basically, each commit should be a logical unit - the code is in (mostly) working state A, a commit is made, and it should now be in (mostly) working state B. I say mostly working in that the changes you add should compile and not crash the game, but since it's development and all there might be problems here and there.

But in any case - enough silly CVS lecturing. Thanks for the fixes. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />
 
Back
Top