Simulation optimization question

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
arjmaj
Posts: 10
Joined: Wed, 5. Dec 18, 16:56
x4

Simulation optimization question

Post by arjmaj » Fri, 1. Jul 22, 02:36

Hi, im new with modding games, and X4 is the best candidate now (and i love this game).

Before i get in the guides and everything, i want to ask a quick question. Is it possible to mod the way the simulation works in the game? I know that is a heavely CPU bound game. I want to try to improve performance, playing late game at 10 fps its not fun. I have experience coding, but not for games. Having family with kids and work, i dont want to invest time in something that maybe is a limitation of the engine and can be only improved by the dev team.

Sorry for my english

User avatar
alt3rn1ty
Posts: 2298
Joined: Thu, 26. Jan 06, 19:45
x4

Re: Simulation optimization question

Post by alt3rn1ty » Sat, 2. Jul 22, 10:09

I dont have any experience with modding X4, but do have a good feel for its performance and maybe can make a suggestion or two .. but honestly I dont think much can be done to help X4s performance.

First if you have not seen it have a read of Imperial Goods sticky post in the Technical support forum :
viewtopic.php?f=180&t=420952
CPU: At least a 4 core processor running at 4GHz or more from at earliest 2013. X4 is extremely CPU intensive to run and especially benefits from high single thread performance rather than large core counts. X4 will run on practically any x86-64 processor, even ones over 10 years old, but slower processors may result in very low frame rates in a lot of gameplay situations and could be considered unplayable to some players.
Personally I have a decent CPU (see signature) which mostly plays the game well, but occasionally I still see drops in FPS nearly down at the 30fps mark.

The devs have optimised this game to death (even overhauling the game engine to use the Vulkan API at one point) trying to do what they can as best as they can to have a good balance for the published game specifications (I do feel though the devs were a bit too optimistic when the game specifications were published). Game engine wise, Egosoft really are the experts with this custom game engine they created.

So I dont think there is much at all anyone could do with a mod.

Worst cases with fps drop seems to be when you are on a large station, with lots of traffic around and a lot of asteroids in the sector, and when you also have the map open.

Soo maybe if the amount of asteroids in any particularly bothersome sector could be thinned out a bit, and the amount of NPC Jobs could be cut down, maybe these two suggestions would help a little overall. But then mining would become constrained a bit, and NPC jobs would have to be very carefully edited so as not to create game balance issues depending on what jobs were cut down.

But honestly, I feel the best solution will be when we all have CPUs well in excess of the published game requirements, then we will see good and consistent FPS.

Edit: Another possibility, but again it would have minor impact, modding weapons to lessen the effect on performance of a local large battle, but this modification would be a hugely complex undertaking just in balance considerations, and may not be worth the effort for a small gain in performance (its been done before on a previous X game, that games weapon modification took about 3 years to do, by which time everyone had more up to date computers which negated the need for the mod).
Laptop Dell G15 5510 : Win 11 x64
CPU - 10th Gen' Core I7 10870H 2.2-5.0ghz, GPU - NVidia Geforce RTX 3060, VRAM 6gb GDDR5,
RAM - 32gb (2x16gb, Dual Channel mode set in BIOS) DDR4 2933mhz Kingston Fury Impact,
SSD - Kioxia M.2 NVME 512gb (System), + Samsung M.2 NVME 970 Evo Plus 1tb (Games)

:boron: Long live Queen Polypheides and may her tentacles always be supple.
Seeker of Sohnen.

Scoob
Posts: 9921
Joined: Thu, 27. Feb 03, 22:28
x4

Re: Simulation optimization question

Post by Scoob » Sat, 2. Jul 22, 13:04

For me, other than the odd minor gremlin - I guess something loading in the background - performance is pretty much entirely based on what's going on in the current sector. I.e. I could be in-sector, next to a giant station with loads of civilian ships buzzing around while a giant battle is taking place and fps will get into the 30's, though that's quite rare. I teleport to another sector and fps is perfect once more, yet those events are still taking place elsewhere, albeit using simpler calculations.

