Home   Help Search Login Register  

Author Topic: Could someone from the ECP team please provide some advice  (Read 1014 times)

0 Members and 1 Guest are viewing this topic.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
I have a problem that I believe someone from the ECP team might be able to help with.

I am close to completing a mission I am making.  I do not use ECP, in fact the only add on I use is General Barron's Editor Upgrade.  Nevertheless the mission has become quite large and as a result I have hit the ‘large savegame bug'  See:
http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=0c3df52fc723d7fc5bd4935188090a27;act=ST;f=3;t=36992

I have seen comments about this ‘being a problem with ECP' but from what I have so far been able to find out it looks more like a problem with OPF not ECP, it is just that ECP is large enough to trigger the bug.  

I am told that the upcoming version of ECP does not have this problem.  My question is how did you get round it?

I have seen comments about the bug being caused by ‘large numbers of variables' and also by ‘a lot of scripts'.  At the cost of making the mission untidy I am willing to consolidate the number of scripts and variables I use and even lose some features, what I need to know is: will it be worth it and how do I know how much I need to do?

Does anyone know if it is the number of scripts in the mission, or the number that are running when the game is saved that is the problem?  Similarly for variables, total number of variables or only those that are active when the game is saved.  Is there anyway that I can tell how much over the limit my mission is?  The message I get is:
'No entry' at '/GameState/Variables/Item25/data.value'

Does the fact that it is Item25 tell me anything?  If I got rid of 26 variables (scripts?) would the problem go away?

If someone out there has a solution then I would be forever in your debt if you could steer me to fixing this in my mission.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Could someone from the ECP team please provide some advice
« Reply #1 on: 25 Jan 2005, 00:37:00 »
Well, the people to talk to for all the details would really be Komuna and Zayford. However, I can give you the info 2nd hand, in brief.

First off, wow, that must be some amount of scripting to run into the savegame bug without any external scripts or addons! The ECP only has that bug when running on top of missions with heavy scripting, so yours..... must have quite a bit.

Basically, the way that Komuna managed to "fix" that bug is by transferring all of the global ECP variables into just a few global arrays. It seems that an array, no matter how large, only counts as "one variable", in terms of how many variables the mission has running. So instead of having 100 global variables, you plop them all into a single array and you've cut it down to 1 global variable.

Of course, this makes things rather inconvienient in terms of scripting, because you have to remember, "ok, (GlobalArray select 24) is the difficulty setting....", but oh well.

I don't remember what Komuna did (or didn't do) in terms of local variables, or if they had the same impact as globals. I could go dig up some threads from the ECP board if you want, or, better yet, Zay or Komuna can pop in here and give you the whole story. :)

HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Could someone from the ECP team please provide some advice
« Reply #2 on: 25 Jan 2005, 08:40:52 »
General Barron,

Thank you.  You have just saved me a tonne of work.  I have a couple of arrays each with 200+ elements in.  I was about to re-write the scripts so as not to need them.  I will now think of something else (I may still do this but with a lower priority).  Looking at the number of global variables I have it does not seem excessive in comparison with my last mission so I suspect that local variables may also be contributing to the problem.  I will turn my attention to consolidating some of the scripts and having an array for all the global variables.

Yes it is quite big.  I have long wanted to build a whole working island where everything is behaving in a realistic way and this is my attempt.  There are two sides each of 200+ loons.  There are patrols, road convoys, towns being searched etc. etc.  In this world it should be possible to create several different missions (or one long one).  

I was always conscious that something this large would have lag problems so I concentrated on reducing CPU demand, this increases the amount of scripting and use of data.  I had not realised there was a problem there as well.

Quote
I could go dig up some threads from the ECP board if you want,

If it is not too much trouble I really would appreciate it.  I have spent all my free time over the last 3 or 4 months on this so far and I would hate to lose it.  I have looked on the ECP threads but there is a tonne of stuff that is not relevant to this problem, someone that knows their way around it would be helpful.

