• 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!

Possible Bug/Hard Code Limit/Soft Code Limit with Char Models

daede

Landlubber
Storm Modder
As this is primarily a modding issue I thought it best to open a topic here rather than in the technical forums.

When Testing my new Fun with Researchers mod I found that the last new model I added would not appear in the Tailor shops, after checking and ensuring the code was all good, which it is(there was a typo error that I fixed) I thought it may have something to do with it being the last model in the initModels files so I cut and paste my Jack Reworked Portugese model below the problem model and still no go. After 20 new games and more time browsing the Tailor shops than I took in creating the problem model I decided in desperation to just copy and duplicate the problem model code below itself. Now with two copies of the exact same code in my initmodels I load up and sure enough the model is now available, I load up a couple more new games to ensure it wasn't just a probability/chance issue and the model is there in the Oxbay Tailor everytime. I remove my doubled up code and woosh the model is nowhere to be found again.

Best I can figure it the cause may well be something to do with the fact that the model is assigned the ENGLAND value like most of the other models ingame and though we haven't yet approached the Hard Code max models we may have stumbled across a max ENGLAND models. So I tested this theory by cutting my England Jack and pasting below the original problem model and removing my duplicate code, sure enough now the original problem model appears and the England Jack does not. I did a quick count and on my POTC (which is Build 12.1 + Pieter's 21 November 2005 Update + My Taegan n Cat Mod and my Fun with Researcher mod which add 5 and 4 new ENGLAND models respectively) and I ended up with a total of 43 models assigned ENGLAND and a further 19 models assigned PORTUGAL which sometimes is for some reason considered England by the Game this brings the total to 62 making the possible limit 61. Remember though the first model I tried under the original problem model was my portugese Jack and he still appeared in game whilst the problem model did not therefore it is almost definately a limit related only and directly to the ENGLAND nation assignment which would make the limit of valid models 42. All of this is well and good but the question remains why when I double the dissapearing models code does it all of a sudden work fine, is another model dropping off to compensate? and further what is causing this problem in the first place, is it the Tailor mod, the changes NK made to how initModels operates, a hard coded limit or something soft coded we haven't come across yet?

Anyway it will take a better coder than me to figure this out, in the meantime I am removing my England Jack (I was never happy with how the country representative Jack's turned out anyway) from my initmodels to compensate. For the next update though we may need to go through all of the models and change some of the country values or worst case remove some of the lesser used ones, I would be happy to volunteer to do this but I warn you I will definately be subjective in my selection and I haven't really been around long enough to have a feel for what is popular within the community. It would obviously be better if we could solve the bug/limit but that would require coders which are skarce at the best of times.

Hopefully we can figure something out together that works for everybody.

Cheers,
Daede.
 
Wow! That's real weird. I've had troubles with models as well before, but not quite as bad as this and it was usually my own fault. There are two other ways of checking if a model works:
1) Set "int DEBUG" to 1 in globals.c and start a new game. Then, if the model works, it will show up in the model selection screen immediately (but you can't open the screen in the tutorial, so you'll have to skip that).
2) You can change ch.model in Characters\characters_init.c into the model you want to test. If your character has that model if you start a new game and the interface pictures show up properly, it works.

BTW: If I recall correctly, somewhere in initModels.c, you wrote that one of your models should be available from pirate tailors, but since you didn't know if these exist, you made it an England model. Pirate tailors do exist, so that could be made one England model less.

BTW 2: I just found the following code: "object ModelTypes[512]; // must be at least (max model types) * (max nations + 1)". Max nations is 6, max model types is, I think MAX_MODELS is 384, so object ModelTypes[] should at least be 6*384+1=2305, right? Or isn't max model types the same as MAX_MODELS? <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />
 
Ok quick recap...

My newest model was not appearing in tailor shops in spite of the model and its code being in good working order.

As the code and model were fine I thought it might be a character limit problem as the model was the last listed in the models_init file.

I tried cutting and pasting a different model beneath it to see if that one would then disapear instead, it did not, the cut and pasted was available and the original was still missing.

The only difference between the model I cut and pasted and the dissapearing one was the Nation assignment so I tried the same cut and pasting again this time with an ENGLAND model(the same nation as the missing model).

The missing model appears and is working fine but the cut and pasted model is now unavailable. So this has something to do with Nation assignment.

Next I duplicate the code of the missing model so it appears twice in the model_init file and the model is available from Tailor and as far as I could tell no models had dropped off from Tailor in its place. (This could be a solution except for a buy one get one free issue where if you buy the model with the duplicated code in Tailor you end up with two identical versions of it available in outfit selection screen, which admittadly is not that big a deal for most people but it bugs the hell out of me.)

So at this stage we know it is not a problem with either the models themselves or the code for the models but that it does have something to do with nation assignment.

Next I uninstal POTC and reinstal with Build 12.1 Pieters 21/11/05 Update and my new models.

Try again and no change, this should rule out the random weirdness that POTC often shows after a while.

Next I try Pieters suggestions...

Changing characters_init.c to force the model as start up model shows the model fine.

Setting debug=1 in globals.c shows and allows selection of the model in the choose outfit screen.

So we should be able to assume it is not because the model is causing an error with the game itself (and for those who haven't tried the wierdness that results when you do go over the max models limit is instantly and blatantly apparent and this is not it).

This leaves as far as I can think two possibilities...

1. Tailor handling error due to the large number of ENGLAND nation models, there is also the whole Purtugal in england shops thing which may play a part as well.

2. A Max models per nation issue, which would make more sense but seems unlikely as the models can be forced to appear.

which brings us to the line of code Pieter mentioned which I have noticed myself in the past, in models.h there is a line that reads...

object ModelTypes[512]; // must be at least (max model types) * (max nations + 1)

I read this a little differently than Pieter as saying that the true maximum number of models is the MAX_MODELS value (384) divided by the number of nations (6) -1 which would bring the total per nation to 63 which is only 2 off what we are actually seeing.

Look promising and testing is easy, just up the MAX_MODELS value. So I did and no change, the model is not available which kind of almost completely rules out this being a game issue and brings us back to the Tailor shops.

The simplest answer would be that the ENGLAND Tailor shops having to deal with both England and Portugal cannot display all of the available models, but this is also kinda shot down given that when I change the last model on the list to a portugal model the Portugal one shows but the England one above it does not then also there is the duplicating model code allowing the model to appear and be bought from a Tailor thing.

Which leaves me completely stumped if its not a model issue, nor a code issue, nor a tailor issue, nor a game issue that leaves... well pretty much my imagination or something so random that its infinite possibility has come full circle to a finite and replicatable issue on mutliple systems each with fresh installs.

Hopefully someone will come up with a better hypothesis before I have to start calling all my friends and inviting them over to see if they see or rather don't see what I don't see to ensure that I am not crazy and then wondering if they are actually saying what I hear them saying after all I am allready questioning my sight why not my sound too and POOF! I am a fish.

Cheers,
Daede.
I think therefore I MOOOOOooooooo!
 
Sounds like something is wrong with the tailors themselves. It was always apparent something is wrong with the English tailors (Heck! I still don't know why they sell Portugese stuff too, but it's ruddy annoying). Don't go nuts because of this though. I'll try to look into it as well when I have more time (which will, unfortunately be in two weeks or so).
 
Back
Top