[FIX] Huge FPS / performance increase for bugged "explored" maps

Ask here if you experience technical problems with X4: Foundations.

Moderator: Moderators for English X Forum

Post Reply
Posts: 16
Joined: Fri, 7. Dec 18, 23:19

[FIX] Huge FPS / performance increase for bugged "explored" maps

Post by mythal01 » Thu, 13. Dec 18, 01:17

Hi all.
I just want to post this so others can benefit from it.

I have this problem in my games where if I use the auto-explore, even with mods that try to fix it (they unfortunately dont), my scout ships will wander off in certain zones 1000km from center (I had one scout ship completely across the neighboring zone! it still said he was in zone X when he was on the other side of zone Y! still scouting!).

This appears to be a problem with the boundaries of certain sectors or something. Not sure.
However, if you scout more of a zone, then that zone "expands" - it stores more info in your save file - in memory - and lags your game.
Basically the more of the map that is "explored", the more lag.
This not only lags your map view, but general gameplay.

I am talking about issues like this post here:
https://steamcommunity.com/app/392160/d ... 797549098/
or a direct picture:
https://steamuserimages-a.akamaihd.net/ ... D9B3A8B97/

If you have this, then you found the right place.

I found in the save file the location of all the stored map explored data.
I got a linux tool to delete it all, and its all quite simple.
NOTE: This WILL delete all your explored map, so once you load the game, you will only have vision of wherever you have sattelites.
NOTE: This WILL NOT delete sectors you have discovered. You will still see them, and all the stations in them that you have discovered, they will just be under a "fog of war".

If you are on windows you need to download "sed":
Then get a bash shell by downloading git:

1. Open git bash shell (its a command terminal unix style)
2. Use "cd" command to navigate to your save folder - EG:

Code: Select all

cd /c/Users/YOUR-USER-NAME/Documents/Egosoft/X4/THE-NUMBER-X4-USES/save
3. Unzip your save file, (replace filename with the save you want to clean) - EG:

Code: Select all

gzip -dk save_001.xml.gz
4. Use "sed" on the save.xml file to delete all the discovered map data - EG:

Code: Select all

sed '/^<discovered>/,/<\/discovered>/d' save_001.xml > save_xxx.xml
5. Rename the save file to a save file number that you have an empty slot for - IE: if you did not save slot #9, you can rename the save file: save_009.xml

Code: Select all

mv save_xxx.xml save_009.xml
6. Now you can load that save file in-game. I suggest immediately saving a new slot in-game, for example if you used slot #9 for the clean file, then save in another empty slot.

What this does - it deletes all the "discovered" map data from your save file. Once the game loads, it will "rediscover" any map area where you have: 1) Ships, 2) Sattelites, or 3) Stations. The rest will be "undiscovered" and under the "fog of war".

This DRASTICALLY fixes game lag especially if you have uncovered way too much map via bugged out explorers.


Posts: 37910
Joined: Tue, 29. Apr 03, 00:56

Re: [FIX] Huge FPS / performance increase for bugged "explored" maps

Post by CBJ » Thu, 13. Dec 18, 01:42

Please be aware that this will mark your game as modified.

Posts: 8
Joined: Wed, 9. Jan 19, 23:19

Re: [FIX] Huge FPS / performance increase for bugged "explored" maps

Post by RiggidNoodle » Mon, 25. Feb 19, 20:46

Yeah not that we have much of an option, since ES said that this was on the radar and released 2.0 with no way of resetting sector sizes. As with regards to the 'modified' tag, the only who'll probably lose from this is ES itself as we wouldn't be able to submit the save file for a bug report.

Posts: 118
Joined: Thu, 8. Aug 19, 23:54

Re: [FIX] Huge FPS / performance increase for bugged "explored" maps

Post by AquilaRossa » Wed, 28. Aug 19, 18:29

I am tempted to try this fix above just so I can keep playing my current game. I have seven expanded sectors now. The last two were caused by station defence drones flying off in a straight line. I am getting 55-90 FPS in space, but that drops to 15-30 fps when i have the map open. The map is very laggy and slow to respond to my clicks etc. Even worse if i am docked. I have resorted to flying far from everything so i can manage my stuff without as much lag (which required me to mod encounters off, which is something I'd like to be in the options menu tbh). The expanded sectors happened very quickly in my game. Does it really cause this lag, or is it down to so much going on in my game, or both?
If this quick fix does help, perhaps release a tool that resides in the game directory that runs this command as a batch file and creates a cleaned save we can try. That would be good for the users that are not familiar with running command line and tools this fix requires. i am not. i could work it out, but found myself trying to do it in Notepad++ and it was too much scrolling.

edit. i had a go and installed the programs with default settings. used the command to process the file. It took a few minutes and you could see it working its way through all that game data. I thought I might be in luck, but no, the game could not load that save. I replaced it with my backup. Maybe I need to try using admin privileges due to it being in a user folder? I'll have another go tomorrow. Egosoft adding a "forget this sector button to the map would be nice as a stop gap solution until the root cause is solved.

Posts: 1
Joined: Wed, 25. Dec 19, 21:10

Re: [FIX] Huge FPS / performance increase for bugged "explored" maps

Post by illcat » Tue, 21. Jan 20, 19:10

Done this through a few times, might be operator error, but I end up with size 0 files that don't work.

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 20569
Joined: Fri, 16. Apr 04, 19:21

Re: [FIX] Huge FPS / performance increase for bugged "explored" maps

Post by Alan Phipps » Tue, 21. Jan 20, 20:54

Well the proposed modding fix is over a year old now and there was never any assurance that it would survive subsequent game version updates.
A dog has a master; a cat has domestic staff.

Post Reply

Return to “X4: Foundations - Technical Support”