Quote
or, better yet, Zay or Komuna can pop in here and give you the whole story
Well if that can be arranged :)


« Last Edit: 25 Jan 2005, 08:53:27 by THobson »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Could someone from the ECP team please provide some advice
« Reply #3 on: 25 Jan 2005, 08:59:03 »
PS:

One rather nasty thought I have just had - could the number if units and objects in the mission be contributing to the problem?  If so I suspect my mission is dead in the water.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Could someone from the ECP team please provide some advice
« Reply #4 on: 25 Jan 2005, 09:45:47 »
I was just about to ask you this :P

I don't think the amount of objects/units cause it, but if you have named all of them with some name, then that could be the problem because the name of a unit (given in the editor) is a global variable (of sort)...
« Last Edit: 25 Jan 2005, 09:46:25 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Could someone from the ECP team please provide some advice
« Reply #5 on: 25 Jan 2005, 10:28:55 »
Good thought.  I have created bases using quite a lot of wire/wood fences, buildings etc.  All unnamed.  

Some units do have specific names, but mostly it is only the group leader.  There are somewhere between 20 and 30 groups per side.  So with the other units I have named I should have ~80 unit names in total which feels a pretty modest number.  Nevertheless I can scale this back a bit but probably not by more than about 10 or so without a major re-write that I fear would increase CPU demand.  I will think more on this.  Thanks for the idea.

Edit:  Actually the more I think about it the more names I remember.  For example I have written some code to allow the player to place AV and AP mines.  This adds another ~60 names, for each mine there is the trigger name and the name of the case, and I have 30 mines.  By camcreating the cases when the player places the mine I could cut down on about 30 names.

Edit2:
I guess marker names would count as well.  I have ~60 of them doing nothing other than displaying the location of various units/groups on the map while I am de-bugging it.  They will not be needed in the final mission.
« Last Edit: 25 Jan 2005, 14:02:00 by THobson »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Could someone from the ECP team please provide some advice
« Reply #6 on: 26 Jan 2005, 11:18:44 »
Quote
I guess marker names would count as well.
Yeah, most likely...

Zeesh, you have some helluva lot of named objects there.. ::)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Could someone from the ECP team please provide some advice
« Reply #7 on: 26 Jan 2005, 11:37:12 »
Yeh I guess so.  It is  a whole island though

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Could someone from the ECP team please provide some advice
« Reply #8 on: 29 Jan 2005, 15:16:02 »
In case anyone is interested I have solved the problem.  Thanks to General Barron and HateR_Kint I was pointed in the right direction.

It seems that the OFP has a bug (I cannot bring myself to call something that kills the program a ‘feature') that prevents it from resuming from a save.  It appears that this bug is triggered when resuming a save game that has a lot of active variables.  

From the little experimentation I have done it appears that the following are relevant:
the number of global variables;
the number of local variables in scripts that are running at the time of the save;
the number of units/objects (I do not know if a unit/object with a name has the same effect as one without a name).

Things I have done that stopped my mission hitting this OFP bug:
The mission is a big one so to minimise CPU consuming triggers I put a lot of stuff on slow looping scripts (~5 mins; ~15 mins and ~45 mins).  I was also very modular about it so each script might have had several instances.  All the scripts were running from the start of the mission.  So basically I had all these scripts with all their local variables sitting around doing nothing for minutes at a time and then they would run for a few milliseconds and go back to waiting.  Each script now runs and then exits, and I have a single ‘housekeeping' script that calls these scripts at appropriate intervals.  So at most any savegame will now only have the local variables for one script.

I also redid my custom made mines so that the cases are created when the mine is laid.  This was on my list of things to do anyway just to tidy it up.  Interestingly I was getting an error on Item25\data.value.  I removed 30 named objects from the mission and the bug went away.  I did not have the energy to put back 5 or 6 to see if the error was then on Item1 or 2.