In my current game, I have a sector with four factories of mine, some quite sizeable, with a LOT of both civilian and military traffic - literally hundreds of ships, trading, mining and patrolling. Performance in this sector is great, even if a minor skirmish (usually SCA or Kha'ak) erupts. Other sectors might see more heavy combat, those bordering conflict zones with the Xenon, or the ARG/HOP or HOP/PAR Borders. It's invariably combat that hits performance for me, so that's where I notice the most obvious dips. Flying near a large, busy station with lots of civilian traffic isn't really a problem. Though I aware some people like to construct mega complexes with hundreds of modules, I don't go quite that far myself lol, but can imagine they do have an in-sector performance impact. Indeed, there's a test save with such a station. In sector performance near this mega station is, well, it's unplayable at under 20fps IIRC. Teleport away however, and fps is fine - I lock my at 60 max, and it's back to that.

What could be done to improve this? Well, when you have a gun that's firing many shots per second, with a (relatively) slow bullet speed meaning LOTS of projectiles are in-flight at once, then you have loads of ships doing the same, that can effect performance. Swap out those weapons for ones that fire more slowly, but hit harder with a faster shot speed and that's a lot less for the game to keep track of. Battles might not look quite so spectacular, but performance should be improved with (for example) a 10th of the projectiles in the air at a given time. There's also the AI of all those ships of course, manoeuvring, tracking targets, making attack runs, that doubtless has an impact too, so perhaps there's room for improvements there, likely around the frequency of events / checks I'd imagine.

These are just from my own observations, comparing things like ships fitted with a rapid-fire "machine gun" type weapon with loads of projectiles in the are vs. being equipped with a slower-firing weapon in similar situations. Remember a rapid-firing (lots of bullets) weapon will be causing lots of hits (bullet impact effect, shield effect) as well, and it all adds up.

One of the first mods I did, way back in X2, was a performance mod as it changed the effects used for bullet impacts to a less costly one. Mine didn't look anywhere near as pretty - some weapons didn't even have an effect, other that a quick flash of light - but it made a huge difference even in one on one fights. Because the results were so very drastic - I had a decent rig at the time - Egosoft actually made their own changes (one of the devs contacted me directly) to improve things, making my mod obsolete. A great result I thought. I also did other personal mods for X2 and the various X3 titles to tweak weapon RoF and projectiles speeds while keeping the overall DPS average the same. With harder-hitting and more accurate weapons, I then tweaked ship hulls and shields to be stronger, so battles lasted longer than a couple of shots. Eventually I started using someone else's Mod as they'd made near the exact same changes I had - at first I even thought "how did this guy get my files?", but it was a simple case of someone with the same take on balance as me. His mod expanded things further, so I continue to use that instead.

I haven't modded for ages. I dabbled with X Rebirth briefly at launch - there were things missing, like Capital ships didn't have their main hull shields - but haven't touched X4. I used various mods today, but don't mod myself. Performance optimisation has always been of interest to me, indeed, it's formed not insignificant parts of jobs I've done over the years. Best of luck with your endeavours.

arjmaj
Posts: 10
Joined: Wed, 5. Dec 18, 16:56
x4

Re: Simulation optimization question

Post by arjmaj » Sun, 3. Jul 22, 05:29

Well, maybe it has room to improve. Based on my experience playing it, and from what you guys have said, i can see where to improve the game. This are only ideas right now, but before i jump to the void, i need to have clear ideas and a step by step plan.
But, some ideas came to mind without much thinking.
For example asteroid belts. Eliminating small asteroids, and increasing shield of ore per asteriod to maintain balance.
Changing the type of turrets, instead of real 3D ammo and collisions, use the same model for view and transform that object to a ray, slow its velocity and voila, same gun effect without 3D object.
Shields, change the effect to a light on-light off shield, so you wont see the "impact" but you will know that your ship its being hit.
This are things of the top of my head. I will came again with a full plan. How to implement it, and what to tackle first.
Thanks for the suggestions.

Post Reply

Return to “X4: Foundations - Scripts and Modding”